diff options
Diffstat (limited to 'debug')
800 files changed, 56 insertions, 80780 deletions
diff --git a/debug/org.eclipse.cdt.debug.application.product/debug.product b/debug/org.eclipse.cdt.debug.application.product/debug.product index e866d742b0e..6cfa627b3df 100644 --- a/debug/org.eclipse.cdt.debug.application.product/debug.product +++ b/debug/org.eclipse.cdt.debug.application.product/debug.product @@ -30,7 +30,6 @@ <windowImages i16="/org.eclipse.cdt.debug.application/icons/cc16.png" i32="/org.eclipse.cdt.debug.application/icons/cc32.png" i48="/org.eclipse.cdt.debug.application/icons/cc48.png" i64="/org.eclipse.cdt.debug.application/icons/cc64.png" i128="/org.eclipse.cdt.debug.application/icons/cc128.png" i256="/org.eclipse.cdt.debug.application/icons/cc.png"/> - <launcher name="cdtdebug"> <linux icon="../org.eclipse.cdt.debug.application/icons/cc.xpm"/> <solaris/> @@ -202,8 +201,6 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U <plugin id="org.eclipse.cdt.debug.application"/> <plugin id="org.eclipse.cdt.debug.application.doc"/> <plugin id="org.eclipse.cdt.debug.core"/> - <plugin id="org.eclipse.cdt.debug.mi.core"/> - <plugin id="org.eclipse.cdt.debug.mi.ui"/> <plugin id="org.eclipse.cdt.debug.ui"/> <plugin id="org.eclipse.cdt.debug.ui.memory.floatingpoint"/> <plugin id="org.eclipse.cdt.debug.ui.memory.memorybrowser"/> diff --git a/debug/org.eclipse.cdt.debug.application.tests/StandaloneTests.launch b/debug/org.eclipse.cdt.debug.application.tests/StandaloneTests.launch index f4274983f9c..d5f5c0e3bd9 100644 --- a/debug/org.eclipse.cdt.debug.application.tests/StandaloneTests.launch +++ b/debug/org.eclipse.cdt.debug.application.tests/StandaloneTests.launch @@ -11,7 +11,7 @@ <booleanAttribute key="clearwslog" value="false"/> <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/> <booleanAttribute key="default" value="false"/> -<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.cdt.alltests,org.eclipse.cdt.autotools.core,org.eclipse.cdt.autotools.docs,org.eclipse.cdt.autotools.tests,org.eclipse.cdt.autotools.ui,org.eclipse.cdt.autotools.ui.tests,org.eclipse.cdt.build.crossgcc,org.eclipse.cdt.codan.core.test,org.eclipse.cdt.codan.examples,org.eclipse.cdt.core.lrparser,org.eclipse.cdt.core.lrparser.tests,org.eclipse.cdt.core.lrparser.xlc,org.eclipse.cdt.core.lrparser.xlc.tests,org.eclipse.cdt.core.parser.upc,org.eclipse.cdt.core.parser.upc.tests,org.eclipse.cdt.core.tests,org.eclipse.cdt.debug.ui.tests,org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui,org.eclipse.cdt.errorparsers.xlc,org.eclipse.cdt.errorparsers.xlc.tests,org.eclipse.cdt.examples.dsf,org.eclipse.cdt.examples.dsf.pda,org.eclipse.cdt.examples.dsf.pda.ui,org.eclipse.cdt.launch.remote,org.eclipse.cdt.make.core.tests,org.eclipse.cdt.make.ui.tests,org.eclipse.cdt.make.xlc.core,org.eclipse.cdt.managedbuilder.bupc.ui,org.eclipse.cdt.managedbuilder.core.tests,org.eclipse.cdt.managedbuilder.llvm.tests,org.eclipse.cdt.managedbuilder.llvm.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.ui.tests,org.eclipse.cdt.managedbuilder.xlc.core,org.eclipse.cdt.managedbuilder.xlc.ui,org.eclipse.cdt.managedbuilder.xlupc.ui,org.eclipse.cdt.msw.build,org.eclipse.cdt.p2,org.eclipse.cdt.p2.generator,org.eclipse.cdt.qt.core,org.eclipse.cdt.qt.tests,org.eclipse.cdt.qt.ui,org.eclipse.cdt.remote.core,org.eclipse.cdt.sdk,org.eclipse.cdt.testing,org.eclipse.cdt.tests.dsf,org.eclipse.cdt.tests.dsf.gdb,org.eclipse.cdt.testsrunner,org.eclipse.cdt.testsrunner.boost,org.eclipse.cdt.testsrunner.gtest,org.eclipse.cdt.testsrunner.qttest,org.eclipse.cdt.testsrunner.test,org.eclipse.cdt.ui.tests,org.eclipse.cdt.visualizer.core,org.eclipse.cdt.visualizer.examples,org.eclipse.cdt.visualizer.ui,org.eclipse.linuxtools.binutils,org.eclipse.linuxtools.callgraph,org.eclipse.linuxtools.callgraph.core,org.eclipse.linuxtools.callgraph.docs,org.eclipse.linuxtools.callgraph.launch,org.eclipse.linuxtools.callgraph.launch.tests,org.eclipse.linuxtools.callgraph.tests,org.eclipse.linuxtools.cdt.autotools.core,org.eclipse.linuxtools.cdt.libhover.devhelp,org.eclipse.linuxtools.cdt.libhover.devhelp.tests,org.eclipse.linuxtools.cdt.libhover.libstdcxx,org.eclipse.linuxtools.cdt.libhover.newlib,org.eclipse.linuxtools.cdt.libhover.tests,org.eclipse.linuxtools.changelog.core,org.eclipse.linuxtools.changelog.cparser,org.eclipse.linuxtools.changelog.doc,org.eclipse.linuxtools.changelog.parsers.java,org.eclipse.linuxtools.changelog.tests,org.eclipse.linuxtools.changelog.ui.tests,org.eclipse.linuxtools.dataviewers,org.eclipse.linuxtools.dataviewers.charts,org.eclipse.linuxtools.dataviewers.piechart,org.eclipse.linuxtools.gcov.core,org.eclipse.linuxtools.gcov.docs,org.eclipse.linuxtools.gcov.launch,org.eclipse.linuxtools.gcov.test,org.eclipse.linuxtools.gprof,org.eclipse.linuxtools.gprof.docs,org.eclipse.linuxtools.gprof.launch,org.eclipse.linuxtools.gprof.test,org.eclipse.linuxtools.man.core,org.eclipse.linuxtools.oprofile.core,org.eclipse.linuxtools.oprofile.core.tests,org.eclipse.linuxtools.oprofile.doc,org.eclipse.linuxtools.oprofile.launch,org.eclipse.linuxtools.oprofile.launch.tests,org.eclipse.linuxtools.oprofile.remote.launch,org.eclipse.linuxtools.oprofile.tests,org.eclipse.linuxtools.oprofile.ui,org.eclipse.linuxtools.oprofile.ui.tests,org.eclipse.linuxtools.perf,org.eclipse.linuxtools.perf.doc,org.eclipse.linuxtools.perf.swtbot.tests,org.eclipse.linuxtools.perf.tests,org.eclipse.linuxtools.profiling.docs,org.eclipse.linuxtools.profiling.launch.ui.rdt.proxy,org.eclipse.linuxtools.profiling.provider.tests,org.eclipse.linuxtools.profiling.tests,org.eclipse.linuxtools.profiling.ui,org.eclipse.linuxtools.profiling.ui.capability,org.eclipse.linuxtools.rdt.proxy,org.eclipse.linuxtools.rpm.core,org.eclipse.linuxtools.rpm.core.tests,org.eclipse.linuxtools.rpm.createrepo,org.eclipse.linuxtools.rpm.createrepo.tests,org.eclipse.linuxtools.rpm.rpmlint,org.eclipse.linuxtools.rpm.ui,org.eclipse.linuxtools.rpm.ui.editor,org.eclipse.linuxtools.rpm.ui.editor.doc,org.eclipse.linuxtools.rpm.ui.editor.tests,org.eclipse.linuxtools.rpmstubby,org.eclipse.linuxtools.ssh.proxy,org.eclipse.linuxtools.systemtap.graphing.core,org.eclipse.linuxtools.systemtap.graphing.core.tests,org.eclipse.linuxtools.systemtap.graphing.ui,org.eclipse.linuxtools.systemtap.structures,org.eclipse.linuxtools.systemtap.structures.tests,org.eclipse.linuxtools.systemtap.ui.consolelog,org.eclipse.linuxtools.systemtap.ui.consolelog.tests,org.eclipse.linuxtools.systemtap.ui.doc,org.eclipse.linuxtools.systemtap.ui.editor,org.eclipse.linuxtools.systemtap.ui.ide,org.eclipse.linuxtools.systemtap.ui.ide.tests,org.eclipse.linuxtools.tools.launch.ui,org.eclipse.linuxtools.valgrind.cachegrind,org.eclipse.linuxtools.valgrind.cachegrind.tests,org.eclipse.linuxtools.valgrind.core,org.eclipse.linuxtools.valgrind.doc,org.eclipse.linuxtools.valgrind.helgrind,org.eclipse.linuxtools.valgrind.helgrind.tests,org.eclipse.linuxtools.valgrind.launch,org.eclipse.linuxtools.valgrind.massif,org.eclipse.linuxtools.valgrind.massif.tests,org.eclipse.linuxtools.valgrind.memcheck,org.eclipse.linuxtools.valgrind.memcheck.tests,org.eclipse.linuxtools.valgrind.tests,org.eclipse.linuxtools.valgrind.ui,org.eclipse.linuxtools.valgrind.ui.editor,org.eclipse.linuxtools.valgrind.ui.tests,org.eclipse.test.performance"/> +<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.cdt.alltests,org.eclipse.cdt.autotools.core,org.eclipse.cdt.autotools.docs,org.eclipse.cdt.autotools.tests,org.eclipse.cdt.autotools.ui,org.eclipse.cdt.autotools.ui.tests,org.eclipse.cdt.build.crossgcc,org.eclipse.cdt.codan.core.test,org.eclipse.cdt.codan.examples,org.eclipse.cdt.core.lrparser,org.eclipse.cdt.core.lrparser.tests,org.eclipse.cdt.core.lrparser.xlc,org.eclipse.cdt.core.lrparser.xlc.tests,org.eclipse.cdt.core.parser.upc,org.eclipse.cdt.core.parser.upc.tests,org.eclipse.cdt.core.tests,org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui,org.eclipse.cdt.errorparsers.xlc,org.eclipse.cdt.errorparsers.xlc.tests,org.eclipse.cdt.examples.dsf,org.eclipse.cdt.examples.dsf.pda,org.eclipse.cdt.examples.dsf.pda.ui,org.eclipse.cdt.launch.remote,org.eclipse.cdt.make.core.tests,org.eclipse.cdt.make.ui.tests,org.eclipse.cdt.make.xlc.core,org.eclipse.cdt.managedbuilder.bupc.ui,org.eclipse.cdt.managedbuilder.core.tests,org.eclipse.cdt.managedbuilder.llvm.tests,org.eclipse.cdt.managedbuilder.llvm.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.ui.tests,org.eclipse.cdt.managedbuilder.xlc.core,org.eclipse.cdt.managedbuilder.xlc.ui,org.eclipse.cdt.managedbuilder.xlupc.ui,org.eclipse.cdt.msw.build,org.eclipse.cdt.p2,org.eclipse.cdt.p2.generator,org.eclipse.cdt.qt.core,org.eclipse.cdt.qt.tests,org.eclipse.cdt.qt.ui,org.eclipse.cdt.remote.core,org.eclipse.cdt.sdk,org.eclipse.cdt.testing,org.eclipse.cdt.tests.dsf,org.eclipse.cdt.tests.dsf.gdb,org.eclipse.cdt.testsrunner,org.eclipse.cdt.testsrunner.boost,org.eclipse.cdt.testsrunner.gtest,org.eclipse.cdt.testsrunner.qttest,org.eclipse.cdt.testsrunner.test,org.eclipse.cdt.ui.tests,org.eclipse.cdt.visualizer.core,org.eclipse.cdt.visualizer.examples,org.eclipse.cdt.visualizer.ui,org.eclipse.linuxtools.binutils,org.eclipse.linuxtools.callgraph,org.eclipse.linuxtools.callgraph.core,org.eclipse.linuxtools.callgraph.docs,org.eclipse.linuxtools.callgraph.launch,org.eclipse.linuxtools.callgraph.launch.tests,org.eclipse.linuxtools.callgraph.tests,org.eclipse.linuxtools.cdt.autotools.core,org.eclipse.linuxtools.cdt.libhover.devhelp,org.eclipse.linuxtools.cdt.libhover.devhelp.tests,org.eclipse.linuxtools.cdt.libhover.libstdcxx,org.eclipse.linuxtools.cdt.libhover.newlib,org.eclipse.linuxtools.cdt.libhover.tests,org.eclipse.linuxtools.changelog.core,org.eclipse.linuxtools.changelog.cparser,org.eclipse.linuxtools.changelog.doc,org.eclipse.linuxtools.changelog.parsers.java,org.eclipse.linuxtools.changelog.tests,org.eclipse.linuxtools.changelog.ui.tests,org.eclipse.linuxtools.dataviewers,org.eclipse.linuxtools.dataviewers.charts,org.eclipse.linuxtools.dataviewers.piechart,org.eclipse.linuxtools.gcov.core,org.eclipse.linuxtools.gcov.docs,org.eclipse.linuxtools.gcov.launch,org.eclipse.linuxtools.gcov.test,org.eclipse.linuxtools.gprof,org.eclipse.linuxtools.gprof.docs,org.eclipse.linuxtools.gprof.launch,org.eclipse.linuxtools.gprof.test,org.eclipse.linuxtools.man.core,org.eclipse.linuxtools.oprofile.core,org.eclipse.linuxtools.oprofile.core.tests,org.eclipse.linuxtools.oprofile.doc,org.eclipse.linuxtools.oprofile.launch,org.eclipse.linuxtools.oprofile.launch.tests,org.eclipse.linuxtools.oprofile.remote.launch,org.eclipse.linuxtools.oprofile.tests,org.eclipse.linuxtools.oprofile.ui,org.eclipse.linuxtools.oprofile.ui.tests,org.eclipse.linuxtools.perf,org.eclipse.linuxtools.perf.doc,org.eclipse.linuxtools.perf.swtbot.tests,org.eclipse.linuxtools.perf.tests,org.eclipse.linuxtools.profiling.docs,org.eclipse.linuxtools.profiling.launch.ui.rdt.proxy,org.eclipse.linuxtools.profiling.provider.tests,org.eclipse.linuxtools.profiling.tests,org.eclipse.linuxtools.profiling.ui,org.eclipse.linuxtools.profiling.ui.capability,org.eclipse.linuxtools.rdt.proxy,org.eclipse.linuxtools.rpm.core,org.eclipse.linuxtools.rpm.core.tests,org.eclipse.linuxtools.rpm.createrepo,org.eclipse.linuxtools.rpm.createrepo.tests,org.eclipse.linuxtools.rpm.rpmlint,org.eclipse.linuxtools.rpm.ui,org.eclipse.linuxtools.rpm.ui.editor,org.eclipse.linuxtools.rpm.ui.editor.doc,org.eclipse.linuxtools.rpm.ui.editor.tests,org.eclipse.linuxtools.rpmstubby,org.eclipse.linuxtools.ssh.proxy,org.eclipse.linuxtools.systemtap.graphing.core,org.eclipse.linuxtools.systemtap.graphing.core.tests,org.eclipse.linuxtools.systemtap.graphing.ui,org.eclipse.linuxtools.systemtap.structures,org.eclipse.linuxtools.systemtap.structures.tests,org.eclipse.linuxtools.systemtap.ui.consolelog,org.eclipse.linuxtools.systemtap.ui.consolelog.tests,org.eclipse.linuxtools.systemtap.ui.doc,org.eclipse.linuxtools.systemtap.ui.editor,org.eclipse.linuxtools.systemtap.ui.ide,org.eclipse.linuxtools.systemtap.ui.ide.tests,org.eclipse.linuxtools.tools.launch.ui,org.eclipse.linuxtools.valgrind.cachegrind,org.eclipse.linuxtools.valgrind.cachegrind.tests,org.eclipse.linuxtools.valgrind.core,org.eclipse.linuxtools.valgrind.doc,org.eclipse.linuxtools.valgrind.helgrind,org.eclipse.linuxtools.valgrind.helgrind.tests,org.eclipse.linuxtools.valgrind.launch,org.eclipse.linuxtools.valgrind.massif,org.eclipse.linuxtools.valgrind.massif.tests,org.eclipse.linuxtools.valgrind.memcheck,org.eclipse.linuxtools.valgrind.memcheck.tests,org.eclipse.linuxtools.valgrind.tests,org.eclipse.linuxtools.valgrind.ui,org.eclipse.linuxtools.valgrind.ui.editor,org.eclipse.linuxtools.valgrind.ui.tests,org.eclipse.test.performance"/> <booleanAttribute key="includeOptional" value="true"/> <stringAttribute key="location" value="${workspace_loc}/../junit-workspace2"/> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> @@ -34,7 +34,7 @@ <stringAttribute key="product" value="org.eclipse.cdt.debug.application.product"/> <booleanAttribute key="run_in_ui_thread" value="false"/> <stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,com.jcraft.jsch@default:default,com.sun.el@default:default,javax.annotation@default:default,javax.el@default:default,javax.inject@default:default,javax.servlet.jsp@default:default,javax.servlet@default:default,javax.xml@default:default,net.sourceforge.lpg.lpgjavaruntime@default:default,org.antlr.runtime@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.codec@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.io@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.derby@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.apache.httpcomponents.httpclient@default:default,org.apache.httpcomponents.httpcore@default:default,org.apache.jasper.glassfish@default:default,org.apache.log4j@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.cyberneko.html@default:default,org.easymock@default:default,org.eclipse.ant.core@default:default,org.eclipse.ant.optional.junit@default:false,org.eclipse.compare.core@default:default,org.eclipse.compare@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.debug.core@default:default,org.eclipse.debug.ui@default:default,org.eclipse.draw2d@default:default,org.eclipse.dstore.core@default:default,org.eclipse.dstore.doc.isv@default:default,org.eclipse.dstore.extra@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer.httpclient4.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient4@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.equinox.launcher.gtk.linux.x86_64@default:false,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.equinox.p2.publisher.eclipse@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.transport.ecf@default:default,org.eclipse.equinox.p2.ui.importexport@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.util@default:default,org.eclipse.help.base@default:default,org.eclipse.help.ui@default:default,org.eclipse.help.webapp@default:default,org.eclipse.help@default:default,org.eclipse.jdt.annotation@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.jdt.core@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.jsch.core@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.mylyn.commons.core@default:default,org.eclipse.mylyn.commons.identity.core@default:default,org.eclipse.mylyn.commons.net@default:default,org.eclipse.mylyn.commons.notifications.core@default:default,org.eclipse.mylyn.commons.notifications.feed@default:default,org.eclipse.mylyn.commons.notifications.ui@default:default,org.eclipse.mylyn.commons.repositories.core@default:default,org.eclipse.mylyn.commons.repositories.ui@default:default,org.eclipse.mylyn.commons.screenshots@default:default,org.eclipse.mylyn.commons.ui@default:default,org.eclipse.mylyn.commons.workbench@default:default,org.eclipse.mylyn.context.core@default:default,org.eclipse.mylyn.context.ui@default:default,org.eclipse.mylyn.discovery.core@default:default,org.eclipse.mylyn.discovery.ui@default:default,org.eclipse.mylyn.monitor.core@default:default,org.eclipse.mylyn.monitor.ui@default:default,org.eclipse.mylyn.tasks.core@default:default,org.eclipse.mylyn.tasks.index.core@default:default,org.eclipse.mylyn.tasks.index.ui@default:default,org.eclipse.mylyn.tasks.search@default:default,org.eclipse.mylyn.tasks.ui@default:default,org.eclipse.mylyn.wikitext.confluence.core@default:default,org.eclipse.mylyn.wikitext.confluence.ui@default:default,org.eclipse.mylyn.wikitext.context.ui@default:default,org.eclipse.mylyn.wikitext.core.ant@default:default,org.eclipse.mylyn.wikitext.core.osgi@default:default,org.eclipse.mylyn.wikitext.core@default:default,org.eclipse.mylyn.wikitext.help.ui@default:default,org.eclipse.mylyn.wikitext.html.core@default:default,org.eclipse.mylyn.wikitext.markdown.core@default:default,org.eclipse.mylyn.wikitext.markdown.ui@default:default,org.eclipse.mylyn.wikitext.mediawiki.core@default:default,org.eclipse.mylyn.wikitext.mediawiki.ui@default:default,org.eclipse.mylyn.wikitext.tasks.ui@default:default,org.eclipse.mylyn.wikitext.textile.core@default:default,org.eclipse.mylyn.wikitext.textile.ui@default:default,org.eclipse.mylyn.wikitext.tracwiki.core@default:default,org.eclipse.mylyn.wikitext.tracwiki.ui@default:default,org.eclipse.mylyn.wikitext.twiki.core@default:default,org.eclipse.mylyn.wikitext.twiki.ui@default:default,org.eclipse.mylyn.wikitext.ui@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.eclipse.pde.runtime@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.platform@default:default,org.eclipse.ptp.services.core@default:default,org.eclipse.ptp.services.ui@default:default,org.eclipse.rcp@default:default,org.eclipse.search@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.swtbot.eclipse.core@default:default,org.eclipse.swtbot.eclipse.finder@default:default,org.eclipse.swtbot.forms.finder@default:default,org.eclipse.swtbot.go@default:default,org.eclipse.swtbot.junit4_x@default:default,org.eclipse.swtbot.swt.finder@default:default,org.eclipse.team.core@default:default,org.eclipse.team.ui@default:default,org.eclipse.text@default:default,org.eclipse.tm.terminal@default:default,org.eclipse.ui.browser@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.console@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.net@default:default,org.eclipse.ui.themes@default:default,org.eclipse.ui.trace@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.eclipse.update.configurator@3:true,org.eclipse.zest.core@default:default,org.eclipse.zest.layouts@default:default,org.hamcrest.core@default:default,org.hamcrest.library@default:default,org.json@default:default,org.jsoup@default:default,org.junit@default:default,org.sat4j.core@default:default,org.sat4j.pb@default:default,org.swtchart@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/> -<stringAttribute key="selected_workspace_plugins" value="org.eclipse.cdt.codan.checkers.ui@default:default,org.eclipse.cdt.codan.checkers@default:default,org.eclipse.cdt.codan.core.cxx@default:default,org.eclipse.cdt.codan.core@default:default,org.eclipse.cdt.codan.ui.cfgview@default:default,org.eclipse.cdt.codan.ui.cxx@default:default,org.eclipse.cdt.codan.ui@default:default,org.eclipse.cdt.core.aix@default:false,org.eclipse.cdt.core.linux.ia64@default:false,org.eclipse.cdt.core.linux.ppc64@default:false,org.eclipse.cdt.core.linux.ppc@default:false,org.eclipse.cdt.core.linux.x86@default:false,org.eclipse.cdt.core.linux.x86_64@default:false,org.eclipse.cdt.core.linux@default:false,org.eclipse.cdt.core.macosx@default:false,org.eclipse.cdt.core.native@default:default,org.eclipse.cdt.core.qnx@default:false,org.eclipse.cdt.core.solaris@default:false,org.eclipse.cdt.core.win32.x86@default:false,org.eclipse.cdt.core.win32.x86_64@default:false,org.eclipse.cdt.core.win32@default:false,org.eclipse.cdt.core@default:default,org.eclipse.cdt.debug.application.doc@default:default,org.eclipse.cdt.debug.application.tests@default:default,org.eclipse.cdt.debug.application@default:default,org.eclipse.cdt.debug.core@default:default,org.eclipse.cdt.debug.gdbjtag.core@default:default,org.eclipse.cdt.debug.gdbjtag.ui@default:default,org.eclipse.cdt.debug.gdbjtag@default:default,org.eclipse.cdt.debug.mi.core@default:default,org.eclipse.cdt.debug.mi.ui@default:default,org.eclipse.cdt.debug.ui.memory.floatingpoint@default:default,org.eclipse.cdt.debug.ui.memory.memorybrowser@default:default,org.eclipse.cdt.debug.ui.memory.search@default:default,org.eclipse.cdt.debug.ui.memory.traditional@default:default,org.eclipse.cdt.debug.ui.memory.transport@default:default,org.eclipse.cdt.debug.ui@default:default,org.eclipse.cdt.doc.isv@default:default,org.eclipse.cdt.doc.user@default:default,org.eclipse.cdt.dsf.gdb.ui@default:default,org.eclipse.cdt.dsf.gdb@default:default,org.eclipse.cdt.dsf.ui@default:default,org.eclipse.cdt.dsf@default:default,org.eclipse.cdt.gdb.ui@default:default,org.eclipse.cdt.gdb@default:default,org.eclipse.cdt.launch@default:default,org.eclipse.cdt.make.core@default:default,org.eclipse.cdt.make.ui@default:default,org.eclipse.cdt.managedbuilder.core@default:default,org.eclipse.cdt.managedbuilder.gnu.ui@default:default,org.eclipse.cdt.ui@default:default,org.eclipse.cdt.util@default:default,org.eclipse.cdt@default:default,org.eclipse.linuxtools.cdt.libhover.glibc@default:default,org.eclipse.linuxtools.cdt.libhover.library.docs@default:default,org.eclipse.linuxtools.cdt.libhover@default:default,org.eclipse.linuxtools.profiling.launch@default:default,org.eclipse.linuxtools.tools.launch.core@default:default"/> +<stringAttribute key="selected_workspace_plugins" value="org.eclipse.cdt.codan.checkers.ui@default:default,org.eclipse.cdt.codan.checkers@default:default,org.eclipse.cdt.codan.core.cxx@default:default,org.eclipse.cdt.codan.core@default:default,org.eclipse.cdt.codan.ui.cfgview@default:default,org.eclipse.cdt.codan.ui.cxx@default:default,org.eclipse.cdt.codan.ui@default:default,org.eclipse.cdt.core.aix@default:false,org.eclipse.cdt.core.linux.ia64@default:false,org.eclipse.cdt.core.linux.ppc64@default:false,org.eclipse.cdt.core.linux.ppc@default:false,org.eclipse.cdt.core.linux.x86@default:false,org.eclipse.cdt.core.linux.x86_64@default:false,org.eclipse.cdt.core.linux@default:false,org.eclipse.cdt.core.macosx@default:false,org.eclipse.cdt.core.native@default:default,org.eclipse.cdt.core.qnx@default:false,org.eclipse.cdt.core.solaris@default:false,org.eclipse.cdt.core.win32.x86@default:false,org.eclipse.cdt.core.win32.x86_64@default:false,org.eclipse.cdt.core.win32@default:false,org.eclipse.cdt.core@default:default,org.eclipse.cdt.debug.application.doc@default:default,org.eclipse.cdt.debug.application.tests@default:default,org.eclipse.cdt.debug.application@default:default,org.eclipse.cdt.debug.core@default:default,org.eclipse.cdt.debug.gdbjtag.core@default:default,org.eclipse.cdt.debug.gdbjtag.ui@default:default,org.eclipse.cdt.debug.gdbjtag@default:default,org.eclipse.cdt.debug.ui.memory.floatingpoint@default:default,org.eclipse.cdt.debug.ui.memory.memorybrowser@default:default,org.eclipse.cdt.debug.ui.memory.search@default:default,org.eclipse.cdt.debug.ui.memory.traditional@default:default,org.eclipse.cdt.debug.ui.memory.transport@default:default,org.eclipse.cdt.debug.ui@default:default,org.eclipse.cdt.doc.isv@default:default,org.eclipse.cdt.doc.user@default:default,org.eclipse.cdt.dsf.gdb.ui@default:default,org.eclipse.cdt.dsf.gdb@default:default,org.eclipse.cdt.dsf.ui@default:default,org.eclipse.cdt.dsf@default:default,org.eclipse.cdt.gdb.ui@default:default,org.eclipse.cdt.gdb@default:default,org.eclipse.cdt.launch@default:default,org.eclipse.cdt.make.core@default:default,org.eclipse.cdt.make.ui@default:default,org.eclipse.cdt.managedbuilder.core@default:default,org.eclipse.cdt.managedbuilder.gnu.ui@default:default,org.eclipse.cdt.ui@default:default,org.eclipse.cdt.util@default:default,org.eclipse.cdt@default:default,org.eclipse.linuxtools.cdt.libhover.glibc@default:default,org.eclipse.linuxtools.cdt.libhover.library.docs@default:default,org.eclipse.linuxtools.cdt.libhover@default:default,org.eclipse.linuxtools.profiling.launch@default:default,org.eclipse.linuxtools.tools.launch.core@default:default"/> <booleanAttribute key="show_selected_only" value="false"/> <stringAttribute key="testApplication" value="org.eclipse.cdt.debug.application.app"/> <booleanAttribute key="tracing" value="false"/> diff --git a/debug/org.eclipse.cdt.debug.application/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.application/META-INF/MANIFEST.MF index 671dbc8b21c..f762ac2a263 100644 --- a/debug/org.eclipse.cdt.debug.application/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.cdt.debug.application/META-INF/MANIFEST.MF @@ -8,8 +8,6 @@ Bundle-Vendor: %provider Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.cdt.debug.ui;bundle-version="7.3.0", - org.eclipse.cdt.debug.mi.core;bundle-version="7.3.0", - org.eclipse.cdt.debug.mi.ui;bundle-version="6.1.1", org.eclipse.cdt.dsf;bundle-version="2.4.0", org.eclipse.cdt.dsf.gdb;bundle-version="4.2.0", org.eclipse.cdt.dsf.gdb.ui;bundle-version="2.4.0", diff --git a/debug/org.eclipse.cdt.debug.application/scripts/config.ini b/debug/org.eclipse.cdt.debug.application/scripts/config.ini index e758d22ce96..e09364a4d38 100644 --- a/debug/org.eclipse.cdt.debug.application/scripts/config.ini +++ b/debug/org.eclipse.cdt.debug.application/scripts/config.ini @@ -2,6 +2,6 @@ #Fri Dec 20 17:38:27 EST 2013 osgi.install.area=file\:$eclipse.home$ osgi.framework=file\:$eclipse.home$/plugins/$osgi.jar$ -osgi.bundles=org.eclipse.cdt.core.linux,org.eclipse.linuxtools.cdt.libhover.library.docs,org.eclipse.cdt.core.native,org.eclipse.core.net,org.eclipse.e4.core.di.extensions,org.eclipse.cdt.debug.ui.memory.floatingpoint,org.eclipse.ui.editors,org.eclipse.equinox.ds@1\:start,org.eclipse.search,org.eclipse.text,org.eclipse.jface.databinding,org.eclipse.cdt.debug.ui.memory.search,org.eclipse.debug.core,org.apache.batik.util,org.eclipse.cdt.debug.ui.memory.memorybrowser,org.eclipse.e4.ui.widgets,org.eclipse.cdt.debug.core,org.eclipse.ui,org.eclipse.cdt.make.core,javax.annotation,org.eclipse.equinox.registry,org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.traditional,org.eclipse.cdt.ui,org.eclipse.ui.ide,org.w3c.dom.svg,org.eclipse.jface,org.eclipse.ltk.ui.refactoring,org.w3c.dom.smil,org.eclipse.e4.ui.model.workbench,org.eclipse.equinox.bidi,org.eclipse.e4.ui.workbench,org.eclipse.e4.ui.di,org.eclipse.debug.ui,org.eclipse.e4.ui.bindings,org.eclipse.core.contenttype,org.eclipse.e4.ui.workbench.swt,org.eclipse.ui.views,org.eclipse.emf.ecore.change,org.eclipse.equinox.app,org.eclipse.e4.ui.services,org.eclipse.ant.core,org.eclipse.equinox.p2.core,org.eclipse.cdt.core,org.eclipse.cdt.debug.application,org.eclipse.cdt.debug.application.doc,org.eclipse.core.resources,org.eclipse.team.ui,org.eclipse.equinox.common@2\:start,org.eclipse.equinox.p2.engine,org.eclipse.cdt.debug.ui,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.views.log,org.eclipse.help,org.eclipse.help.ui,org.eclipse.help.base,org.eclipse.help.webapp,org.eclipse.equinox.jsp.jasper,org.eclipse.equinox.jsp.jasper.registry,org.apache.jasper.glassfish,org.apache.lucene.core,org.apache.lucene.analysis,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.registry,org.eclipse.jetty.http,org.eclipse.equinox.http.servlet,org.eclipse.jetty.io,org.eclipse.jetty.server,org.eclipse.jetty.servlet,org.eclipse.jetty.util,org.eclipse.jetty.continuation,org.eclipse.jetty.security,javax.servlet.jsp,javax.el,org.eclipse.core.filesystem,org.eclipse.equinox.event,org.eclipse.cdt.dsf.gdb.ui,org.eclipse.ltk.core.refactoring,org.eclipse.cdt.debug.mi.ui,com.ibm.icu,org.eclipse.swt,org.eclipse.core.filebuffers,org.eclipse.e4.ui.workbench.addons.swt,javax.inject,$swt.plugin$,org.eclipse.core.databinding.observable,org.eclipse.core.jobs,org.eclipse.ui.forms,org.eclipse.e4.core.contexts,javax.xml,org.eclipse.core.variables,org.eclipse.ui.navigator,org.eclipse.e4.core.commands,org.eclipse.core.databinding,org.eclipse.core.commands,org.eclipse.ui.workbench,org.eclipse.equinox.util,org.eclipse.cdt.launch,org.w3c.css.sac,org.eclipse.e4.ui.workbench.renderers.swt,org.eclipse.cdt.managedbuilder.core,org.eclipse.jface.text,org.eclipse.cdt.managedbuilder.gnu.ui,org.eclipse.equinox.p2.metadata,org.eclipse.emf.ecore.xmi,org.eclipse.emf.common,org.eclipse.cdt.gdb,org.eclipse.compare.core,$linux.plugin$,org.eclipse.ui.console,org.eclipse.cdt.dsf.gdb,javax.servlet,org.eclipse.equinox.p2.repository,org.eclipse.linuxtools.cdt.libhover.glibc,org.eclipse.equinox.security,org.eclipse.compare,org.eclipse.core.runtime@start,org.eclipse.cdt.dsf,org.eclipse.osgi.services,org.eclipse.e4.ui.workbench3,org.eclipse.equinox.preferences,org.w3c.dom.events,org.eclipse.linuxtools.cdt.libhover,org.eclipse.cdt.debug.mi.core,org.eclipse.ui.navigator.resources,org.eclipse.e4.ui.css.core,org.eclipse.ui.workbench.texteditor,org.eclipse.core.expressions,org.eclipse.e4.ui.css.swt.theme,org.eclipse.core.databinding.property,org.eclipse.emf.ecore,org.eclipse.e4.core.services,org.eclipse.cdt.gdb.ui,org.apache.batik.util.gui,org.eclipse.e4.core.di,$fs.plugin$,org.eclipse.team.core,org.eclipse.cdt.debug.ui.memory.transport,org.eclipse.equinox.p2.metadata.repository,org.eclipse.e4.ui.css.swt,org.apache.batik.css,org.eclipse.e4.emf.xpath,org.apache.commons.jxpath,org.tukaani.xz,org.eclipse.e4.core.di.annotations,com.google.gson +osgi.bundles=org.eclipse.cdt.core.linux,org.eclipse.linuxtools.cdt.libhover.library.docs,org.eclipse.cdt.core.native,org.eclipse.core.net,org.eclipse.e4.core.di.extensions,org.eclipse.cdt.debug.ui.memory.floatingpoint,org.eclipse.ui.editors,org.eclipse.equinox.ds@1\:start,org.eclipse.search,org.eclipse.text,org.eclipse.jface.databinding,org.eclipse.cdt.debug.ui.memory.search,org.eclipse.debug.core,org.apache.batik.util,org.eclipse.cdt.debug.ui.memory.memorybrowser,org.eclipse.e4.ui.widgets,org.eclipse.cdt.debug.core,org.eclipse.ui,org.eclipse.cdt.make.core,javax.annotation,org.eclipse.equinox.registry,org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.traditional,org.eclipse.cdt.ui,org.eclipse.ui.ide,org.w3c.dom.svg,org.eclipse.jface,org.eclipse.ltk.ui.refactoring,org.w3c.dom.smil,org.eclipse.e4.ui.model.workbench,org.eclipse.equinox.bidi,org.eclipse.e4.ui.workbench,org.eclipse.e4.ui.di,org.eclipse.debug.ui,org.eclipse.e4.ui.bindings,org.eclipse.core.contenttype,org.eclipse.e4.ui.workbench.swt,org.eclipse.ui.views,org.eclipse.emf.ecore.change,org.eclipse.equinox.app,org.eclipse.e4.ui.services,org.eclipse.ant.core,org.eclipse.equinox.p2.core,org.eclipse.cdt.core,org.eclipse.cdt.debug.application,org.eclipse.cdt.debug.application.doc,org.eclipse.core.resources,org.eclipse.team.ui,org.eclipse.equinox.common@2\:start,org.eclipse.equinox.p2.engine,org.eclipse.cdt.debug.ui,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.views.log,org.eclipse.help,org.eclipse.help.ui,org.eclipse.help.base,org.eclipse.help.webapp,org.eclipse.equinox.jsp.jasper,org.eclipse.equinox.jsp.jasper.registry,org.apache.jasper.glassfish,org.apache.lucene.core,org.apache.lucene.analysis,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.registry,org.eclipse.jetty.http,org.eclipse.equinox.http.servlet,org.eclipse.jetty.io,org.eclipse.jetty.server,org.eclipse.jetty.servlet,org.eclipse.jetty.util,org.eclipse.jetty.continuation,org.eclipse.jetty.security,javax.servlet.jsp,javax.el,org.eclipse.core.filesystem,org.eclipse.equinox.event,org.eclipse.cdt.dsf.gdb.ui,org.eclipse.ltk.core.refactoring,com.ibm.icu,org.eclipse.swt,org.eclipse.core.filebuffers,org.eclipse.e4.ui.workbench.addons.swt,javax.inject,$swt.plugin$,org.eclipse.core.databinding.observable,org.eclipse.core.jobs,org.eclipse.ui.forms,org.eclipse.e4.core.contexts,javax.xml,org.eclipse.core.variables,org.eclipse.ui.navigator,org.eclipse.e4.core.commands,org.eclipse.core.databinding,org.eclipse.core.commands,org.eclipse.ui.workbench,org.eclipse.equinox.util,org.eclipse.cdt.launch,org.w3c.css.sac,org.eclipse.e4.ui.workbench.renderers.swt,org.eclipse.cdt.managedbuilder.core,org.eclipse.jface.text,org.eclipse.cdt.managedbuilder.gnu.ui,org.eclipse.equinox.p2.metadata,org.eclipse.emf.ecore.xmi,org.eclipse.emf.common,org.eclipse.cdt.gdb,org.eclipse.compare.core,$linux.plugin$,org.eclipse.ui.console,org.eclipse.cdt.dsf.gdb,javax.servlet,org.eclipse.equinox.p2.repository,org.eclipse.linuxtools.cdt.libhover.glibc,org.eclipse.equinox.security,org.eclipse.compare,org.eclipse.core.runtime@start,org.eclipse.cdt.dsf,org.eclipse.osgi.services,org.eclipse.e4.ui.workbench3,org.eclipse.equinox.preferences,org.w3c.dom.events,org.eclipse.linuxtools.cdt.libhover,org.eclipse.ui.navigator.resources,org.eclipse.e4.ui.css.core,org.eclipse.ui.workbench.texteditor,org.eclipse.core.expressions,org.eclipse.e4.ui.css.swt.theme,org.eclipse.core.databinding.property,org.eclipse.emf.ecore,org.eclipse.e4.core.services,org.eclipse.cdt.gdb.ui,org.apache.batik.util.gui,org.eclipse.e4.core.di,$fs.plugin$,org.eclipse.team.core,org.eclipse.cdt.debug.ui.memory.transport,org.eclipse.equinox.p2.metadata.repository,org.eclipse.e4.ui.css.swt,org.apache.batik.css,org.eclipse.e4.emf.xpath,org.apache.commons.jxpath,org.tukaani.xz,org.eclipse.e4.core.di.annotations,com.google.gson osgi.configuration.cascaded=false osgi.bundles.defaultStartLevel=4 diff --git a/debug/org.eclipse.cdt.debug.core/.classpath b/debug/org.eclipse.cdt.debug.core/.classpath index 7b8d37a545c..3bc247511f0 100644 --- a/debug/org.eclipse.cdt.debug.core/.classpath +++ b/debug/org.eclipse.cdt.debug.core/.classpath @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="cdi"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/debug/org.eclipse.cdt.debug.core/.settings/org.eclipse.jdt.core.prefs b/debug/org.eclipse.cdt.debug.core/.settings/org.eclipse.jdt.core.prefs index 97f68417d0f..cccb94947c5 100644 --- a/debug/org.eclipse.cdt.debug.core/.settings/org.eclipse.jdt.core.prefs +++ b/debug/org.eclipse.cdt.debug.core/.settings/org.eclipse.jdt.core.prefs @@ -1,6 +1,12 @@ -#Mon Oct 17 17:40:49 PDT 2011 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 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 @@ -18,6 +24,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= 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.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore @@ -25,33 +32,50 @@ 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.includeNullInfoFromAsserts=disabled 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.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled 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.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning 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.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=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 @@ -61,14 +85,17 @@ 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.unusedExceptionParameter=ignore 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.unusedObjectAllocation=ignore 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.unusedTypeParameter=ignore 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.core/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF index b3edf629abe..6a0ca4b12e0 100644 --- a/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF @@ -2,16 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true -Bundle-Version: 7.8.0.qualifier +Bundle-Version: 8.0.0.qualifier Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.cdt.debug.core, org.eclipse.cdt.debug.core.breakpointactions, - org.eclipse.cdt.debug.core.cdi, - org.eclipse.cdt.debug.core.cdi.event, - org.eclipse.cdt.debug.core.cdi.model, - org.eclipse.cdt.debug.core.cdi.model.type, org.eclipse.cdt.debug.core.command, org.eclipse.cdt.debug.core.disassembly, org.eclipse.cdt.debug.core.executables, diff --git a/debug/org.eclipse.cdt.debug.core/build.properties b/debug/org.eclipse.cdt.debug.core/build.properties index df50b0ab8b5..9862f2ae9c2 100644 --- a/debug/org.eclipse.cdt.debug.core/build.properties +++ b/debug/org.eclipse.cdt.debug.core/build.properties @@ -20,6 +20,5 @@ javadoc.packages = org.eclipse.cdt.debug.core.*,\ org.eclipse.cdt.debug.core.cdi.model.* src.includes = schema/,\ about.html -source.. = src/,\ - cdi/ +source.. = src/ diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/CDIException.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/CDIException.java deleted file mode 100644 index c63b55f967e..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/CDIException.java +++ /dev/null @@ -1,57 +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.core.cdi; - -/** - * - * Represents a failure in the CDI model operations. - * - * @since Jul 9, 2002 - */ -public class CDIException extends Exception { - - /** - * All serializable objects should have a stable serialVersionUID - */ - private static final long serialVersionUID = 1L; - - String details = ""; //$NON-NLS-1$ - - public CDIException() { - super(); - } - - public CDIException(String s) { - super(s); - } - - public CDIException(String s, String d) { - super(s); - details = d; - } - - /** - * Returns a more details message(if any). - */ - public String getDetailMessage() { - return details; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return super.toString() + '['+ getDetailMessage() + ']'; - } - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java deleted file mode 100644 index 1587bb5c7c0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java +++ /dev/null @@ -1,30 +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.core.cdi; - -import java.math.BigInteger; - -/** - * - * Represents a line location in the debuggable program. - * - */ -public interface ICDIAddressLocation extends ICDILocation { - - /** - * Returns the address of this location. - * - * @return BigInteger - the address of this location - */ - BigInteger getAddress(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIBreakpointHit.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIBreakpointHit.java deleted file mode 100644 index 64c7a51a74a..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIBreakpointHit.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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; - -/** - * - * Represents an information provided by the session when the program - * stopped by a breakpoint. - * - * @since Aug 27, 2002 - */ -public interface ICDIBreakpointHit extends ICDISessionObject { - /** - * Returns the breakpoint that stopped the program. - * - * @return the breakpoint that stopped the program - */ - ICDIBreakpoint getBreakpoint(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDICondition.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDICondition.java deleted file mode 100644 index 807ef512425..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDICondition.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.core.cdi; - -/** - * - * Represents a break condition. - * - * @since Jul 9, 2002 - */ -public interface ICDICondition { - /** - * Returns the condition expression. - * - * @return the condition expression - */ - String getExpression(); - - /** - * Returns the ignore count of this condition. - * - * @return the ignore count of this condition - */ - int getIgnoreCount(); - - /** - * Returns the thread Ids for this condition. - * - * @return the thread Ids for this condition. - */ - String[] getThreadIds(); - - boolean equals(ICDICondition cond); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEndSteppingRange.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEndSteppingRange.java deleted file mode 100644 index c8566353e74..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEndSteppingRange.java +++ /dev/null @@ -1,21 +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.core.cdi; - -/** - * - * Represents an information provided by the session when a step command - * is completed. - * - * @since Jul 10, 2002 - */ -public interface ICDIEndSteppingRange extends ICDISessionObject { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIErrorInfo.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIErrorInfo.java deleted file mode 100644 index b57b03b3d89..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIErrorInfo.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.core.cdi; - -/** - * - * Represents an information provided by the session when the program - * exited. - * - * @since Jul 10, 2002 - */ -public interface ICDIErrorInfo extends ICDISessionObject { - - /** - * Returns the error message. - */ - String getMessage(); - - /** - * Returns a more verbatim error message(if any). - */ - String getDetailMessage(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEventBreakpointHit.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEventBreakpointHit.java deleted file mode 100644 index 6d800f81616..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEventBreakpointHit.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.core.cdi; - -/** - * Represents an information provided by the session when the program is - * stopped by an event breakpoint - * @since 7.0 - */ -public interface ICDIEventBreakpointHit extends ICDISessionObject { - /** - * Return the type of event breakpoint, as reported by the debugger backend - * (e.g., gdb) when it reports the target suspended - */ - String getEventBreakpointType(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEventManager.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEventManager.java deleted file mode 100644 index f6232f4ce9c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIEventManager.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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; - -/** - * - * Clients interested in the CDI model change notification may - * register with this object. - * - * @since Jul 10, 2002 - */ -public interface ICDIEventManager extends ICDISessionObject { - - /** - * Adds the given listener to the collection of registered - * event listeners. Has no effect if an identical listener is - * already registered. - * - * @param listener - the listener to add - */ - void addEventListener( ICDIEventListener listener ); - - /** - * Removes the given listener from the collection of registered - * event listeners. Has no effect if an identical listener is not - * already registered. - * - * @param listener - the listener to remove - */ - void removeEventListener( ICDIEventListener listener ); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIExitInfo.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIExitInfo.java deleted file mode 100644 index b5f88e96b0a..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIExitInfo.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.core.cdi; - -/** - * - * Represents an information provided by the session when the program - * exited. - * - * @since Jul 10, 2002 - */ -public interface ICDIExitInfo extends ICDISessionObject { - - /** - * Returns an exit code. - * - * @return an exit code - */ - int getCode(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java deleted file mode 100644 index 7232ba7c5b7..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java +++ /dev/null @@ -1,24 +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.core.cdi; - -public interface ICDIFileLocation extends ICDILocation { - - /** - * Returns the source file of this location or <code>null</code> - * if the source file is unknown. - * - * @return the source file of this location - */ - String getFile(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFormat.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFormat.java deleted file mode 100644 index e2bfcefb13c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFormat.java +++ /dev/null @@ -1,25 +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.core.cdi; - -/** - * Format constants. - */ -public interface ICDIFormat { - - final static int NATURAL = 0; - final static int DECIMAL = 1; - final static int BINARY = 2; - final static int OCTAL = 3; - final static int HEXADECIMAL = 4; - final static int FLOAT = 5; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFormattable.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFormattable.java deleted file mode 100644 index 870bc506a34..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFormattable.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Freescale, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms 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, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.core.cdi; - - -/** - * The CDI client's implementation of ICDIValue should implement this interface - * if it wants to dictate the variable/register's natural format. If it doesn't, - * CDT will provide a default behavior (e.g., all integral, non-pointer - * ICDIValue variants will display as decimal). - * - * CDT will exercise this interface only for ICDIValue's whose natural - * format isn't obvious or implied. For example, it will not be exercised for - * ICDIDoubleValue, ICDICharValue or ICDIBoolValue, to name a few. - * - * - */ -public interface ICDIFormattable { - /** - * Called when there is no obvious or implied natural format for the - * ICDIValue. - * - * @return one of the ICDIFormat constants, excluding 'NATURAL' and 'OCTAL'. - * Octal is not supported simply because the general support for it - * is lacking in CDT (apparently no one is asking for it). - * @throws CDIException - */ - int getNaturalFormat() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionFinished.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionFinished.java deleted file mode 100644 index 0e1d81942c0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionFinished.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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; - -/* - * ICDIFunctionFinished - */ -public interface ICDIFunctionFinished extends ICDIEndSteppingRange { - - /** - * Return the type of the return value of - * the function. - * - * @return ICDIType returnType value - */ - ICDIType getReturnType() throws CDIException; - - /** - * The return value of the function. - * - * @return - */ - ICDIValue getReturnValue() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java deleted file mode 100644 index a01da39ec4a..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java +++ /dev/null @@ -1,29 +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.core.cdi; - -/** - * - * Represents a file:function location in the debuggable program. - * - */ -public interface ICDIFunctionLocation extends ICDIFileLocation { - - /** - * Returns the function of this location or <code>null</code> - * if the function is unknown. - * - * @return the function of this location - */ - String getFunction(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java deleted file mode 100644 index 622db49c462..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java +++ /dev/null @@ -1,28 +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.core.cdi; - -/** - * - * Represents a file:line location in the debuggable program. - * - */ -public interface ICDILineLocation extends ICDIFileLocation { - - /** - * Returns the line number of this location or <code>0</code> - * if the line number is unknown. - * - * @return the line number of this location - */ - int getLineNumber(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java deleted file mode 100644 index c0936d78230..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.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.core.cdi; - -/** - * - * Represents a location in the debuggable program. - * - */ -public interface ICDILocation { - - /** - * Return true if both locations refer to the same place. - */ - boolean equals(ICDILocation location); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocator.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocator.java deleted file mode 100644 index 6f8760de0dc..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocator.java +++ /dev/null @@ -1,19 +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.core.cdi; - -/** - * Locator contains information file:function:line:Address - */ -public interface ICDILocator extends ICDIFileLocation, ICDILineLocation, ICDIFunctionLocation, ICDIAddressLocation { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISession.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISession.java deleted file mode 100644 index 16a7ba9a5f0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISession.java +++ /dev/null @@ -1,75 +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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; - -/** - * - * Represents a debug session. - * - * @since Jun 28, 2002 - */ -public interface ICDISession { - /** - * Returns all the debug targets associatd with this sesion, - * or an empty collection if no debug targets are associated - * with this session. - * - * @return an array of debug targets - */ - ICDITarget[] getTargets(); - - /** - * Sets the value of a debug session attribute. - * - * @param key the attribute key - * @param value the attribute value - */ - void setAttribute(String key, String value); - - /** - * Returns the value of a debug session attribute. - * - * @param key the attribute key - * @return value the attribute value, or <code>null</code> if undefined - */ - String getAttribute(String key); - - /** - * Returns the event manager of this debug session. - * - * @return the event manager - */ - ICDIEventManager getEventManager(); - - /** - * Returns the configuration description of this debug session. - * - * @return the configuration description - */ - ICDISessionConfiguration getConfiguration(); - - /** - * Causes this element to terminate, generating a <code>KIND_TERMINATE</code> event. - * - * @exception CDIException on failure. Reasons include: - */ - void terminate() throws CDIException; - - /** - * Gaves direct access to the underlying debugger process. - * @return the debugger process. - */ - Process getSessionProcess() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISessionConfiguration.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISessionConfiguration.java deleted file mode 100644 index 957fcb22b82..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISessionConfiguration.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.core.cdi; - -/** - * Describes the configuration of debug session. - * - * @since Aug 6, 2002 - */ -public interface ICDISessionConfiguration extends ICDISessionObject { - - /** - * Returns whether the session should be terminated when the inferior exits. - * - * @return whether the session be terminated when the inferior exits - */ - boolean terminateSessionOnExit(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISessionObject.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISessionObject.java deleted file mode 100644 index d8d0a89d288..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISessionObject.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.core.cdi; - -/** - * - * Represents an object associated with a debug session. - * - * @since Jul 9, 2002 - */ -public interface ICDISessionObject { - - /** - * Returns the debug session this object is associated with. - * - * @return the debug session this object is associated with - */ - ICDISession getSession(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISharedLibraryEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISharedLibraryEvent.java deleted file mode 100644 index f6e46b050c9..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISharedLibraryEvent.java +++ /dev/null @@ -1,23 +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.core.cdi; - - -/** - * - * Represents an information provided by the session when the program - * stopped by a shared libary event. - * - * @since Aug 18, 2003 - */ -public interface ICDISharedLibraryEvent extends ICDISessionObject { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISignalExitInfo.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISignalExitInfo.java deleted file mode 100644 index 50b4f96be47..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISignalExitInfo.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.core.cdi; - -/** - * Represents information provided by the session when the program exited. - * - */ -public interface ICDISignalExitInfo extends ICDISessionObject { - - /** - * Method getName. - * @return String - */ - String getName(); - - /** - * Method getDescription. - * @return String - */ - String getDescription(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISignalReceived.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISignalReceived.java deleted file mode 100644 index c95d864a780..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISignalReceived.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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; - -/** - * - * Represents a signal. - * - * @since Jul 10, 2002 - */ -public interface ICDISignalReceived extends ICDISessionObject { - - /** - * Method getSignal. - * @return ICDISignal - */ - ICDISignal getSignal(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java deleted file mode 100644 index 45cb0373fce..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java +++ /dev/null @@ -1,161 +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.core.cdi; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint; - -/** - * Manages the collection of registered tracepoints and trace snapshoits - * in the debug session. Provides methods to control tracing. - * - * @since May 15, 2003 - */ -public interface ICDITraceManager extends ICDISessionObject { - /** - * Returns a collection of all tracepoints set for this session. - * Returns an empty array if no tracepoints are set. - * - * @return a collection of all tracepoints set for this session - * @throws CDIException on failure. Reasons include: - */ - ICDITracepoint[] getTracepoints() throws CDIException; - - /** - * Deletes the given tracepoint. - * - * @param tracepoint - a tracepoint to be deleted - * @throws CDIException on failure. Reasons include: - */ - void deleteTracepoint( ICDITracepoint tracepoint ) throws CDIException; - - /** - * Deletes the given array of tracepoints. - * - * @param tracepoints - the array of tracepoints to be deleted - * @throws CDIException on failure. Reasons include: - */ - void deleteTracepoints( ICDITracepoint[] tracepoints ) throws CDIException; - - /** - * Deletes all tracepoints. - * - * @throws CDIException on failure. Reasons include: - */ - void deleteAllTracepoints() throws CDIException; - - /** - * Sets a tracepoint at the given location. - * The tracepoint is set acording to the choices: - * <pre> - * if location.getFile() != null then - * if location.getFunction() != null then - * tracepoint = file:function - * else - * tracepoint = file:line - * else if (location.getFuntion() != null) then - * tracepoint = function - * else if (location.getLineNumber() != 0 then - * tracepoint = line - * else - * tracepoint = address - * end - * </pre> - * - * @param location - the location - * @return a tracepoint - * @throws CDIException on failure. Reasons include: - */ - ICDITracepoint setTracepoint( ICDILocation location ) throws CDIException; - - /** - * Allows the manager to interrupt the excution of program - * when setting a tracepoint. - */ - void allowProgramInterruption( boolean allow ); - - /** - * Starts the tracing and begins collecting data. - * - * @throws CDIException on failure. Reasons include: - */ - void startTracing() throws CDIException; - - /** - * Stops the tracing and ends collecting data. - * - * @throws CDIException on failure. Reasons include: - */ - void stopTracing() throws CDIException; - - /** - * Returns the status of tracing. - * - * @return the status of tracing - * @throws CDIException on failure. Reasons include: - */ - boolean isTracing() throws CDIException; - - /** - * Enables/disables the snapshot debugging mode. - * - * @param enabled <code>true</code> to enable, and <code>false</code> - * to disable - * @throws CDIException on failure. Reasons include: - */ - void enableSnapshotMode( boolean enabled ) throws CDIException; - - /** - * Returns all trace snapshots for this session. - * - * @return all trace snapshots for this session - * @throws CDIException on failure. Reasons include: - */ - ICDITraceSnapshot[] getSnapshots() throws CDIException; - - /** - * Returns all trace snapshots associated with the given tracepoints. - * - * @param tracepoints - an array of tracepoints - * @return all trace snapshots associated with the given tracepoints - * @throws CDIException on failure. Reasons include: - */ - ICDITraceSnapshot[] getSnapshots( ICDITracepoint[] tracepoints ) throws CDIException; - - /** - * Returns all trace snapshots associated with the given locations. - * - * @param locations - an array of locations - * @return all trace snapshots associated with the given locations - * @throws CDIException on failure. Reasons include: - */ - ICDITraceSnapshot[] getSnapshots( ICDILocation[] locations ) throws CDIException; - - /** - * Creates an ICDILocation object for given file name and line number or function. - * - * @param file - a file name - * @param function - a function name - * @param line - a line number - * @return an ICDILocation object - */ - ICDILocation createLocation( String file, String function, int line ); - - /** - * Creates an ICDILocation object for given address. - * - * @param address - an address - * @return an ICDILocation object - */ - ICDILocation createLocation( BigInteger address ); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceSnapshot.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceSnapshot.java deleted file mode 100644 index 5ecfbfccd7b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceSnapshot.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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint; - -/** - * Represents a trace snapshot in the debug session. - * - * @since May 15, 2003 - */ -public interface ICDITraceSnapshot extends ICDISessionObject { - - /** - * Returns the number of this snapshot. - * - * @return the number of this snapshot - */ - int getNumber(); - - /** - * Selects this snapshot. - * - * @throws CDIException on failure. Reasons include: - */ - void select() throws CDIException; - - /** - * Returns the data collected at this snapshot. - * - * @return the data collected at this snapshot - * @throws CDIException on failure. Reasons include: - */ - ICDIObject[] getData() throws CDIException; - - /** - * Returns the array of tracepoints associated with this snapshot. - * - * @return array of tracepoints - */ - ICDITracepoint[] getTracepoints(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIWatchpointScope.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIWatchpointScope.java deleted file mode 100644 index e39db7a2149..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIWatchpointScope.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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; - -/** - * - * Represents an information provided by the session when a watchpoint - * is going out of scope. - * - * @since Aug 27, 2002 - */ -public interface ICDIWatchpointScope extends ICDISessionObject { - /** - * Returns the out of scope watchpoint. - * - * @return the watchpoint - */ - ICDIWatchpoint getWatchpoint(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIWatchpointTrigger.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIWatchpointTrigger.java deleted file mode 100644 index 4f53301d94a..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIWatchpointTrigger.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.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; - -/** - * - * Represents an information provided by the session when a watchpoint - * is triggered. - * - * @since Aug 27, 2002 - */ -public interface ICDIWatchpointTrigger extends ICDISessionObject { - /** - * Returns the triggered watchpoint. - * - * @return the triggered watchpoint - */ - ICDIWatchpoint getWatchpoint(); - - /** - * Returns the old value of the watching expression. - * - * @return the old value of the watching expression - */ - String getOldValue(); - - /** - * Returns the new value of the watching expression. - * - * @return the new value of the watching expression - */ - String getNewValue(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointMovedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointMovedEvent.java deleted file mode 100644 index 4329e90ad1c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointMovedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.ICDILocator; - -/** - * - * Notifies that a breakpoint has changed location. - */ - -public interface ICDIBreakpointMovedEvent extends ICDIEvent { - - /** Returns the new location for the breakpoint. - * @return the breakpoint's new location. - */ - ICDILocator getNewLocation(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointProblemEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointProblemEvent.java deleted file mode 100644 index 827fbd73730..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointProblemEvent.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; - -/** - * - * Notifies that a breakpoint problem has occurred. - */ -public interface ICDIBreakpointProblemEvent { - - /** The problem type is a string that identifies specific - * kinds of breakproblems. - * @return problem type name - */ - String getProblemType(); - - /** The CDI breakpoint that has the problem - * @return the cdi breakpoint that has the problem - */ - ICDIBreakpoint getBreakpoint(); - - /** A description of the problem. - * This will be presented in the problems view. - * @return a description of the problem - */ - String getDescription(); - - /** The severity code maps to the IMarker.SEVERITY_XXX constants. - * @return severity code. - */ - int getSeverity(); - - /** Indicated that existing problems of this type and at this - * breakpoint's location will be removed, no new ones will - * be added. - * @return only remove existing problems - */ - boolean removeOnly(); - - /** Indicated that any existing problems of this type - * and at this breakpoint's location will be removed - * before the new problem is added. - * @return remove any existing markers - */ - boolean removeExisting(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIChangedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIChangedEvent.java deleted file mode 100644 index e21a0db19ba..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIChangedEvent.java +++ /dev/null @@ -1,21 +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.core.cdi.event; - -/** - * - * Notifies that the originator has changed. - * Can be originated by any CDI model object. - * - * @since Jul 10, 2002 - */ -public interface ICDIChangedEvent extends ICDIEvent { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDICreatedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDICreatedEvent.java deleted file mode 100644 index 2ad8f72bede..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDICreatedEvent.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.core.cdi.event; - -/** - * - * Notifies that the originator has been created. - * The originators: - * <ul> - * <li>target (ICDITarget) - * <li>thread (ICDIThread) - * </ul> - * - * @since Jul 10, 2002 - */ -public interface ICDICreatedEvent extends ICDIEvent { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIDestroyedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIDestroyedEvent.java deleted file mode 100644 index ebd0fb08017..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIDestroyedEvent.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.core.cdi.event; - -/** - * - * Notifies that the originator has terminated. - * The originators: - * <ul> - * <li>target (ICDITarget) - * <li>thread (ICDIThread) - * </ul> - * - * @since Jul 10, 2002 - */ -public interface ICDIDestroyedEvent extends ICDIEvent { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIDisconnectedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIDisconnectedEvent.java deleted file mode 100644 index f1986b93f79..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIDisconnectedEvent.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.core.cdi.event; - -/** - * - * Notifies that the originator has disconnected. - * The originators: - * <ul> - * <li>target (ICDITarget) - * </ul> - * - * @since Jul 10, 2002 - */ -public interface ICDIDisconnectedEvent extends ICDIEvent { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIEvent.java deleted file mode 100644 index 60f07c331fb..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIEvent.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.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; - -/** - * - * A base interface for all CDI events. - * - * @since Jul 18, 2002 - */ -public interface ICDIEvent { - /** - * The CDI object on which the event initially occurred. - * - * @return the CDI object on which the event initially occurred - */ - ICDIObject getSource(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIEventListener.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIEventListener.java deleted file mode 100644 index b2b5c7fe89c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIEventListener.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.core.cdi.event; - -/** - * - * An event listener registers with the event manager to receive event - * notification from the CDI model objects. - * - * @since Jul 10, 2002 - */ -public interface ICDIEventListener { - /** - * Notifies this listener of the given event. - * - * @param event - the event - */ - void handleDebugEvents(ICDIEvent[] event); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIExecutableReloadedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIExecutableReloadedEvent.java deleted file mode 100644 index 75a8e1544d2..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIExecutableReloadedEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.cdi.event; - -/** - * - * Notifies that an executable had been reloaded, perhaps after being rebuilt. - */ - -public interface ICDIExecutableReloadedEvent extends ICDIEvent { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIExitedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIExitedEvent.java deleted file mode 100644 index d4d24ced639..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIExitedEvent.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.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; - -/** - * - * Notifies that the program has exited. - * The originators: - * <ul> - * <li>target (ICDITarget) - * </ul> - * - * @since Jul 10, 2002 - */ -public interface ICDIExitedEvent extends ICDIDestroyedEvent { - /** - * Returns the information provided by the session when program - * is exited. - * - * @return the exit information - */ - ICDISessionObject getReason(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.java deleted file mode 100644 index a0f2609a29b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.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.core.cdi.event; - -import java.math.BigInteger; - -/** - * - * Notifies that the originator has changed. - * - */ -public interface ICDIMemoryChangedEvent extends ICDIChangedEvent { - /** - * @return the modified addresses. - */ - BigInteger[] getAddresses(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIRestartedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIRestartedEvent.java deleted file mode 100644 index 4e697fd1d89..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIRestartedEvent.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.core.cdi.event; - -/** - * - * Notifies that the originator has been restarted. - * The originators: - * <ul> - * <li>target (ICDITarget) - * </ul> - * - * @since Jul 11, 2002 - */ -public interface ICDIRestartedEvent extends ICDIEvent { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIResumedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIResumedEvent.java deleted file mode 100644 index 024586bee8b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIResumedEvent.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.core.cdi.event; - -/** - * - * Notifies that the originator has been resumed. - * The originators: - * <ul> - * <li>target (ICDITarget) - * <li>thread (ICDIThread) - * </ul> - * - * @since Jul 10, 2002 - */ -public interface ICDIResumedEvent extends ICDIEvent { - final static public int CONTINUE = 0; - final static public int STEP_OVER = 1; - final static public int STEP_INTO = 2; - final static public int STEP_OVER_INSTRUCTION = 3; - final static public int STEP_INTO_INSTRUCTION = 4; - final static public int STEP_RETURN = 5; - - /** - * Returns the stepping type. - * - * @return the stepping type - */ - int getType(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDISuspendedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDISuspendedEvent.java deleted file mode 100644 index 155d9f4de13..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDISuspendedEvent.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.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; - -/** - * - * Notifies that the originator has been suspended. - * The originators: - * <ul> - * <li>target (ICDITarget) - * <li>thread (ICDIThread) - * </ul> - * The reason of the suspension can be one of the following session - * objects: - * <ul> - * <li>breakpoint (ICDIBreakpoint) - * <li>signal (ICDISignalReceived) - * <li>end of the stepping range (ICDIEndSteppingRange) - * </ul> - * - * @since Jul 10, 2002 - */ -public interface ICDISuspendedEvent extends ICDIEvent { - - /** - * Returns the session object that caused the suspension. - * - * @return ICDIObject - */ - ICDISessionObject getReason(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java deleted file mode 100644 index d8b71b6c387..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java +++ /dev/null @@ -1,21 +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.core.cdi.model; - -/** - * - * Represents an address breakpoint. - * - */ -public interface ICDIAddressBreakpoint extends ICDILocationBreakpoint { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressFactoryManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressFactoryManagement.java deleted file mode 100644 index 44b68a4f14b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressFactoryManagement.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.cdi.model; - -import org.eclipse.cdt.core.IAddressFactory; - -/** - */ -public interface ICDIAddressFactoryManagement { - /** - * Returns an AddressFactory. - * @return a IAddressFactory. - */ - IAddressFactory getAddressFactory(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressToSource.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressToSource.java deleted file mode 100644 index ca296a39618..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressToSource.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.cdi.model; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.core.runtime.IPath; - -/** - * Allows the CDI back-end to translate an address to a source location. - * Usually implemented in the same context as ICDITarget. - * THIS API IS EXPERIMENTAL AND MAY CHANGE IN THE FUTURE. - */ -public interface ICDIAddressToSource { - - - /** - * Represents a source location returned by - * ICDIAddressToSource.getSourceForAddress. - * - */ - interface IMappedSourceLocation extends Comparable { - - /** - * Returns the address of the source location. - * This should be the same address passed to - * ICDIAddressToSource.getSourceForAddress. - * @return address of the source location. - */ - IAddress getAddress(); - - /** - * Returns the location of the source file. - * @return the location of the source file. - */ - IPath getSourceFile(); - - /** - * Returns the line number corresponding to the address. - * @return the line number corresponding to the address. - */ - int getLineNumber(); - - /** - * Returns the name of the function the address is in. - * @return the name of the function the address is in. - */ - String getFunctionName(); - - /** - * Returns the unmangled name of the function the address is in. - * @return the unmangled name of the function the address is in. - */ - String getUnmangledFunctionName(); - - /** - * Return the path to the executable the address is in. - * @return the path to the executable the address is in. - */ - IPath getExecutable(); - } - - /** Returns a symbol that maps to an address at runtime in a targeted process - * @return the symbol (if any) that maps to an address - */ - IMappedSourceLocation getSourceForAddress(IAddress address) throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIArgument.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIArgument.java deleted file mode 100644 index befe3bcb58b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIArgument.java +++ /dev/null @@ -1,21 +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.core.cdi.model; - -/** - * - * Represents an argument in the stack frame. - * - * @since Jul 22, 2002 - */ -public interface ICDIArgument extends ICDILocalVariable, ICDIArgumentDescriptor { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIArgumentDescriptor.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIArgumentDescriptor.java deleted file mode 100644 index d284797ddeb..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIArgumentDescriptor.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.core.cdi.model; - - -/** - */ -public interface ICDIArgumentDescriptor extends ICDILocalVariableDescriptor { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint.java deleted file mode 100644 index 645db9f332e..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint.java +++ /dev/null @@ -1,93 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; - -/** - * - * A breakpoint is capable of suspending the execution of a program - * whenever a certain point in the program is reached. Provides a - * basic functionality for the location breakpoints, watchpoints, - * and event breakpoints - * - * @see ICDILineBreakpoint - * @see ICDIFunctionBreakpoint - * @see ICDIAddressBreakpoint - * @see ICDIWatchpoint - * @see ICDIEventBreakpoint - * - * @since Jul 9, 2002 - */ -public interface ICDIBreakpoint extends ICDIObject { - /** @deprecated use ICBreakpointTyped.REGULAR */ - @Deprecated - final static public int REGULAR = ICBreakpointType.REGULAR; - /** @deprecated use ICBreakpointTyped.TEMPORARY */ - @Deprecated - final static public int TEMPORARY = ICBreakpointType.TEMPORARY; - /** @deprecated use ICBreakpointTyped.HARDWARE */ - @Deprecated - final static public int HARDWARE = ICBreakpointType.HARDWARE; - - /** - * @return whether this breakpoint is temporary - * @deprecated by {@link ICDIBreakpoint2#getType()} - */ - @Deprecated - boolean isTemporary(); - - /** - * @return whether this breakpoint is hardware-assisted - * @deprecated by {@link ICDIBreakpoint2#getType()} - */ - @Deprecated - boolean isHardware(); - - /** - * Returns whether this breakpoint is enabled. - * - * @return whether this breakpoint is enabled - * @throws CDIException if this method fails. Reasons include: - */ - boolean isEnabled() throws CDIException; - - /** - * Sets the enabled state of this breakpoint. This has no effect - * if the current enabled state is the same as specified by - * the enabled parameter. - * - * @param enabled - whether this breakpoint should be enabled - * @throws CDIException if this method fails. Reasons include: - */ - void setEnabled(boolean enabled) throws CDIException; - - /** - * Returns the condition of this breakpoint or <code>null</code> - * if the breakpoint's condition is not set. - * - * @return the condition of this breakpoint - * @throws CDIException if this method fails. Reasons include: - */ - ICDICondition getCondition() throws CDIException; - - /** - * Sets the condition of this breakpoint. - * - * @param the condition to set - * @throws CDIException if this method fails. Reasons include: - */ - void setCondition(ICDICondition condition) throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint2.java deleted file mode 100644 index 41aa10fb1a1..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint2.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Freescale and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms 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 - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.cdi.model; - -import org.eclipse.cdt.debug.core.model.ICBreakpointType; - -/** - * Extension of the ICDIBreakpoint interface - */ -public interface ICDIBreakpoint2 extends ICDIBreakpoint { - - /** - * Return the type of the breakpoint. If the breakpoint's creation - * originated in CDT, then CDT specified the type as part of that request - * and this method must return that value. If the breakpoint's creation - * originated in the CDI client, then this method is invoked by CDT to - * discover the type of the breakpoint. - * - * If the CDI breakpoint implements this interface, then - * {@link ICDIBreakpoint#isTemporary()} and - * {@link ICDIBreakpoint#isHardware()} will never get called by CDT, as this - * method is meant to replace those. - * - * @return one of the type constants defined in ICBreakpointType (note that - * {@link ICBreakpointType#TEMPORARY} can be bit-applied to any of - * the type values to qualify it as a temporary breakpoint. - */ - int getType(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement.java deleted file mode 100644 index cf97564a0ae..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement.java +++ /dev/null @@ -1,111 +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.core.cdi.model; - -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; - -/** - * Breapoints action on the Target. - */ -public interface ICDIBreakpointManagement { - - /** - * Set a line breakpoint. - * - * @param type - * @param location - * @param condition - * @param deferred - * @return - * @throws CDIException - */ - ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, - ICDICondition condition, boolean deferred) throws CDIException; - - /** - * Set a function breakpoint. - * - * @param type - * @param location - * @param condition - * @param deferred - * @return - * @throws CDIException - */ - ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, - ICDICondition condition, boolean deferred) throws CDIException; - - /** - * Set an address Breakpoint - * - * @param type - * @param location - * @param condition - * @param deferred - * @return - * @throws CDIException - */ - ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, - ICDICondition condition, boolean deferred) throws CDIException; - - /** - * Set a watchpoint. - * - * @param type - * @param watchType - * @param expression - * @param condition - * @return - * @throws CDIException - */ - ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, - ICDICondition condition) throws CDIException; - - /** - * Set an exception point. - * - * @param clazz - * @param stopOnThrow - * @param stopOnCatch - * @return - * @throws CDIException - */ - ICDIExceptionpoint setExceptionBreakpoint(String clazz, boolean stopOnThrow, boolean stopOnCatch) throws CDIException; - - /** - * Return all the breakpoints - * - * @return - * @throws CDIException - */ - ICDIBreakpoint[] getBreakpoints() throws CDIException; - - /** - * Remove the breakpoints - * @param breakpoints - * @throws CDIException - */ - void deleteBreakpoints(ICDIBreakpoint[] breakpoints) throws CDIException; - - /** - * Remove all the breakpoints - * - * @throws CDIException - */ - void deleteAllBreakpoints() throws CDIException; - - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java deleted file mode 100644 index 424ce84c056..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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 - * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299 - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.cdi.model; - -import java.math.BigInteger; - -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; - -public interface ICDIBreakpointManagement2 extends ICDIBreakpointManagement { - - /** - * Set a line breakpoint. - * - * @param type - * @param location - * @param condition - * @param deferred - * @param enabled - * @return - * @throws CDIException - */ - ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, - ICDICondition condition, boolean deferred, boolean enabled) throws CDIException; - - /** - * Set a function breakpoint. - * - * @param type - * @param location - * @param condition - * @param deferred - * @param enabled - * @return - * @throws CDIException - */ - ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, - ICDICondition condition, boolean deferred, boolean enabled) throws CDIException; - - /** - * Set an address Breakpoint - * - * @param type - * @param location - * @param condition - * @param deferred - * @param enabled - * @return - * @throws CDIException - */ - ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, - ICDICondition condition, boolean deferred, boolean enabled) throws CDIException; - - /** - * Set a watchpoint. - * - * @param type - * @param watchType - * @param expression - * @param condition - * @param enabled - * @return - * @throws CDIException - */ - ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, - ICDICondition condition, boolean enabled) throws CDIException; - - /** - * Set a watchpoint. - * - * @param type - * @param watchType - * @param expression - * @param memorySpace set to "" for default memorySpace - * @param range set to "" for default range - * @param condition - * @return - * @throws CDIException - */ - ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, String memorySpace, BigInteger range, - ICDICondition condition, boolean enabled) throws CDIException; - - /** - * Set an exception point. - * - * @param clazz - * @param stopOnThrow - * @param stopOnCatch - * @param enabled - * @return - * @throws CDIException - */ - ICDIExceptionpoint setExceptionBreakpoint(String clazz, boolean stopOnThrow, - boolean stopOnCatch, boolean enabled) throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement3.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement3.java deleted file mode 100644 index 798387ef2ff..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement3.java +++ /dev/null @@ -1,27 +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 - * QNX Software Systems - catchpoints - bug 226689 - *******************************************************************************/ -package org.eclipse.cdt.debug.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; - -public interface ICDIBreakpointManagement3 extends ICDIBreakpointManagement2{ - /** - * Set an event breakpoint - * @param type - event breakpoint type, interpreted by backend - * @param arg - extra argument, for example signal number - * @param cdiBreakpointType - cdi breakpoint type, just in case some inferiors support "hardware" event breakpoints - */ - ICDIEventBreakpoint setEventBreakpoint(String type, String arg, int cdiBreakpointType, - ICDICondition condition, boolean deferred, boolean enabled) throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIDisposable.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIDisposable.java deleted file mode 100644 index 411a73a3cd6..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIDisposable.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.core.cdi.model; - -/** - * Some CDI interfaces have a dispose method, but a number of others don't (and - * should). E.g., ICDIVariable does, but ICDIStackFrame doesn't. This interface - * was created to introduce a dispose capability to CDI objects that call for it - * without breaking existing interfaces. - * - * CDT uses instanceof to check whether a CDI object supports this interface and - * if so calls the dispose method when it has no further need for the object. This - * does not apply to all CDI object; just ones for which it makes sense. The list - * is subject to grow: - * <ul> - * <li>{@link ICDITarget} - * <li>{@link ICDIStackFrame} - * <li>{@link ICDIThread} - * </ul> - * @since 6.0 - */ -public interface ICDIDisposable { - /** - * Called when the object is no longer needed by CDT. - */ - public void dispose(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIEventBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIEventBreakpoint.java deleted file mode 100644 index e831357ed05..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIEventBreakpoint.java +++ /dev/null @@ -1,31 +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 - * QNX Software Systems - catchpoints - bug 226689 - *******************************************************************************/ -package org.eclipse.cdt.debug.core.cdi.model; - -import org.eclipse.core.runtime.CoreException; - -public interface ICDIEventBreakpoint extends ICDIBreakpoint { - /** - * Get event breakpoint type. This is usually id in reverse web notation. - * @return event breakpoint type id - * @throws CoreException - */ - String getEventType() throws CoreException; - - /** - * Get extra event argument. For example name of the exception or number of a signal. - * @return event argument - * @throws CoreException - */ - String getExtraArgument() throws CoreException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExceptionpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExceptionpoint.java deleted file mode 100644 index 48fbe8a0ba1..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExceptionpoint.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.core.cdi.model; - -/** - * ICDIExceptionpoint - */ -public interface ICDIExceptionpoint extends ICDIBreakpoint { - - boolean isStopOnThrow(); - - boolean isStopOnCatch(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteMoveInstructionPointer.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteMoveInstructionPointer.java deleted file mode 100644 index 62eab84b782..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteMoveInstructionPointer.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Freescale Secmiconductor and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms 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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; - -/** - * Provides the ability to perform a jump without changing the run state of a thread or debug target. - * @since 6.0 - */ -public interface ICDIExecuteMoveInstructionPointer { - - /** - * Moves the instruction pointer to the specified location without changing the run state - * The result is undefined if it moves outside of the stackframe. - * Can only be called when the associated target is suspended. - * - * @param location - * @throws CDIException if this method fails. Reasons include: - */ - void moveInstructionPointer(ICDILocation location) throws CDIException; - - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteResume.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteResume.java deleted file mode 100644 index 5c8e131003d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteResume.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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 - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; - -/** - * Provides the ability to resume a thread or debug target. - * @since 6.0 - */ -public interface ICDIExecuteResume { - - /** - * Causes this target to resume its execution. - * if passSignal is <code>fase</code> and the target was - * suspended by a signal when resuming the signal will be discarded - * Has no effect on a target that is not suspended. - * - * @param passSignal whether to discar the signal - * @throws CDIException if this method fails. Reasons include: - */ - void resume(boolean passSignal) throws CDIException; - - /** - * Resume execution at location. Note the method does not change stackframe. - * The result is undefined if it jumps outside of the stacframe. - * Can only be called when the associated target is suspended. - * - * @param location - * @throws CDIException if this method fails. Reasons include: - */ - void resume(ICDILocation location) throws CDIException; - - /** - * Resume execution where the program stopped but immediately give the - * signal. - * - * @param signal - * @throws CDIException - */ - void resume(ICDISignal signal) throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteStep.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteStep.java deleted file mode 100644 index 42dd11db557..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteStep.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; - -/** - * Provides the ability to step into, over, and until - * from the current execution location. Implementations - * must be non-blocking. - */ -public interface ICDIExecuteStep { - - /** - * Steps over the current source line. - * if count <= 0 it is a noop. - * Can only be called when the associated target/thread is suspended. - * - * @param count as in `step', but do so count times. - * @throws CDIException if this method fails. Reasons include: - */ - void stepOver(int count) throws CDIException; - - /** - * Steps over the current machine instruction. Can only be called - * when the associated target/thread is suspended. - * if count <= 0 it is a noop. - * - * @param count as in `stepOverInstruction', but do so count times. - * @throws CDIException if this method fails. Reasons include: - */ - void stepOverInstruction(int count) throws CDIException; - - /** - * Steps into the current source line. Can only be called - * when the associated target/thread is suspended. - * if count <= 0 it is a noop. - * - * @param count as in `step', but do so count times. - * @throws CDIException if this method fails. Reasons include: - */ - void stepInto(int count) throws CDIException; - - /** - * Steps into the current machine instruction. Can only be called - * when the associated target/thread is suspended. - * if count <= 0 it is a noop. - * - * @throws CDIException if this method fails. Reasons include: - */ - void stepIntoInstruction(int count) throws CDIException; - - /** - * Continues running until location is reached. - * If the program will be suspended if attempt to exit the current frame. - * Can only be called when the associated target is suspended. - * - * @throws CDIException if this method fails. Reasons include: - */ - void stepUntil(ICDILocation location) throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteStepReturn.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteStepReturn.java deleted file mode 100644 index efd570f3e4a..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExecuteStepReturn.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * Provides the ability to step return from the frame. - * Implementations must be non-blocking. - */ -public interface ICDIExecuteStepReturn { - - /** - * Continue execution until the frame return. - * - * @throws CDIException if this method fails. Reasons include: - */ - void stepReturn() throws CDIException; - - /** - * Cancel execution of the frame and return with value. - * value can be <code>null</code>, if no return value is needed. - * Can only be called when the associated target/thread is suspended. - * - * @param value use as the returning value. - * @throws CDIException if this method fails. Reasons include: - */ - void stepReturn(ICDIValue value) throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpression.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpression.java deleted file mode 100644 index 333b1f3dc3f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpression.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * An expression is a snippet of code that can be evaluated to - * produce a value. - * - * @since Jul 9, 2002 - */ -public interface ICDIExpression extends ICDIObject { - - - /** - * Returns the expression snippet of code. - * - * @return the expression - */ - String getExpressionText(); - - /** - * Returns true if the variable Object are the same, - * For example event if the name is the same because of - * casting this may return false; - * @return true if the same - */ - boolean equals(ICDIExpression expr); - - /** - * Returns the value of this expression. - * - * @param ICDIStackFrame frame context - * @return the value of this expression - * @throws CDIException if this method fails. Reasons include: - */ - ICDIValue getValue(ICDIStackFrame context) throws CDIException; - - /** - * Remove the expression from the manager list. - * - * @param var - * @return ICDIArgument - * @throws CDIException - */ - void dispose() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpressionManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpressionManagement.java deleted file mode 100644 index 52af8a09507..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpressionManagement.java +++ /dev/null @@ -1,48 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * ICDIExpressionManagement - */ -public interface ICDIExpressionManagement { - - /** - * Create an expression for code snippet - * @param code - * @return ICDIExpression - * @throws CDIException - */ - ICDIExpression createExpression(String code) throws CDIException; - - /** - * Return all expressions for this target - * @return - * @throws CDIException - */ - ICDIExpression[] getExpressions() throws CDIException; - - /** - * Remove expressions for this target - * - * @param expressions - */ - void destroyExpressions(ICDIExpression[] expressions) throws CDIException; - - /** - * Remove all expressions on this target - * - */ - void destroyAllExpressions() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java deleted file mode 100644 index 640ea3806c4..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java +++ /dev/null @@ -1,21 +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.core.cdi.model; - -/** - * - * Represents a function breakpoint. - * - */ -public interface ICDIFunctionBreakpoint extends ICDILocationBreakpoint { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIGlobalVariable.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIGlobalVariable.java deleted file mode 100644 index 00034ecd3f3..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIGlobalVariable.java +++ /dev/null @@ -1,19 +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.core.cdi.model; - -/** - * ICDIGlobalVariable - */ -public interface ICDIGlobalVariable extends ICDIVariable, ICDIGlobalVariableDescriptor { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIGlobalVariableDescriptor.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIGlobalVariableDescriptor.java deleted file mode 100644 index d29aa483107..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIGlobalVariableDescriptor.java +++ /dev/null @@ -1,19 +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.core.cdi.model; - -/** - * ICDIGlobalVariableDescriptor - */ -public interface ICDIGlobalVariableDescriptor extends ICDIVariableDescriptor { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.java deleted file mode 100644 index c9fef552d22..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.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.core.cdi.model; - -import java.math.BigInteger; - - -/** - * - * Represents a machine instruction. - * - * @since Jul 10, 2002 - */ -public interface ICDIInstruction extends ICDIObject { - /** - * Returns the Address. - * @return the address. - */ - BigInteger getAdress(); - - /** - * @return the function name. - */ - String getFuntionName(); - - /** - * @return the instruction. - */ - String getInstruction(); - - /** - * @return the opcode - */ - String getOpcode(); - - /** - * @return any arguments to the opcode - */ - String getArgs(); - - /** - * @return the offset of this machine instruction - * Returns the instruction's offset. - * - * @return the offset of this machine instruction - */ - long getOffset(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java deleted file mode 100644 index 334bf13e64c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java +++ /dev/null @@ -1,20 +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.core.cdi.model; - -/** - * - * Represents a line breakpoint. - * - */ -public interface ICDILineBreakpoint extends ICDILocationBreakpoint { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocalVariable.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocalVariable.java deleted file mode 100644 index 70effa0a9d1..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocalVariable.java +++ /dev/null @@ -1,19 +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.core.cdi.model; - -/** - * ICDILocalVariable - */ -public interface ICDILocalVariable extends ICDIVariable, ICDILocalVariableDescriptor { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocalVariableDescriptor.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocalVariableDescriptor.java deleted file mode 100644 index 4874096c80c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocalVariableDescriptor.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * ICDILocalVariableDescriptor - */ -public interface ICDILocalVariableDescriptor extends ICDIVariableDescriptor { - - /** - * Return the stackframe. - * - * @return ICDIStackFrame - * @throws CDIException - */ - ICDIStackFrame getStackFrame() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java deleted file mode 100644 index 18b50bc132c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java +++ /dev/null @@ -1,28 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.ICDILocator; - -/** - * - * Abstract class returning location of breakpoint: file, line, function, address. - * - */ -public interface ICDILocationBreakpoint extends ICDIBreakpoint { - - /** - * Returns the location of the breakpoint. - * @return ICDILocator - */ - ICDILocator getLocator(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java deleted file mode 100644 index 90f992de6c5..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java +++ /dev/null @@ -1,125 +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.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * A contiguous segment of memory in an execution context. A memory - * block is represented by a starting memory address and a length. - * - * @since Jul 18, 2002 - */ -public interface ICDIMemoryBlock extends ICDIObject { - - /** - * Bit mask used to indicate a byte is read-only. - */ - public static final byte READ_ONLY = 0x01; - - /** - * Bit mask used to indicate a byte is valid. - */ - public static final byte VALID = 0x02; - - /** - * Returns the start address of this memory block. - * - * @return the start address of this memory block - */ - BigInteger getStartAddress(); - - /** - * Returns the length of this memory block in bytes. - * - * @return the length of this memory block in bytes - */ - long getLength(); - - /** - * This method is a misnomer. It should be getAddressableSize. This is how - * CDT finds out from the CDI client the addressable size of the - * memory--i.e., how many bytes per address. Some embedded systems have - * memory with addressable sizes >1. Such backends should make sure to - * ignore the now deprecated wordSize parameter of - * ICDIMemoryBlockManagement.createMemory block() and not regurgitate that - * value in the implementation of this method. - * - * @return The addressable size of the memory - */ - int getWordSize(); - - /** - * Returns the values of the bytes currently contained - * in this this memory block. - * Note: the number maybe greater or lower to what - * was requested. - * @return the values of the bytes currently contained - * in this this memory block - * @exception CDIException if this method fails. Reasons include: - * <ul><li>Failure communicating with the debug target. The CDIException's - * status code contains the underlying exception responsible for - * the failure.</li> - * </ul> - */ - byte[] getBytes() throws CDIException; - - /** - * Returns this memory byte's attribute as a bit mask. - * The method throw IndexOutOfBoundsException if the offset - * is out of range of the block. - * - * @return this memory byte's attribute as a bit mask - */ - public byte getFlags(int offset); - - /** - * Sets the value of the bytes in this memory block at the specified - * offset within this memory block to the spcified bytes. - * The offset is zero based. - * - * @param offset the offset at which to set the new values - * @param bytes the new values - * @exception CDIException if this method fails. Reasons include: - * <ul><li>Failure communicating with the debug target. The CDIException's - * status code contains the underlying exception responsible for - * the failure.</li> - * <li>This memory block does not support value modification</li> - * <li>The specified offset is greater than or equal to the length - * of this memory block, or the number of bytes specified goes - * beyond the end of this memory block (index of out of range)</li> - * </ul> - */ - void setValue(long offset, byte[] bytes) throws CDIException; - - /** - * @return true if the block does not update. - */ - boolean isFrozen(); - - /** - * A memoryBlock set frozen means that the block will - * not update and check for new data. - * @param frozen the block is frozen by default. - */ - void setFrozen(boolean frozen); - - /** - * Refresh the data, this may cause events to be trigger - * if the data values changed. - */ - void refresh() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlockManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlockManagement.java deleted file mode 100644 index a419efce877..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlockManagement.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * The memory manager manages the collection of memory blocks - * specified for the debug session. - * - * ICDIMemoryBlockManagement - * - */ -public interface ICDIMemoryBlockManagement { - - /** - * Returns a memory block specified by given identifier. - * @param address - * @param units - number of bytes - * @param wordSize - this parameter has been deprecated in 4.0 - * and will always be passed as the value 1. If the memory - * has an addressable size (number of bytes per address) - * greather than 1, the CDI client should take care not to - * return the value of wordSize we pass in here, but rather - * return the actual addressable size for that memory. - * @return a memory block with the specified identifier - * @throws CDIException on failure. Reasons include: - */ - ICDIMemoryBlock createMemoryBlock(String address, int units, int wordSize) - throws CDIException; - - /** - * Removes the given array of memory blocks from the debug session. - * - * @param memoryBlock - the array of memory blocks to be removed - * @exception CDIException on failure. Reasons include: - */ - void removeBlocks(ICDIMemoryBlock[] memoryBlocks) throws CDIException; - - /** - * Removes all memory blocks from the debug session. - * - * @exception CDIException on failure. Reasons include: - */ - void removeAllBlocks() throws CDIException; - - /** - * Returns an array of all memory blocks set for this debug session. - * - * @return an array of all memory blocks set for this debug session - * @throws CDIException on failure. Reasons include: - */ - ICDIMemoryBlock[] getMemoryBlocks() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlockManagement2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlockManagement2.java deleted file mode 100644 index 125a19f8601..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlockManagement2.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Freescale, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms 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, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * Extension of ICDIMemoryBlockManagement - * - * @since May 26, 2006 - */ -public interface ICDIMemoryBlockManagement2 extends ICDIMemoryBlockManagement { - - /** - * Returns a memory block specified by given parameters. Differs - * from {@link ICDIMemoryBlockManagement#createMemoryBlock(String, int, int)} - * in that this support memory spaces. - * @param address - * @param memorySpaceID - value is meaningful only to the backend - * @param size - number of bytes - * @return a memory block with the specified identifier - * @throws CDIException on failure. Reasons include: - */ - ICDIMemoryBlock createMemoryBlock(BigInteger address, String memorySpaceID, int size) - throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemorySpaceEncoder.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemorySpaceEncoder.java deleted file mode 100644 index f11d3beb930..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemorySpaceEncoder.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Freescale Semiconductor, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms 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, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * Add-on interface for objects that implement ICDIMemorySpaceManagement. - * Provides the string encoding and decoding of a memory space qualified - * address. CDT provides a default encoding of [memory-space-id]:[expression]. - * If this is adequate, the CDI client need not implement this interface. This - * method is called when having to represent a memory-space qualified address as - * a single string. - * - * @since 7.0 - */ -public interface ICDIMemorySpaceEncoder extends ICDIObject { - /** - * Encode an expression + memory space ID to a string. - * - * @param expression - * the expression representing a location within a memory space. - * This can be a simple numeric expression like "0x10000" or - * something more complex "$EAX+(gCustomerCount*100)". - * @param memorySpaceID - * a string which represents the memory space - * @return the encoded string representation of the address; never null - */ - String encodeAddress(String expression, String memorySpaceID); - - /** - * The inverse of {@link #encodeAddress(String, String)}. - * - * @param str - * the encoded string - * @return the result of decoding the string into its components; never null - * @throws CDIException - * if string is not in the expected format - */ - DecodeResult decodeAddress(String str) throws CDIException; - - interface DecodeResult { - String getMemorySpaceId(); - String getExpression(); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemorySpaceManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemorySpaceManagement.java deleted file mode 100644 index ca2224a6c2b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemorySpaceManagement.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2012 Freescale, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms 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, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * The memory space manager provides varous memory-space related operations. - * The backend implementation of ICDITarget should implement this interface - * as well if the target supports memory spaces. - */ -public interface ICDIMemorySpaceManagement extends ICDIObject { - /** - * Optionally provides the string encoding of a memory space qualified - * address. CDT provides a default encoding of - * <memory-space-id>:<address(hex)>. If this is adequate, the client can - * return null from this function. - * - * @param address - * a numeric address - * @param memorySpaceID - * a string which represents the memory space - * @return the encoded string representation of the address or null - * @deprecated CDI clients should implement ICDIMemorySpaceEncoder - */ - @Deprecated - String addressToString(BigInteger address, String memorySpaceID); - - /** - * The inverse of addressToString. Optionally decodes a memoryspace/address - * string to its components. Client must provide decoding if it provides - * encoding in addressToString. Conversely, it should return null if - * addressToString returns null. - * - * @param str - * the encoded string (contains memory space + hex address - * value) - * @param memorySpaceID_out - * the memory space ID - * @return the BigInteger part of str; client should return null if the - * default decoding provided by CDT is sufficient - * (<memory-space-id>:<address(hex)>) - * @throws CDIException - * if string is not in the expected format - * @deprecated CDI clients should implement ICDIMemorySpaceEncoder - */ - @Deprecated - BigInteger stringToAddress(String str, StringBuffer memorySpaceID_out) throws CDIException; - - /** - * Provides the memory spaces available. - * - * @return an array of memory space identifiers - */ - String [] getMemorySpaces(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMixedInstruction.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMixedInstruction.java deleted file mode 100644 index a9715eb2ff8..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMixedInstruction.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.core.cdi.model; - -/** - * - * Represents a machine instruction. - * - * @since Jul 10, 2002 - */ -public interface ICDIMixedInstruction extends ICDIObject { - /** - * @return the line Number. - */ - int getLineNumber(); - - /** - * @return the file name - */ - String getFileName(); - - /** - * @return the array of instruction. - */ - ICDIInstruction[] getInstructions(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIObject.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIObject.java deleted file mode 100644 index 096df69d3cb..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIObject.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.core.cdi.model; - -/** - * - * Represents an object in the CDI model. - * - * @since Jul 8, 2002 - */ -public interface ICDIObject { - /** - * Returns the target this object is contained in. - * - * @return the target this object is contained in - */ - ICDITarget getTarget(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegister.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegister.java deleted file mode 100644 index b10055ba5a8..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegister.java +++ /dev/null @@ -1,69 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * A register is a special kind of variable that is contained - * in a register group. Each register has a name and a value. - * - * @since Jul 9, 2002 - */ -public interface ICDIRegister extends ICDIRegisterDescriptor { - /** - * Returns true if the value of this variable could be changed. - * - * @return true if the value of this variable could be changed - * @throws CDIException if this method fails. Reasons include: - */ - boolean isEditable() throws CDIException; - - /** - * Returns the value of this variable. - * - * @param context - * @return the value of this variable - * @throws CDIException if this method fails. Reasons include: - */ - ICDIValue getValue(ICDIStackFrame context) throws CDIException; - - /** - * Attempts to set the value of this variable to the value of - * the given expression. - * - * @param expression - an expression to generate a new value - * @throws CDIException if this method fails. Reasons include: - */ - void setValue(String expression) throws CDIException; - - /** - * Sets the value of this variable to the given value. - * - * @param value - a new value - * @throws CDIException if this method fails. Reasons include: - */ - void setValue(ICDIValue value) throws CDIException; - - /** - * Remove the variable from the manager list. - * - * @param var - * @return ICDIArgument - * @throws CDIException - */ - void dispose() throws CDIException; - - boolean equals(ICDIRegister reg); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegisterDescriptor.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegisterDescriptor.java deleted file mode 100644 index 55e5ee7f4a2..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegisterDescriptor.java +++ /dev/null @@ -1,21 +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.core.cdi.model; - - -/** - * - * Represents a break condition. - * - * @since Jul 9, 2002 - */ -public interface ICDIRegisterDescriptor extends ICDIVariableDescriptor { -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegisterGroup.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegisterGroup.java deleted file mode 100644 index eaad77dd423..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRegisterGroup.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * Represents a group of registers that are assigned to a target. - * - * @since Jul 9, 2002 - */ -public interface ICDIRegisterGroup extends ICDIObject { - - /** - * The name of the group. - * - * @return String name - */ - String getName(); - - /** - * Returns the register descriptors in this register group. - * - * @return ICDIRegisterDescriptor[] in this register group - * @throws CDIException if this method fails. Reasons include: - */ - ICDIRegisterDescriptor[] getRegisterDescriptors() throws CDIException; - - /** - * Returns whether this register group currently contains any registers. - * - * @return whether this register group currently contains any registers - * @exception CDIException if this method fails. Reasons include: - */ - public boolean hasRegisters() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRuntimeOptions.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRuntimeOptions.java deleted file mode 100644 index 489af8f64cc..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIRuntimeOptions.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.core.cdi.model; - -import java.util.Properties; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * Describes the configuration of debug session. - * - * @since Aug 6, 2002 - */ -public interface ICDIRuntimeOptions extends ICDIObject { - - /** - * Program/Inferior arguments. - * - * @param args the string representing the arguments. - */ - void setArguments(String[] args) throws CDIException; - - /** - * Program/Inferior environment settings. - * - * @param props the new environment variable to add. - */ - void setEnvironment(Properties props) throws CDIException; - - /** - * Program/Inferior working directory. - * - * @param wd the working directory to start the program. - */ - void setWorkingDirectory(String wd) throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java deleted file mode 100644 index 24eb41c946c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java +++ /dev/null @@ -1,59 +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.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * Represents a shared library which has been loaded into - * the debug target. - * - * @since Jul 8, 2002 - */ -public interface ICDISharedLibrary extends ICDIObject { - /** - * Returns the name of shared library file. - * - * @return the name of shared library file - */ - String getFileName(); - - /** - * Returns the start address of this library. - * - * @return the start address of this library - */ - BigInteger getStartAddress(); - - /** - * Returns the end address of this library. - * - * @return the end address of this library - */ - BigInteger getEndAddress(); - - /** - * Returns whether the symbols of this library are read. - * - * @return whether the symbols of this library are read - */ - boolean areSymbolsLoaded(); - - /** - * Loads the library symbols. - * - * @throws CDIException if this method fails. Reasons include: - */ - void loadSymbols() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibraryManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibraryManagement.java deleted file mode 100644 index 566812e079b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibraryManagement.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * Manages the sharedLibraries in the target. - */ -public interface ICDISharedLibraryManagement { - - /** - * Returns the array of shared libraries for this target. - * - * @return ICDISharedLibrary[] array - * @throws CDIException on failure. - */ - ICDISharedLibrary[] getSharedLibraries() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISignal.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISignal.java deleted file mode 100644 index 166acbb141d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISignal.java +++ /dev/null @@ -1,69 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * Represents a signal. - * - * @since Jul 10, 2002 - */ -public interface ICDISignal extends ICDIObject { - - /** - * Returns the name of this signal. - * - * @return the name of this signal - */ - String getName(); - - /** - * Returns the meaning of this signal. - * - * @return the meaning of this signal - */ - String getDescription(); - - /** - * if false means program will see the signal. - * Otherwise program does not know. - * - * @return boolean - */ - boolean isIgnore(); - - /** - * Means reenter debugger if this signal happens - * - * Method isStopSet. - * @return boolean - */ - boolean isStopSet(); - - /** - * Continue program giving it this signal. - * - * @throws CDIException if this method fails. Reasons include: - */ - void signal() throws CDIException ; - - /** - * Change the way debugger handles this signal. - * - * @param ignore - if true the debugger should not allow your program to see this signal - * @param stop - if true the debugger should stop your program when this signal happens - * @throws CDIException if this method fails. Reasons include: - */ - void handle(boolean ignore, boolean stop) throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISignalManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISignalManagement.java deleted file mode 100644 index 40378ab1e75..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISignalManagement.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - */ -public interface ICDISignalManagement { - - /** - * Returns the array of signals defined for this target. - * - * @return the array of signals - * @throws CDIException on failure. Reasons include: - */ - ICDISignal[] getSignals() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISourceManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISourceManagement.java deleted file mode 100644 index e0bd5778f4d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISourceManagement.java +++ /dev/null @@ -1,93 +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.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * Maintains the list of directories to search for source files. - * Auto update is off by default. - * - */ -public interface ICDISourceManagement { - /** - * Set the source search paths for the debug session. - * @param String array of search paths - */ - void setSourcePaths(String[] srcPaths) throws CDIException; - - /** - * Return the array of source paths - * @return String array of search paths. - */ - String[] getSourcePaths() throws CDIException; - - /** - * @param startAddress is the begining address - * @param endAddress is the end address - * @throws CDIException on failure. - */ - ICDIInstruction[] getInstructions(BigInteger startAddress, BigInteger endAddress) - throws CDIException; - - /** - * @param filename is the name of the file to disassemble - * @param linenum is the line number to disassemble around - * @throws CDIException on failure - */ - ICDIInstruction[] getInstructions(String filename, int linenum) - throws CDIException; - - /** - * @param filename is the name of the file to disassemble - * @param linenum is the line number to disassemble around - * @param lines is the number of disassembly to produced - * @throws CDIException on failure - */ - ICDIInstruction[] getInstructions(String filename, int linenum, int lines) - throws CDIException; - - /** - * @param startAddress is the begining address - * @param endAddress is the end address - * @throws CDIException on failure. - */ - ICDIMixedInstruction[] getMixedInstructions( - BigInteger startAddress, - BigInteger endAddress) - throws CDIException; - - /** - * @param filename is the name of the file to disassemble - * @param linenum is the line number to disassemble around - * @param lines is the number of disassembly to produced - * @throws CDIException on failure - */ - ICDIMixedInstruction[] getMixedInstructions(String filename, int linenum) - throws CDIException; - - /** - * @param filename is the name of the file to disassemble - * @param linenum is the line number to disassemble around - * @param lines is the number of disassembly to produced - * @throws CDIException on failure - */ - ICDIMixedInstruction[] getMixedInstructions( - String filename, - int linenum, - int lines) - throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java deleted file mode 100644 index ddde8e1bcd8..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java +++ /dev/null @@ -1,93 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; - -/** - * - * A stack frame in a suspended thread. - * A stack frame contains variables representing visible locals and - * arguments at the current execution location. - * - * @since Jul 8, 2002 - */ -public interface ICDIStackFrame extends ICDIExecuteStepReturn, ICDIObject { - - /** - * Returns the location of the instruction pointer in this - * stack frame. - * - * @return the location of the instruction pointer - */ - ICDILocator getLocator(); - - /** - * Returns the visible variables in this stack frame. An empty - * collection is returned if there are no visible variables. - * - * @return a collection of visible variables - * @throws CDIException if this method fails. Reasons include: - */ - ICDILocalVariableDescriptor[] getLocalVariableDescriptors() throws CDIException; - - /** - * Create a variable from the descriptor for evaluation. A CreatedEvent will be trigger and - * ChangedEvent will also be trigger when the variable is assign a new value. - * DestroyedEvent is fired when the variable is out of scope and automatically - * removed from the manager list. - * @param varDesc ICDThreadStorageDesc - * @return - * @throws CDIException - */ - ICDIArgument createArgument(ICDIArgumentDescriptor varDesc) throws CDIException; - - /** - * Create a variable from the descriptor for evaluation. A CreatedEvent will be trigger and - * ChangedEvent will also be trigger when the variable is assign a new value. - * DestroyedEvent is fired when the variable is out of scope and automatically - * removed from the manager list. - * @param varDesc ICDThreadStorageDesc - * @return - * @throws CDIException - */ - ICDILocalVariable createLocalVariable(ICDILocalVariableDescriptor varDesc) throws CDIException; - - /** - * Returns the arguments in this stack frame. An empty collection - * is returned if there are no arguments. - * - * @return a collection of arguments - * @throws CDIException if this method fails. Reasons include: - */ - ICDIArgumentDescriptor[] getArgumentDescriptors() throws CDIException; - - /** - * Returns the thread this stackframe is contained in. - * - * @return the thread - */ - ICDIThread getThread(); - - /** - * Returns the level of the stack frame, 1 based. - * - * @return the level of the stack frame - */ - int getLevel(); - - /** - * Return true if the frames are the same. - */ - boolean equals(ICDIStackFrame stackframe); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISuspend.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISuspend.java deleted file mode 100644 index 24929f48972..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISuspend.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * Provides the ability to suspend a thread or debug target. -*/ -public interface ICDISuspend { - - /** - * Causes this target/thread to suspend its execution. - * Has no effect on an already suspended thread. - * - * @throws CDIException if this method fails. Reasons include: - */ - void suspend() throws CDIException; - - /** - * Returns whether this target/thread is currently suspended. - * - * @return whether this target/thread is currently suspended - */ - boolean isSuspended(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java deleted file mode 100644 index 0a083965fe7..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java +++ /dev/null @@ -1,273 +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.core.cdi.model; - -import java.math.BigInteger; - -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.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; - -/** - * - * Represents a debuggable process. This is a root object of the CDI - * model. - * - * @since Jul 8, 2002 - */ -public interface ICDITarget extends ICDIThreadGroup, ICDIExpressionManagement, - ICDISourceManagement, ICDISharedLibraryManagement, ICDIMemoryBlockManagement, ICDISessionObject { - - /** - * Gets the target process. - * - * @return the output stream connected to the normal input of the - * target process. - */ - Process getProcess(); - - /** - * Returns the configuration description of this debug session. - * - * @return the configuration description - */ - ICDITargetConfiguration getConfiguration(); - - /** - * Evaluates the expression specified by the given string. - * Returns the evaluation result as a String. - * - * @param - expression string to be evaluated - * @return the result of the evaluation - * @throws CDIException if this method fails. Reasons include: - */ - String evaluateExpressionToString(ICDIStackFrame context, String expressionText) - throws CDIException; - - /** - * A static/global variable in a particular function or file, - * filename or/and function is the context for the static ICDIVariableDescriptor. - * <pre> - * hello.c: - * int bar; - * int main() { - * static int bar; - * } - * file.c: - * int foo() { - * static int bar; - * } - * getVariableObject(null, null, "bar"); - * getVariableObject(null, "main", "bar"); - * getVariableObject("file.c", "foo", "bar"); - * </pre> - * @param filename - * @param function - * @param name - * @return ICDIGlobalVariableDescriptor - * @throws CDIException - */ - ICDIGlobalVariableDescriptor getGlobalVariableDescriptors(String filename, String function, String name) throws CDIException; - - /** - * Create a variable from the descriptor for evaluation. A CreatedEvent will be trigger and - * ChangedEvent will also be trigger when the variable is assign a new value. - * DestroyedEvent is fired when the variable is out of scope and automatically - * removed from the manager list. - * - * @param varDesc ICDIGlobalVariableDescriptor - * @return ICDIGlobalVariable - * @throws CDIException - */ - ICDIGlobalVariable createGlobalVariable(ICDIGlobalVariableDescriptor varDesc) throws CDIException; - - /** - * Return the register groups. - * - * @return ICDIRegisterGroup[] - */ - ICDIRegisterGroup[] getRegisterGroups() throws CDIException; - - /** - * Create a variable from the descriptor for evaluation. A CreatedEvent will be trigger and - * ChangedEvent will also be trigger when the variable is assign a new value. - * DestroyedEvent is fired when the variable is out of scope and automatically - * removed from the manager list. - * @param varDesc ICDThreadStorageDesc - * @return - * @throws CDIException - */ - ICDIRegister createRegister(ICDIRegisterDescriptor varDesc) throws CDIException; - - /** - * Returns whether this target is terminated. - * - * @return whether this target is terminated - */ - boolean isTerminated(); - - /** - * Causes this target to terminate. - * - * @throws CDIException if this method fails. Reasons include: - */ - void terminate() throws CDIException; - - /** - * Returns whether this target is disconnected. - * - * @return whether this target is disconnected - */ - boolean isDisconnected(); - - /** - * Disconnects this target from the debuggable process. Generally, - * disconnecting ends a debug session with this target, but allows - * the debuggable program to continue running. - * - * @throws CDIException if this method fails. Reasons include: - */ - void disconnect() throws CDIException; - - /** - * Restarts the execution of this target. - * - * @throws CDIException if this method fails. Reasons include: - */ - void restart() throws CDIException; - - /** - * Equivalent to resume(false) - * - * @deprecated - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void resume() throws CDIException; - - /** - * Equivalent to stepOver(1) - * - * @deprecated - * @see #stepOver(int) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepOver() throws CDIException; - - /** - * Equivalent to stepInto(1) - * - * @deprecated - * @see #stepInto(int) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepInto() throws CDIException; - - /** - * Equivalent to stepOverInstruction(1) - * - * @deprecated - * @see stepOverInstruction(int) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepOverInstruction() throws CDIException; - - /** - * Equivalent to stepIntoInstruction(1) - * - * @deprecated - * @see #stepIntoInstruction(int) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepIntoInstruction() throws CDIException; - - /** - * Equivaltent to stepUntil(location) - * - * @deprecated - * @see #stepUntil(ICDILocation) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void runUntil(ICDILocation location) throws CDIException; - - /** - * Equivalent to resume(location - * - * @deprecated - * @see #resume(ICDLocation) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void jump(ICDILocation location) throws CDIException; - - /** - * Equivalent to resume(false) - * - * @deprecated - * @throws CDIException - */ - @Deprecated - void signal() throws CDIException; - - /** - * Equivalent to resume(signal) - * - * @deprecated - * @see #resume(ICDISignal) - * @param signal - * @throws CDIException - */ - @Deprecated - void signal(ICDISignal signal) throws CDIException; - - /** - * Returns the Runtime options for this target debug session. - * - * @return the configuration description - */ - ICDIRuntimeOptions getRuntimeOptions(); - - /** - * Return a ICDICondition - */ - ICDICondition createCondition(int ignoreCount, String expression); - - /** - * Return a ICDICondition - */ - ICDICondition createCondition(int ignoreCount, String expression, String[] threadIds); - - /** - * Returns a ICDILineLocation - */ - ICDILineLocation createLineLocation(String file, int line); - - /** - * Returns a ICDIFunctionLocation - */ - ICDIFunctionLocation createFunctionLocation(String file, String function); - - /** - * Returns a ICDIAddressLocation - */ - ICDIAddressLocation createAddressLocation(BigInteger address); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget2.java deleted file mode 100644 index b970e07cd53..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget2.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.cdi.model; - - -public interface ICDITarget2 extends ICDITarget { - - - /** Returns a list of global variables for the targeted process - * @return list of globals for the targeted process - */ - ICDIGlobalVariableDescriptor[] getGlobalVariables(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration.java deleted file mode 100644 index 81e2a7b031a..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration.java +++ /dev/null @@ -1,118 +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.core.cdi.model; - -/** - * Describes the configuration of the target. - * - */ -public interface ICDITargetConfiguration extends ICDIObject { - - /** - * Returns whether this target supports termination. - * - * @return whether this target supports termination - */ - boolean supportsTerminate(); - - /** - * Returns whether this target supports disconnecting. - * - * @return whether this target supports disconnecting - */ - boolean supportsDisconnect(); - - /** - * Returns whether this target supports suspend. - * - * @return whether this target supports suspend. - */ - boolean supportsSuspend(); - - /** - * Returns whether this target supports Resume. - * - * @return whether this target supports Resume. - */ - boolean supportsResume(); - - /** - * Returns whether this target supports restarting. - * - * @return whether this target supports restarting - */ - boolean supportsRestart(); - - /** - * Returns whether this target supports stepping. - * - * @return whether this target supports stepping - */ - boolean supportsStepping(); - - /** - * Returns whether this target supports instruction stepping. - * - * @return whether this target supports instruction stepping - */ - boolean supportsInstructionStepping(); - - /** - * Returns whether this target supports breakpoints. - * - * @return whether this target supports breakpoints - */ - boolean supportsBreakpoints(); - - /** - * Returns whether this target supports registers. - * - * @return whether this target supports registers - */ - boolean supportsRegisters(); - - /** - * Returns whether this target supports register modification. - * - * @return whether this target supports registers modification - */ - boolean supportsRegisterModification(); - - /** - * Returns whether this target supports shared library. - * - * @return whether this target supports registers modification - */ - boolean supportsSharedLibrary(); - - /** - * Returns whether this target supports memory retrieval. - * - * @return whether this target supports memory retrieval - */ - boolean supportsMemoryRetrieval(); - - /** - * Returns whether this target supports memory modification. - * - * @return whether this target supports memory modification - */ - boolean supportsMemoryModification(); - - /** - * Returns whether this target supports expression evaluation. - * - * @return whether this target supports expression evaluation - */ - boolean supportsExpressionEvaluation(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java deleted file mode 100644 index 7fcae298022..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.cdi.model; - -public interface ICDITargetConfiguration2 extends ICDITargetConfiguration { - - /** - * Returns whether this target supports thread control, namely whether it - * supports suspending/resuming threads individually. - * - * @return whether this target supports thread control, namely whether it - * supports suspending/resuming threads individually. - */ - boolean supportsThreadControl(); - - /** - * Returns whether this target supports passive variable updating. If so - * targets will not be actively sending variable value change notification - * when a thread is suspended but will wait until they are asked to - * redisplay the value. Passive variable updating lets a CDI plugin avoid - * maintaining its own variable cache and having to keep it in sync with - * CDT's. Targets that support this feature will need to be able to detect - * when a variable value has changed and fire a changedEvent in its - * implementation of ICDIValue.getValueString(). - * - * Also, targets that support this feature will not have their variables - * disposed when the user disables them in the GUI. Such a dispose only - * serves to reduce step-time overhead in the debugger engine. As such - * overhead is negligible for engines with passive variables, the dispose - * is unnecessary. - * - * @return whether this target supports passive variable updating. - */ - boolean supportsPassiveVariableUpdate(); - - /** - * Returns whether this target supports runtime type indentification. - * If so this means the type of a variable may change when its value changes. - * - * @return whether this target supports runtime type indentification. - * If so this means the type of a variable may change when its value changes. - */ - boolean supportsRuntimeTypeIdentification(); - - /** - * Returns whether this target supports having address breakpoints - * enabled when a debug session starts. - * If so this means address breaks will not be disabled on startup. - * - * @return whether this target supports having address breakpoints - * enabled when a debug session starts. - * If so this means address breaks will not be disabled on startup. - */ - boolean supportsAddressBreaksOnStartup(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration3.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration3.java deleted file mode 100644 index 8bc524ea2e7..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration3.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; - -public interface ICDITargetConfiguration3 extends ICDITargetConfiguration2 { - - /** - * It may be desirable to update all variables when a certain event occurs. - * For example, some CDI clients may want all variabless updated when memory - * is changed (when an ICDIMemoryChangedEvent is received) because it's - * impractical or impossible for those backends to determine what specific - * variables the memory change affected. - * - * CDT will call this method to determine desired behavior for a limited set - * of event types. The CDI backend should not expect to use this hook as a - * general control mechanism for when variables are updated. - * - * @return Whether the value for all active variables should be invalidated - * and re-fetched from the CDI backend on the occurence of the given - * event - */ - boolean needsVariablesUpdated(ICDIEvent event); - - /** - * Same idea as needsRegistersUpdated() but for registers. Embedded systems - * often have memory mapped registers; changing bytes in memory might, in - * effect, change a register value - * - * @return Whether the value for all active registers should be invalidated - * and re-fetched from the CDI backend on the occurence of the given - * event - */ - boolean needsRegistersUpdated(ICDIEvent event); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java deleted file mode 100644 index f9c11d1e73e..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java +++ /dev/null @@ -1,179 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; - -/** - * - * A thread in a debug target. - * A thread contains stack frames. Stack frames are only available - * when the thread is suspended, and are returned in top-down order. - * - * @since Jul 8, 2002 - */ -public interface ICDIThread extends ICDIExecuteStep, ICDIExecuteResume, ICDISuspend, ICDIObject { - - /** - * Returns the stack frames contained in this thread. An - * empty collection is returned if this thread contains - * no stack frames, or is not currently suspended. Stack frames - * are returned in top down order. - * - * @return a collection of stack frames - * @throws CDIException if this method fails. Reasons include: - */ - ICDIStackFrame[] getStackFrames() throws CDIException; - - /** - * Returns the stack frames contained in this thread whose levels - * are between the two arguments(inclusive). - * An empty collection is returned if this thread contains - * no stack frames, or is not currently suspended. Stack frames - * are returned in top down order. - * - * @return a collection of stack frames - * @throws CDIException if this method fails. Reasons include: - */ - ICDIStackFrame[] getStackFrames(int lowFrame, int highFrame) throws CDIException; - - /** - * Returns the depth of the stack frames. - * - * @return depth of stack frames - * @throws CDIException if this method fails. Reasons include: - */ - int getStackFrameCount() throws CDIException; - - /** - * Return thread local storage variables descriptor. - * - * @return - * @throws CDIException - */ - ICDIThreadStorageDescriptor[] getThreadStorageDescriptors() throws CDIException; - - /** - * Create a variable from the descriptor for evaluation. A CreatedEvent will be trigger and - * ChangedEvent will also be trigger when the variable is assign a new value. - * DestroyedEvent is fired when the variable is out of scope and automatically - * removed from the manager list. - * @param varDesc ICDThreadStorageDesc - * @return - * @throws CDIException - */ - ICDIThreadStorage createThreadStorage(ICDIThreadStorageDescriptor varDesc) throws CDIException; - - /** - * Equivalent to resume(false) - * - * @deprecated - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void resume() throws CDIException; - - /** - * Equivalent to stepOver(1) - * - * @deprecated - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepOver() throws CDIException; - - /** - * Equivalent to stepInto(1) - * - * @deprecated - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepInto() throws CDIException; - - /** - * Equivalent to stepOverInstruction(1) - * - * @deprecated - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepOverInstruction() throws CDIException; - - /** - * Equivalent to stepIntoInstruction(1) - * - * @deprecated - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void stepIntoInstruction() throws CDIException; - - /** - * This method is deprecated and will only be available - * on the stackframe - * - * @deprecated - * @see ICDIStackFrame.stepReturn() - * @throws CDIException - */ - @Deprecated - void stepReturn() throws CDIException; - - /** - * Equivalent to stepUntil(location) - * - * @deprecated - * @see #stepUntil(ICDILocation) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void runUntil(ICDILocation location) throws CDIException; - - /** - * Equivalent to resume(location) - * - * @deprecated - * @see #resume(ICDILocation) - * @throws CDIException if this method fails. Reasons include: - */ - @Deprecated - void jump(ICDILocation location) throws CDIException; - - /** - * Equivalent to resume(false) - * - * @deprecated - * @see #resume(boolean) - * @throws CDIException - */ - @Deprecated - void signal() throws CDIException; - - /** - * Equivalent to resume(signal) - * - * @deprecated - * @see #resume(ICDISignal) - * @param signal - * @throws CDIException - */ - @Deprecated - void signal(ICDISignal signal) throws CDIException; - - /** - * Returns true if the threads are the same. - */ - boolean equals(ICDIThread thead); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadGroup.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadGroup.java deleted file mode 100644 index caf42d862b8..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadGroup.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - */ -public interface ICDIThreadGroup extends ICDIBreakpointManagement, ICDIExecuteStep, ICDIExecuteResume, - ICDISuspend, ICDISignalManagement, ICDIObject { - - /** - * Returns the threads contained in this target. - * An empty collection is returned if this target contains no - * threads. - * - * @return a collection of threads - * @throws CDIException if this method fails. Reasons include: - */ - ICDIThread[] getThreads() throws CDIException; - - /** - * Returns the currently selected thread. - * - * @return the currently selected thread - * @throws CDIException if this method fails. Reasons include: - */ - ICDIThread getCurrentThread() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadStorage.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadStorage.java deleted file mode 100644 index f5840ee8a9f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadStorage.java +++ /dev/null @@ -1,19 +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.core.cdi.model; - -/** - * ICDIThreadStorage - */ -public interface ICDIThreadStorage extends ICDIVariable, ICDIThreadStorageDescriptor { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadStorageDescriptor.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadStorageDescriptor.java deleted file mode 100644 index df48cf8d3e9..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadStorageDescriptor.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * ICDIThreadStorageDescriptor - */ -public interface ICDIThreadStorageDescriptor extends ICDIVariableDescriptor { - - /** - * Return the thread. - * - * @return ICDIThread - * @throws CDIException - */ - ICDIThread getThread() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITracepoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITracepoint.java deleted file mode 100644 index bc201adf3d0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITracepoint.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; - -/** - * Defines a point in the program execution when the specified data to be collected. - * - * @since May 15, 2003 - */ -public interface ICDITracepoint extends ICDIObject { - - /** - * Represents an action to be taken when the tracepoint is hit. - * - * @since May 15, 2003 - */ - public interface IAction { - } - - /** - * Returns the location of this tracepoint. - * - * @return the location of this tracepoint - * @throws CDIException if this method fails. Reasons include: - */ - ICDILocation getLocation() throws CDIException; - - /** - * Returns whether this tracepoint is enabled. - * - * @return whether this tracepoint is enabled - * @throws CDIException if this method fails. Reasons include: - */ - boolean isEnabled() throws CDIException; - - /** - * Sets the enabled state of this tracepoint. This has no effect - * if the current enabled state is the same as specified by - * the enabled parameter. - * - * @param enabled - whether this tracepoint should be enabled - * @throws CDIException if this method fails. Reasons include: - */ - void setEnabled( boolean enabled ) throws CDIException; - - /** - * Returns the passcount of this tracepoint. - * - * @return the passcount of this tracepoint - * @throws CDIException if this method fails. Reasons include: - */ - int getPassCount() throws CDIException; - - /** - * Sets the passcount of this tracepoint. - * - * @param the passcount to set - * @throws CDIException if this method fails. Reasons include: - */ - void setPassCount( int passCount ) throws CDIException; - - /** - * Adds the given actions to the action list of thie tracepoint. - * - * @param actions to add - * @throws CDIException if this method fails. Reasons include: - */ - void addActions( ICDITracepoint.IAction[] actions ) throws CDIException; - - /** - * Removes the given actions from the action list of thie tracepoint. - * - * @param actions to remove - * @throws CDIException if this method fails. Reasons include: - */ - void removeActions( ICDITracepoint.IAction[] actions ) throws CDIException; - - /** - * Clears the action list of thie tracepoint. - * - * @throws CDIException if this method fails. Reasons include: - */ - void clearActions() throws CDIException; - - /** - * Returns the actions assigned to this tracepoint. - * - * @return the actions of this tracepoint - */ - ICDITracepoint.IAction[] getActions(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIValue.java deleted file mode 100644 index e674c327519..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIValue.java +++ /dev/null @@ -1,69 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; - -/** - * - * Represents the value of a variable. A value representing - * a complex data structure contains variables. - * - * @since Jul 9, 2002 - */ -public interface ICDIValue extends ICDIObject { - /** - * Returns a description of the type of data this value contains. - * - * @return the name of this value's data type - * @throws CDIException if this method fails. Reasons include: - */ - String getTypeName() throws CDIException; - - /** - * Return the type of this value. - * - * @return - * @throws CDIException - */ - ICDIType getType() throws CDIException; - - /** - * Returns this value as a <code>String</code>. - * - * @return a String representation of this value - * @throws CDIException if this method fails. Reasons include: - */ - String getValueString() throws CDIException; - - /** - * Return the number of children. - * @return int children count - */ - int getChildrenNumber() throws CDIException; - - /** - * @return true if value is a container like structure. - */ - boolean hasChildren() throws CDIException; - - /** - * Returns the variables in this value. An empty collection - * is returned if there are no variables. - * - * @return an array of variables - * @throws CDIException if this method fails. Reasons include: - */ - ICDIVariable[] getVariables() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIVariable.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIVariable.java deleted file mode 100644 index 19d99a120e5..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIVariable.java +++ /dev/null @@ -1,68 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * Represents a data structure in the program. Each variable has - * a value which may in turn contain more variables. - * - * @since Jul 9, 2002 - */ -public interface ICDIVariable extends ICDIVariableDescriptor { - - /** - * Returns true if the value of this variable could be changed. - * - * @return true if the value of this variable could be changed - * @throws CDIException if this method fails. Reasons include: - */ - boolean isEditable() throws CDIException; - - /** - * Returns the value of this variable. - * - * @return the value of this variable - * @throws CDIException if this method fails. Reasons include: - */ - ICDIValue getValue() throws CDIException; - - /** - * Attempts to set the value of this variable to the value of - * the given expression. - * - * @param expression - an expression to generate a new value - * @throws CDIException if this method fails. Reasons include: - */ - void setValue(String expression) throws CDIException; - - /** - * Sets the value of this variable to the given value. - * - * @param value - a new value - * @throws CDIException if this method fails. Reasons include: - */ - void setValue(ICDIValue value) throws CDIException; - - /** - * Remove the variable from the manager list. - * - * @param var - * @return ICDIArgument - * @throws CDIException - */ - void dispose() throws CDIException; - - boolean equals(ICDIVariable variable); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIVariableDescriptor.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIVariableDescriptor.java deleted file mode 100644 index 14e27da64fb..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIVariableDescriptor.java +++ /dev/null @@ -1,89 +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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; - - -/** - * - */ -public interface ICDIVariableDescriptor extends ICDIObject { - - /** - * Returns the name of this variable. - * - * @return String the name of this variable - */ - String getName(); - - /** - * Returns the type of this variable descriptor. - * - * @return the type of data this variable is declared - * @throws CDIException if this method fails. Reasons include: - */ - ICDIType getType() throws CDIException; - - /** - * Returns the type name of this variable descriptor. - * - * @return the type of data this variable is declared - * @throws CDIException if this method fails. Reasons include: - */ - String getTypeName() throws CDIException; - - /** - * Returns the size of this variable descriptor. - * - * @return the size of this variable - * @throws CDIException if this method fails. Reasons include: - */ - int sizeof() throws CDIException; - - /** - * Returns the qualified name of this variable. - * - * @return the qualified name of this variable - * @throws CDIException if this method fails. Reasons include: - */ - String getQualifiedName() throws CDIException; - - /** - * Consider the variable object as an Array of type and range[start, start + length - 1] - * @param stack - * @param name - * @return ICDIVariableDescriptor - * @throws CDIException - */ - ICDIVariableDescriptor getVariableDescriptorAsArray(int start, int length) throws CDIException; - - /** - * Consider the variable descritor as type. - * - * @param stack - * @param name - * @return ICDIVariableDescriptor - * @throws CDIException - */ - ICDIVariableDescriptor getVariableDescriptorAsType(String type) throws CDIException; - - /** - * Returns true if the variable Object are the same, - * For example event if the name is the same because of - * casting this may return false; - * @return true if the same - */ - boolean equals(ICDIVariableDescriptor varDesc); - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint.java deleted file mode 100644 index c974f19b7a1..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint.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.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * Represents a watchpoint. - * - * @since Jul 9, 2002 - */ -public interface ICDIWatchpoint extends ICDIBreakpoint { - final static public int WRITE = 0x1; - final static public int READ = 0x2; - - /** - * Returns whether this watchppoint is a write watchpoint. - * - * @return whether this watchppoint is a write watchpoint - */ - boolean isWriteType(); - - /** - * Returns whether this watchppoint is a read watchpoint. - * - * @return whether this watchppoint is a read watchpoint - */ - boolean isReadType(); - - /** - * Returns the watchpoint's expression. - * - * @return the expression of this watchpoint - * @throws CDIException if this method fails. Reasons include: - */ - String getWatchExpression() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint2.java deleted file mode 100644 index c3f9f946c48..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint2.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299 - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.cdi.model; - -import java.math.BigInteger; -import org.eclipse.cdt.debug.core.cdi.CDIException; - -/** - * - * Represents a watchpoint. - * - */ -public interface ICDIWatchpoint2 extends ICDIWatchpoint { - - /** - * Returns the memory space associated with this - * watchpoint's start address, or null if there is no memory space. - * - * @return the memory space Id associated with the address of - * this watchpoint - * @throws CDIException if this method fails. Reasons include: - */ - String getMemorySpace() throws CDIException; - - /** - * Returns the range for this watchpoint in addressable units. - * - * @return the range of the watchpoint. - * @throws CDIException if this method fails. Reasons include: - */ - BigInteger getRange() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIAggregateType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIAggregateType.java deleted file mode 100644 index b1b1342ceb1..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIAggregateType.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.core.cdi.model.type; - - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIAggregateType extends ICDIType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIAggregateValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIAggregateValue.java deleted file mode 100644 index b9fcceb141d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIAggregateValue.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.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; - - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIAggregateValue extends ICDIValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIArrayType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIArrayType.java deleted file mode 100644 index e39f50602a4..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIArrayType.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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIArrayType extends ICDIDerivedType { - - int getDimension(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIArrayValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIArrayValue.java deleted file mode 100644 index 285fcdd33f7..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIArrayValue.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.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; - - -/** - * - * Represents a value of a array type. - * - * @since April 15, 2003 - */ -public interface ICDIArrayValue extends ICDIDerivedValue { - ICDIVariable[] getVariables(int index, int length) throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBigIntegerValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBigIntegerValue.java deleted file mode 100644 index fdf28271e2f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBigIntegerValue.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since 6.0 - */ -public interface ICDIBigIntegerValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBoolType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBoolType.java deleted file mode 100644 index d592c2b326c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBoolType.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.core.cdi.model.type; - -/** - */ -public interface ICDIBoolType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBoolValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBoolValue.java deleted file mode 100644 index 5eda323adcd..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIBoolValue.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.core.cdi.model.type; - -/** - */ -public interface ICDIBoolValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDICharType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDICharType.java deleted file mode 100644 index 4e3433b308d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDICharType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDICharType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDICharValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDICharValue.java deleted file mode 100644 index ad568721f57..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDICharValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDICharValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDerivedType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDerivedType.java deleted file mode 100644 index f5c9b48e6d8..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDerivedType.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.core.cdi.model.type; - - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIDerivedType extends ICDIType { - - ICDIType getComponentType(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDerivedValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDerivedValue.java deleted file mode 100644 index 0c92d700326..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDerivedValue.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.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; - - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIDerivedValue extends ICDIValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDoubleType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDoubleType.java deleted file mode 100644 index b7572232c2e..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDoubleType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIDoubleType extends ICDIFloatingPointType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDoubleValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDoubleValue.java deleted file mode 100644 index e29d0376bb0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIDoubleValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDIDoubleValue extends ICDIFloatingPointValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIEnumType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIEnumType.java deleted file mode 100644 index 35a474025cf..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIEnumType.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.core.cdi.model.type; - -/** - */ -public interface ICDIEnumType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIEnumValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIEnumValue.java deleted file mode 100644 index d2f7dc277a1..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIEnumValue.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.core.cdi.model.type; - -/** - */ -public interface ICDIEnumValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatType.java deleted file mode 100644 index 2dfae757556..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIFloatType extends ICDIFloatingPointType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatValue.java deleted file mode 100644 index f1dd0be8b36..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDIFloatValue extends ICDIFloatingPointValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatingPointType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatingPointType.java deleted file mode 100644 index 9d4d10a03ac..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatingPointType.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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIFloatingPointType extends ICDIType { - - boolean isImaginary(); - - boolean isComplex(); - - boolean isLong(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatingPointValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatingPointValue.java deleted file mode 100644 index df29a34cf3d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFloatingPointValue.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.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDIFloatingPointValue extends ICDIValue { - - float floatValue() throws CDIException; - - double doubleValue() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFunctionType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFunctionType.java deleted file mode 100644 index 98f5401042d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFunctionType.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.core.cdi.model.type; - - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIFunctionType extends ICDIDerivedType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFunctionValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFunctionValue.java deleted file mode 100644 index a704d0970e0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIFunctionValue.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.core.cdi.model.type; - - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIFunctionValue extends ICDIDerivedValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntType.java deleted file mode 100644 index bd3d8adc710..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIIntType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntValue.java deleted file mode 100644 index 327e6b76f6b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDIIntValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralType.java deleted file mode 100644 index 4125bf84e5f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralType.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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIIntegralType extends ICDIType{ - - boolean isUnsigned(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralValue.java deleted file mode 100644 index dea2ddd68bb..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralValue.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.core.cdi.model.type; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDIIntegralValue extends ICDIValue { - - public BigInteger bigIntegerValue() throws CDIException; - - public long longValue() throws CDIException; - - public int intValue() throws CDIException; - - public short shortValue() throws CDIException; - - public int byteValue() throws CDIException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongLongType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongLongType.java deleted file mode 100644 index 06408a8413c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongLongType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDILongLongType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongLongValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongLongValue.java deleted file mode 100644 index dcaa0ec39c5..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongLongValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDILongLongValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongType.java deleted file mode 100644 index c5a772e261f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDILongType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongValue.java deleted file mode 100644 index 6837e23851a..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDILongValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDILongValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerType.java deleted file mode 100644 index 596f814155f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIPointerType extends ICDIDerivedType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.java deleted file mode 100644 index 9498aa724b7..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.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.core.cdi.model.type; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIPointerValue extends ICDIDerivedValue { - - BigInteger pointerValue() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceType.java deleted file mode 100644 index 274af9e2cda..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceType.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.core.cdi.model.type; - - -/** - */ -public interface ICDIReferenceType extends ICDIDerivedType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.java deleted file mode 100644 index 912006db06c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.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.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; - -/** - */ -public interface ICDIReferenceValue extends ICDIDerivedValue { - - /** - * Return the reference value. - * @return ICDIValue - * @throws CDIException - */ - ICDIValue referenceValue() throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIShortType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIShortType.java deleted file mode 100644 index 52b0e526d37..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIShortType.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIShortType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIShortValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIShortValue.java deleted file mode 100644 index 3d39f2961c5..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIShortValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the value of a variable. - * - * @since April 15, 2003 - */ -public interface ICDIShortValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIStructType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIStructType.java deleted file mode 100644 index 4262059e4bb..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIStructType.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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIStructType extends ICDIAggregateType { - - boolean isClass(); - - boolean isStruct(); - - boolean isUnion(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIStructValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIStructValue.java deleted file mode 100644 index ccdcf049372..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIStructValue.java +++ /dev/null @@ -1,23 +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.core.cdi.model.type; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIStructValue extends ICDIAggregateValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIType.java deleted file mode 100644 index ce0802603c3..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIType.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.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIType extends ICDIObject { - - /** - * Returns the name. - * - * @return the name of the data type - * @throws CDIException if this method fails. - */ - String getTypeName(); - - /** - * Returns a more desciptive name. - * @return - */ - String getDetailTypeName(); -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIVoidType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIVoidType.java deleted file mode 100644 index b3e49f346ea..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIVoidType.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.core.cdi.model.type; - - - -/** - * - * Represents the type of a variable. - * - * @since Apr 15, 2003 - */ -public interface ICDIVoidType extends ICDIType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIWCharType.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIWCharType.java deleted file mode 100644 index 4978b543d68..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIWCharType.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.core.cdi.model.type; - -/** - */ -public interface ICDIWCharType extends ICDIIntegralType { - -} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIWCharValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIWCharValue.java deleted file mode 100644 index 7873ce1c8fb..00000000000 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIWCharValue.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.core.cdi.model.type; - -/** - */ -public interface ICDIWCharValue extends ICDIIntegralValue { - -} diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml index a67ad4ae711..bbbb4c5a6a5 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.core/plugin.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin> - <extension-point id="CDebugger" name="%CDebugger.name" schema="schema/CDebugger.exsd"/> <extension-point id="BreakpointActionType" name="%BreakpointAction" schema="schema/BreakpointAction.exsd"/> <extension-point id="BreakpointExtension" name="%BreakpointAction" schema="schema/BreakpointExtension.exsd"/> <extension-point id="supportedSourceContainerTypes" name="%SupportedSourceContainerTypes.name" schema="schema/SupportedSourceContainerTypes.exsd"/> @@ -384,30 +383,6 @@ name="%containerName.programRelativePath"> </sourceContainerType> </extension> - - <extension - point="org.eclipse.core.runtime.adapters"> - <factory - class="org.eclipse.cdt.debug.core.breakpointactions.BreakpointActionAdapterFactory" - adaptableType="org.eclipse.cdt.debug.internal.core.model.CThread"> - <adapter - type="org.eclipse.cdt.debug.core.breakpointactions.ILogActionEnabler"> - </adapter> - <adapter - type="org.eclipse.cdt.debug.core.breakpointactions.IResumeActionEnabler"> - </adapter> - </factory> - - </extension> - <extension - point="org.eclipse.cdt.debug.core.BreakpointExtension"> - <breakpointExtension - class="org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpointFilterExtension" - debugModelId="org.eclipse.cdt.debug.core" - id="org.eclipse.cdt.debug.core.filter" - markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"> - </breakpointExtension> - </extension> <extension point="org.eclipse.cdt.debug.core.supportedSourceContainerTypes"> <sourceContainer diff --git a/debug/org.eclipse.cdt.debug.core/pom.xml b/debug/org.eclipse.cdt.debug.core/pom.xml index 0bbf1dbfe5f..9910c34947d 100644 --- a/debug/org.eclipse.cdt.debug.core/pom.xml +++ b/debug/org.eclipse.cdt.debug.core/pom.xml @@ -11,7 +11,7 @@ <relativePath>../../pom.xml</relativePath> </parent> - <version>7.8.0-SNAPSHOT</version> + <version>8.0.0-SNAPSHOT</version> <artifactId>org.eclipse.cdt.debug.core</artifactId> <packaging>eclipse-plugin</packaging> </project> diff --git a/debug/org.eclipse.cdt.debug.core/schema/CDebugger.exsd b/debug/org.eclipse.cdt.debug.core/schema/CDebugger.exsd deleted file mode 100644 index cdeb3f46ec4..00000000000 --- a/debug/org.eclipse.cdt.debug.core/schema/CDebugger.exsd +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.cdt.debug.core"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.cdt.debug.core" id="CDebugger" name="CDebugger"/> - </appInfo> - <documentation> - [Enter description of this extension point] - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="debugger" 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> - </annotation> - </attribute> - </complexType> - </element> - - <element name="debugger"> - <complexType> - <sequence> - <element ref="buildIdPattern" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="string" use="required"> - <annotation> - <documentation> - specifies the debugger's name - </documentation> - </annotation> - </attribute> - <attribute name="modes" type="string"> - <annotation> - <documentation> - specifies the comma separated list of debugging modes (run,core,attach). - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - specifies a fully qualified name of a Java class that implements &lt;code&gt;ICDIDebugger2&lt;/code&gt; - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn="org.eclipse.cdt.debug.core.ICDIDebugger2"/> - </appInfo> - </annotation> - </attribute> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - specifies a unique identifier for this debugger. - </documentation> - </annotation> - </attribute> - <attribute name="platform" type="string"> - <annotation> - <documentation> - specifies a comma separated list of supported platforms. - </documentation> - </annotation> - </attribute> - <attribute name="cpu" type="string"> - <annotation> - <documentation> - specifies a comma separated list of supported architectures. - </documentation> - </annotation> - </attribute> - <attribute name="coreFileFilter" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <element name="buildIdPattern"> - <complexType> - <attribute name="pattern" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </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.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java index 9d549066e8c..d9feb25195f 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java @@ -14,20 +14,11 @@ *******************************************************************************/ package org.eclipse.cdt.debug.core; -import java.io.IOException; import java.math.BigInteger; import java.util.HashMap; import java.util.Map; -import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable; -import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.model.CoreModelUtil; -import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint2; @@ -51,10 +42,7 @@ import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CLineDynamicPrintf; import org.eclipse.cdt.debug.internal.core.breakpoints.CLineTracepoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; @@ -64,14 +52,10 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IBreakpointManager; -import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.ILineBreakpoint; -import org.eclipse.debug.core.model.IProcess; /** * Provides utility methods for creating debug sessions, targets and breakpoints @@ -89,154 +73,6 @@ public class CDIDebugModel { } /** - * Creates and returns a debug target for the given CDI target, with the - * specified name, and associates it with the given process for console I/O. - * The debug target is added to the given launch. - * - * @param launch - * the launch the new debug target will be contained in - * @param project - * the project to use to persist breakpoints. - * @param cdiTarget - * the CDI target to create a debug target for - * @param name - * the name to associate with this target, which will be returned - * from <code>IDebugTarget.getName</code>. - * @param debuggeeProcess - * the process to associate with the debug target, which will be - * returned from <code>IDebugTarget.getProcess</code> - * @param file - * the executable to debug. - * @param allowTerminate - * allow terminate(). - * @param allowDisconnect - * allow disconnect(). - * @param stopSymbol - * place temporary breakpoint at <code>stopSymbol</code>, ignore - * if <code>null</code> or empty. - * @param resumeTarget - * resume target. - * @return a debug target - * @throws DebugException - * @since 3.1 - */ - public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget, - final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, - final boolean allowDisconnect, final String stopSymbol, final boolean resumeTarget) throws DebugException { - final IDebugTarget[] target = new IDebugTarget[1]; - IWorkspaceRunnable r = new IWorkspaceRunnable() { - - @Override - public void run(IProgressMonitor m) throws CoreException { - target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, - allowDisconnect); - ((CDebugTarget) target[0]).start(stopSymbol, resumeTarget); - } - }; - try { - ResourcesPlugin.getWorkspace().run(r, null); - } catch (CoreException e) { - CDebugCorePlugin.log(e); - throw new DebugException(e.getStatus()); - } - return target[0]; - } - - /** - * Creates and returns a debug target for the given CDI target, with the - * specified name, and associates it with the given process for console I/O. - * The debug target is added to the given launch. - * - * @param launch - * the launch the new debug target will be contained in - * @param project - * the project to use to persist breakpoints. - * @param cdiTarget - * the CDI target to create a debug target for - * @param name - * the name to associate with this target, which will be returned - * from <code>IDebugTarget.getName</code>. - * @param debuggeeProcess - * the process to associate with the debug target, which will be - * returned from <code>IDebugTarget.getProcess</code> - * @param file - * the executable to debug. - * @param allowTerminate - * allow terminate(). - * @param allowDisconnect - * allow disconnect(). - * @param stopInMain - * place temporary breakpoint at main() - * @param resumeTarget - * resume target. - * @return a debug target - * @throws DebugException - * @deprecated - */ - @Deprecated - public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget, - final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, - final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget) throws DebugException { - final IDebugTarget[] target = new IDebugTarget[1]; - IWorkspaceRunnable r = new IWorkspaceRunnable() { - - @Override - public void run(IProgressMonitor m) throws CoreException { - String stopSymbol = null; - if (stopInMain) - stopSymbol = launch.getLaunchConfiguration().getAttribute( - ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, - ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); - target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, - allowDisconnect); - ((CDebugTarget) target[0]).start(stopSymbol, resumeTarget); - } - }; - try { - ResourcesPlugin.getWorkspace().run(r, null); - } catch (CoreException e) { - CDebugCorePlugin.log(e); - throw new DebugException(e.getStatus()); - } - return target[0]; - } - - /** - * Creates and returns a debug target for the given CDI target, with the - * specified name, and associates it with the given process for console I/O. - * The debug target is added to the given launch. - * - * @param launch - * the launch the new debug target will be contained in - * @param project - * the project to use to persist breakpoints. - * @param cdiTarget - * the CDI target to create a debug target for - * @param name - * the name to associate with this target, which will be returned - * from <code>IDebugTarget.getName</code>. - * @param debuggeeProcess - * the process to associate with the debug target, which will be - * returned from <code>IDebugTarget.getProcess</code> - * @param file - * the executable to debug. - * @param allowTerminate - * allow terminate(). - * @param allowDisconnect - * allow disconnect(). - * @param resumeTarget - * resume target. - * @return a debug target - * @throws DebugException - */ - public static IDebugTarget newDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget, - final String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowTerminate, - boolean allowDisconnect, boolean resumeTarget) throws DebugException { - return newDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, - null, resumeTarget); - } - - /** * Calculates breakpoint marker ID based on the breakpoint object type. * * @since 7.2 @@ -1376,61 +1212,6 @@ public class CDIDebugModel { return null; } - /** - * @deprecated - */ - @Deprecated - public static IDebugTarget newDebugTarget(ILaunch launch, ICDITarget target, String name, IProcess iprocess, - IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain) - throws CoreException { - IBinaryExecutable exeFile = getBinary(file); - String stopSymbol = null; - if (stopInMain) - stopSymbol = launch.getLaunchConfiguration().getAttribute( - ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, - ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); - return newDebugTarget(launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, - allowDisconnect, stopSymbol, true); - } - - /** - * @deprecated - */ - @Deprecated - public static IDebugTarget newAttachDebugTarget(ILaunch launch, ICDITarget target, String name, - IProcess debuggerProcess, IFile file) throws CoreException { - IBinaryExecutable exeFile = getBinary(file); - return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, true, false); - } - - /** - * @deprecated - */ - @Deprecated - public static IDebugTarget newCoreFileDebugTarget(final ILaunch launch, final ICDITarget target, final String name, - final IProcess debuggerProcess, final IFile file) throws CoreException { - IBinaryExecutable exeFile = getBinary(file); - return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, false, false); - } - - private static IBinaryExecutable getBinary(IFile file) throws CoreException { - IProject project = file.getProject(); - ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( - project); - for (int i = 0; i < binaryParsersExt.length; i++) { - IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); - try { - IBinaryFile exe = parser.getBinary(file.getLocation()); - if (exe instanceof IBinaryExecutable) { - return (IBinaryExecutable) exe; - } - } catch (IOException e) { - } - } - throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, - DebugCoreMessages.getString("CDIDebugModel.0"), null)); //$NON-NLS-1$ - } - private static boolean sameSourceHandle(String handle1, String handle2) { if (handle1 == null || handle2 == null) return false; diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java index 41274aa5adb..177b245c5d1 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java @@ -12,11 +12,7 @@ *******************************************************************************/ package org.eclipse.cdt.debug.core; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import org.eclipse.cdt.debug.core.breakpointactions.BreakpointActionManager; import org.eclipse.cdt.debug.core.command.CCommandAdapterFactory; @@ -27,11 +23,9 @@ import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer; import org.eclipse.cdt.debug.core.sourcelookup.CProjectSourceContainer; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; import org.eclipse.cdt.debug.core.sourcelookup.ProgramRelativePathSourceContainer; -import org.eclipse.cdt.debug.internal.core.DebugConfiguration; import org.eclipse.cdt.debug.internal.core.DebugModelProvider; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.ListenerList; -import org.eclipse.cdt.debug.internal.core.SessionManager; import org.eclipse.cdt.debug.internal.core.Trace; import org.eclipse.cdt.debug.internal.core.disassembly.DisassemblyContextService; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; @@ -41,8 +35,6 @@ import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdapterManager; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin; @@ -74,10 +66,6 @@ public class CDebugCorePlugin extends Plugin { */ private static CDebugCorePlugin plugin; - private HashMap<String, DebugConfiguration> fDebugConfigurations; - - private HashSet<String> fActiveDebugConfigurations; - /** * Breakpoint listener list. */ @@ -105,8 +93,6 @@ public class CDebugCorePlugin extends Plugin { */ private CommonSourceLookupDirector fCommonSourceLookupDirector; - private SessionManager fSessionManager = null; - /** * The constructor. */ @@ -179,117 +165,6 @@ public class CDebugCorePlugin extends Plugin { getDefault().getLog().log(new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), INTERNAL_ERROR, message, null)); } - private void initializeDebugConfiguration() { - IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(getUniqueIdentifier(), CDEBUGGER_EXTENSION_POINT_ID); - IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); - fDebugConfigurations = new HashMap<String, DebugConfiguration>(infos.length); - for(int i = 0; i < infos.length; i++) { - IConfigurationElement configurationElement = infos[i]; - if (configurationElement.getName().equals(DEBUGGER_ELEMENT)) { - DebugConfiguration configType = new DebugConfiguration(configurationElement); - fDebugConfigurations.put(configType.getID(), configType); - } - } - } - - private void initializeActiveDebugConfigurations() { - fActiveDebugConfigurations = new HashSet<String>(getDebugConfigurations().length); - fActiveDebugConfigurations.addAll(fDebugConfigurations.keySet()); - String[] filteredTypes = CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_FILTERED_DEBUGGERS).split("\\,"); //$NON-NLS-1$ - fActiveDebugConfigurations.removeAll(Arrays.asList(filteredTypes)); - } - - public ICDebugConfiguration[] getDebugConfigurations() { - if (fDebugConfigurations == null) { - initializeDebugConfiguration(); - } - return fDebugConfigurations.values().toArray(new ICDebugConfiguration[fDebugConfigurations.size()]); - } - - public ICDebugConfiguration[] getActiveDebugConfigurations() { - if (fDebugConfigurations == null) { - initializeDebugConfiguration(); - } - if (fActiveDebugConfigurations == null) { - initializeActiveDebugConfigurations(); - } - ArrayList<DebugConfiguration> list = new ArrayList<DebugConfiguration>(fActiveDebugConfigurations.size()); - - for (String id : fActiveDebugConfigurations) { - DebugConfiguration dc = fDebugConfigurations.get(id); - if (dc != null) - list.add(dc); - } - return list.toArray(new ICDebugConfiguration[list.size()]); - } - - public ICDebugConfiguration[] getDefaultActiveDebugConfigurations() { - List<String> filtered = Arrays.asList(CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString(ICDebugConstants.PREF_FILTERED_DEBUGGERS).split("\\,")); //$NON-NLS-1$ - HashMap<String, DebugConfiguration> all = new HashMap<String, DebugConfiguration>(fDebugConfigurations); - all.keySet().removeAll(filtered); - return all.values().toArray(new ICDebugConfiguration[all.size()]); - } - - public void saveFilteredDebugConfigurations(ICDebugConfiguration[] configurations) { - disposeActiveDebugConfigurations(); - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < configurations.length; ++i) { - sb.append(configurations[i].getID()).append(','); - } - CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_FILTERED_DEBUGGERS, sb.toString()); - CDebugCorePlugin.getDefault().savePluginPreferences(); - } - - public void saveDefaultDebugConfiguration(String id) { - CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE, (id != null) ? id : ""); //$NON-NLS-1$ - } - - public ICDebugConfiguration getDefaultDebugConfiguration() { - ICDebugConfiguration result = null; - try { - result = getDebugConfiguration(CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE)); - } catch (CoreException e) { - } - return result; - } - - public ICDebugConfiguration getDefaultDefaultDebugConfiguration() { - ICDebugConfiguration result = null; - try { - result = getDebugConfiguration(CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE)); - } catch (CoreException e) { - } - if (result == null) { - } - return result; - } - - public boolean isDefaultDebugConfiguration(String id) { - return id.compareTo(CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE)) == 0; - } - - public ICDebugConfiguration getDebugConfiguration(String id) throws CoreException { - if (fDebugConfigurations == null) { - initializeDebugConfiguration(); - } - ICDebugConfiguration dbgCfg = fDebugConfigurations.get(id); - if (dbgCfg == null) { - IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), 100, DebugCoreMessages.getString("CDebugCorePlugin.0"), null); //$NON-NLS-1$ - throw new CoreException(status); - } - return dbgCfg; - } - - protected SessionManager getSessionManager() { - return fSessionManager; - } - - protected void setSessionManager(SessionManager sm) { - if (fSessionManager != null) - fSessionManager.dispose(); - fSessionManager = sm; - } - public void saveCommonSourceLocations(ICSourceLocation[] locations) { CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_SOURCE_LOCATIONS, SourceUtils.getCommonSourceLocationsMemento(locations)); } @@ -348,7 +223,6 @@ public class CDebugCorePlugin extends Plugin { createCommandAdapterFactory(); createBreakpointListenersList(); createDisassemblyContextService(); - setSessionManager(new SessionManager()); setDefaultLaunchDelegates(); Platform.getAdapterManager().registerAdapters(new DebugModelProvider(), ICDebugElement.class); @@ -359,11 +233,9 @@ public class CDebugCorePlugin extends Plugin { */ @Override public void stop(BundleContext context) throws Exception { - setSessionManager(null); disposeDisassemblyContextService(); disposeBreakpointListenersList(); disposeCommonSourceLookupDirector(); - disposeDebugConfigurations(); super.stop(context); } @@ -423,21 +295,6 @@ public class CDebugCorePlugin extends Plugin { private void convertSourceLocations(CommonSourceLookupDirector director) { director.setSourceContainers(SourceUtils.convertSourceLocations(getCommonSourceLocations())); } - - private void disposeActiveDebugConfigurations() { - if (fActiveDebugConfigurations != null) { - fActiveDebugConfigurations.clear(); - fActiveDebugConfigurations = null; - } - } - - private void disposeDebugConfigurations() { - disposeActiveDebugConfigurations(); - if (fDebugConfigurations != null) { - fDebugConfigurations.clear(); - fDebugConfigurations = null; - } - } public BreakpointActionManager getBreakpointActionManager() { if (breakpointActionManager == null) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java index 3d6329c3b9d..0c607e563cb 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java @@ -32,17 +32,14 @@ import javax.xml.transform.stream.StreamResult; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpointType; import org.eclipse.cdt.debug.core.model.ICDynamicPrintf; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.cdt.debug.core.model.ICValue; import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.core.model.ICWatchpoint2; -import org.eclipse.cdt.debug.internal.core.model.CFloatingPointValue; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; @@ -246,16 +243,6 @@ public class CDebugUtils { return serializeDocument(doc, true); } - public static Number getFloatingPointValue(ICValue value) { - if (value instanceof CFloatingPointValue) { - try { - return ((CFloatingPointValue)value).getFloatingPointValue(); - } catch (CDIException e) { - } - } - return null; - } - public static boolean isNaN(Number value) { if (value instanceof Double) { return ((Double) value).isNaN(); diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger.java deleted file mode 100644 index a50cf3bb6ae..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger.java +++ /dev/null @@ -1,31 +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.core; - -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.ILaunch; - -/** - * @deprecated use <code>ICDIDebugger2</code>. - */ -@Deprecated -public interface ICDIDebugger { - - /** - * @deprecated use <code>createSession</code> of <code>ICDIDebugger2</code> - */ - @Deprecated - public ICDISession createDebuggerSession(ILaunch launch, IBinaryObject exe, IProgressMonitor monitor) throws CoreException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger2.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger2.java deleted file mode 100644 index bc9cba0550b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger2.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.core; - -import java.io.File; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.ILaunch; - -/** - * Replacement for deprecated <code>ICDIDebugger</code>. - */ -public interface ICDIDebugger2 extends ICDIDebugger { - - /** - * <code>null</code> can be passed as <code>executable</code> allowing debuggers to create session without executables, - * or load executables later during the session. - */ - public ICDISession createSession(ILaunch launch, File executable, IProgressMonitor monitor) throws CoreException; -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java deleted file mode 100644 index 8573f5fd077..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.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.core; - -import org.eclipse.core.runtime.CoreException; - -public interface ICDebugConfiguration { - final static String CPU_NATIVE = "native"; //$NON-NLS-1$ - - /** - * @return - * @throws CoreException - * @deprecated - */ - @Deprecated - ICDebugger getDebugger() throws CoreException; - - ICDIDebugger createDebugger() throws CoreException; - String getName(); - String getID(); - String getPlatform(); - String[] getCPUList(); - String[] getModeList(); - String[] getCoreFileExtensions(); - boolean supportsCPU(String cpu); - boolean supportsMode(String mode); - - /** - * Returns a list of supported build configuration ids. - * Returns an empty array if a list has not been specified, - * which means that this debug configuration supports all - * build configurations. - */ - String[] getSupportedBuildConfigPatterns(); - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java deleted file mode 100644 index 633d1014228..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java +++ /dev/null @@ -1,28 +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.core; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunchConfiguration; - -/** - * - * @deprecated - see ICDIDebugger - */ -@Deprecated -public interface ICDebugger { - public ICDISession createLaunchSession(ILaunchConfiguration config, IFile exe) throws CDIException ; - public ICDISession createAttachSession(ILaunchConfiguration config, IFile exe, int pid) throws CDIException; - public ICDISession createCoreSession(ILaunchConfiguration config, IFile exe, IPath corefile) throws CDIException; -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICGlobalVariableManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICGlobalVariableManager.java deleted file mode 100644 index fbe4523ccaa..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICGlobalVariableManager.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * 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 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.core; - -import org.eclipse.cdt.debug.core.model.ICGlobalVariable; -import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; -import org.eclipse.debug.core.DebugException; - -/** - * Manages the collection of global variables added to a debug target. - */ -public interface ICGlobalVariableManager { - - /** - * Registers with this manager the global variables specified by given descriptors. - * - * @param descriptors the descriptors of global variables to register with this manager - * @throws DebugException - */ - public void addGlobals( IGlobalVariableDescriptor[] descriptors ) throws DebugException; - - /** - * Removes specified global variables from this manager. - * - * @param globals global variables to remove - */ - public void removeGlobals( ICGlobalVariable[] globals ); - - /** - * Removes all global variables from this manager. - */ - public void removeAllGlobals(); - - /** - * Returns the array of descriptors of global varibales added to this manager. - * - * @return the array of descriptors - */ - public IGlobalVariableDescriptor[] getDescriptors(); -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/BreakpointActionAdapterFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/BreakpointActionAdapterFactory.java deleted file mode 100644 index 00aafd75368..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/BreakpointActionAdapterFactory.java +++ /dev/null @@ -1,38 +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.core.breakpointactions; - -import org.eclipse.cdt.debug.internal.core.model.CThread; -import org.eclipse.core.runtime.IAdapterFactory; - -public class BreakpointActionAdapterFactory implements IAdapterFactory { - - @Override - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adapterType.equals(ILogActionEnabler.class)) { - if (adaptableObject instanceof CThread) { - return new LogActionEnabler((CThread) adaptableObject); - } - } - if (adapterType.equals(IResumeActionEnabler.class)) { - if (adaptableObject instanceof CThread) { - return new ResumeActionEnabler((CThread) adaptableObject); - } - } - return null; - } - - @Override - public Class[] getAdapterList() { - return new Class[] { ILogActionEnabler.class, IResumeActionEnabler.class, }; - } - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/LogActionEnabler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/LogActionEnabler.java deleted file mode 100644 index 8f3c3198145..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/LogActionEnabler.java +++ /dev/null @@ -1,34 +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.core.breakpointactions; - -import java.util.List; - -import org.eclipse.cdt.debug.internal.core.model.CStackFrame; -import org.eclipse.cdt.debug.internal.core.model.CThread; - -public class LogActionEnabler implements ILogActionEnabler { - - private CThread thread; - - public LogActionEnabler(CThread thread) { - this.thread = thread; - } - - @Override - public String evaluateExpression(String expression) throws Exception { - List frames = thread.computeStackFrames(); - CStackFrame frame = (CStackFrame) frames.get(0); - - return frame.evaluateExpressionToString(expression); - } - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/ResumeActionEnabler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/ResumeActionEnabler.java deleted file mode 100644 index 0412f310f84..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/breakpointactions/ResumeActionEnabler.java +++ /dev/null @@ -1,28 +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.core.breakpointactions; - -import org.eclipse.cdt.debug.internal.core.model.CThread; - -public class ResumeActionEnabler implements IResumeActionEnabler { - - private CThread thread; - - public ResumeActionEnabler(CThread adaptableObject) { - thread = adaptableObject; - } - - @Override - public void resume() throws Exception { - thread.resume(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/CVariableFormat.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/CVariableFormat.java deleted file mode 100644 index 21e5b3a6c94..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/CVariableFormat.java +++ /dev/null @@ -1,57 +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.core.model; - -/** - * Defines the variable format types. - */ -public class CVariableFormat { - - private final String fName; - private final int fNum; - - private CVariableFormat( String name, int num ) { - this.fName = name; - this.fNum= num; - } - - @Override - public String toString() { - return this.fName; - } - - public int getFormatNumber() { - return this.fNum; - } - - public static CVariableFormat getFormat( int code ) { - if ( code == NATURAL.getFormatNumber() ) { - return NATURAL; - } else if ( code == DECIMAL.getFormatNumber() ) { - return DECIMAL; - } else if ( code == BINARY.getFormatNumber() ) { - return BINARY; - } else if ( code == OCTAL.getFormatNumber() ) { - return OCTAL; - } else if ( code == HEXADECIMAL.getFormatNumber() ) { - return HEXADECIMAL; - } else { - // unexpected value, mapping to NATURAL - return NATURAL; - } - } - - public static final CVariableFormat NATURAL = new CVariableFormat( "natural", 0 ); //$NON-NLS-1$ - public static final CVariableFormat DECIMAL = new CVariableFormat( "decimal", 1 ); //$NON-NLS-1$ - public static final CVariableFormat BINARY = new CVariableFormat( "binary", 2 ); //$NON-NLS-1$ - public static final CVariableFormat OCTAL = new CVariableFormat( "octal", 3 ); //$NON-NLS-1$ - public static final CVariableFormat HEXADECIMAL = new CVariableFormat( "hexadecimal", 4 ); //$NON-NLS-1$ -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IAddRegisterGroupHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IAddRegisterGroupHandler.java deleted file mode 100644 index 1e402ad491b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IAddRegisterGroupHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.core.model; - -import org.eclipse.debug.core.commands.IDebugCommandHandler; - -/** - * Handler interface to for the addRegisterGroup command - * - * @since 7.6 - */ -public interface IAddRegisterGroupHandler extends IDebugCommandHandler { -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpointFilterExtension.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpointFilterExtension.java deleted file mode 100644 index a30526da030..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpointFilterExtension.java +++ /dev/null @@ -1,81 +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 - * Wind River Systems - Refactored from ICBreakpoint - *******************************************************************************/ -package org.eclipse.cdt.debug.core.model; - -import org.eclipse.core.runtime.CoreException; - -/** - * Breakpoint extension to allow filtering based on CDTs extended standard debug - * model elements. - */ -public interface ICBreakpointFilterExtension extends ICBreakpointExtension { - - /** - * Add the given target to the list of this breakpoint's targets. - * Target filters are not persisted across workbench invocations. - * - * @param target the target to add to the list of this breakpoint's targets. - * @throws CoreException if unable to set the target filter - */ - public void setTargetFilter( ICDebugTarget target ) throws CoreException; - - /** - * Removes the given target from the breakpoint's target list. - * The breakpoint has no effect in the given target. - * - * @param target the target filter to be removed - * @exception CoreException if unable to remove the target filter - */ - public void removeTargetFilter( ICDebugTarget target ) throws CoreException; - - /** - * Restricts this breakpoint to suspend only in the given threads - * when encounterd in the given threads' target. - * All threads must be from the same target. - * Thread filters are not persisted across workbench invocations. - * - * @param threads the thread filters to be set - * @exception CoreException if unable to set the thread filters - */ - public void setThreadFilters( ICThread[] threads ) throws CoreException; - - /** - * Returns all target filters set on this breakpoint. - * - * @return the targets that this breakpoint is resticted to - * @exception CoreException if unable to determine this breakpoint's - * target filters - */ - public ICDebugTarget[] getTargetFilters() throws CoreException; - - /** - * Removes this breakpoint's thread filters in the given target, if any. - * Has no effect if this breakpoint does not have filters in the given target. - * All threads must be from the same target. - * - * @param threads the thread filters to be removed - * @exception CoreException if unable to remove the thread filter - */ - public void removeThreadFilters( ICThread[] threads ) throws CoreException; - - /** - * Returns the threads in the given target in which this breakpoint - * is enabled or <code>null</code> if this breakpoint is enabled in - * all threads in the given target. - * - * @return the threads in the given target that this breakpoint is enabled for - * @exception CoreException if unable to determine this breakpoint's thread - * filters - */ - public ICThread[] getThreadFilters( ICDebugTarget target ) throws CoreException; - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java deleted file mode 100644 index 9962c470315..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java +++ /dev/null @@ -1,123 +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.core.model; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IRegisterGroup; - -/** - * C/C++ extension of <code>IDebugTarget</code>. - */ -public interface ICDebugTarget extends IDebugTarget, - IExecFileInfo, - IRestart, - IResumeWithoutSignal, - ICDebugElement, - ISteppingModeTarget, - IModuleRetrieval, - ITargetProperties { - - /** - * Returns whether this target is little endian. - * - * @return whether this target is little endian - */ - @Override - public boolean isLittleEndian(); - - /** - * Returns whether this target supports signals. - * - * @return whether this target supports signals - * @throws DebugException if this method fails. - */ - public boolean hasSignals() throws DebugException; - - /** - * Returns the list of signals defined for this target. - * - * @return the list of signals defined for this target - * @throws DebugException if this method fails. - */ - public ICSignal[] getSignals() throws DebugException; - - /** - * Returns the disassembly provider of this debug target. - * - * @return the disassembly provider of this debug target - * @throws DebugException if this method fails. - */ - public IDisassembly getDisassembly() throws DebugException; - - /** - * Returns whether this target is a post mortem type. - * - * @return whether this target is a post mortem type - */ - public boolean isPostMortem(); - - /** - * Returns the list of descriptors of the target registers - * - * @return the list register descriptors - * @throws DebugException if this method fails. Reasons include: - * - * @since 3.0 - */ - public IRegisterDescriptor[] getRegisterDescriptors() throws DebugException; - - /** - * Adds a new user-defined register group to this target - * - * @param name the group name - * @param descriptors the list of registers to be grouped - * - * @since 3.0 - */ - public void addRegisterGroup( String name, IRegisterDescriptor[] descriptors ); - - /** - * Removes the given register group from the target - * - * @param group a group to be removed - * - * @since 3.0 - */ - public void removeRegisterGroups( IRegisterGroup[] groups ); - - /** - * Replace the given group's register descriptors by the specified descriptors. - * - * @param group a group to be modified - * @param descriptors a descriptor array to replace existing descriptors - * - * @since 3.0 - */ - public void modifyRegisterGroup( IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors ); - - - /** - * Removes all user-defined register groups and restores the hardware groups. - * - * @since 3.0 - */ - public void restoreDefaultRegisterGroups(); - - /** - * Returns the target address of the given breakpoint. - * - * @return the target address of the given breakpoint - * @throws DebugException if the address is not available - */ - public IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException; -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICGlobalVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICGlobalVariable.java deleted file mode 100644 index 19e9eb06c3e..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICGlobalVariable.java +++ /dev/null @@ -1,24 +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 - *******************************************************************************/ -package org.eclipse.cdt.debug.core.model; - -/** - * Represents a global C/C++ variable. - */ -public interface ICGlobalVariable extends ICVariable { - - /** - * Returns the descriptor of this variable. Will be null if a child of a global. - * - * @return the descriptor of this variable - */ - public IGlobalVariableDescriptor getDescriptor(); -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICRegister.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICRegister.java deleted file mode 100644 index 4e619d63765..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICRegister.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.core.model; - -import org.eclipse.debug.core.model.IRegister; - -/** - * C/C++ specific extension of <code>IRegister</code>. - * Added to be able to contribute a label provider. - * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981 - */ -public interface ICRegister extends ICVariable, IRegister { -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICVariable.java deleted file mode 100644 index cbd92257e8b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICVariable.java +++ /dev/null @@ -1,44 +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.core.model; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IValueModification; -import org.eclipse.debug.core.model.IVariable; - -/** - * C/C++ specific extension <code>IVariable</code>. - */ -public interface ICVariable extends IVariable, ICDebugElement, IFormatSupport, ICastToArray, IValueModification, IEnableDisableTarget { - - /** - * Returns the type of this variable. - * - * @return the type of this variable - * @throws DebugException - */ - ICType getType() throws DebugException; - - /** - * Returns whether this variable is an argument. - * - * @return whether this variable is an argument - */ - boolean isArgument(); - - /** - * Returns the text presentation of this variable as an expression. - * - * @return the text presentation of this variable as an expression - * @throws DebugException - */ - public String getExpressionString() throws DebugException; -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IChangeReverseMethodHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IChangeReverseMethodHandler.java index 5766dea6b0b..c24f3ec3169 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IChangeReverseMethodHandler.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IChangeReverseMethodHandler.java @@ -15,7 +15,7 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler; /** * Handler interface for the reverse debug change trace method command * - * @since 7.8 + * @since 8.0 */ public interface IChangeReverseMethodHandler extends IReverseToggleHandler, IDebugCommandHandler { diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IFormatSupport.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IFormatSupport.java deleted file mode 100644 index 290b9e3f857..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IFormatSupport.java +++ /dev/null @@ -1,41 +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.core.model; - -import org.eclipse.debug.core.DebugException; - -/** - * Provides the ability to set and get the format of a variable. - */ -public interface IFormatSupport { - - /** - * Returns whether this variable supports formatting operations. - * - * @return whether this variable supports formatting operations - */ - boolean supportsFormatting(); - - /** - * Returns the current format of this variable. - * - * @return the current format of this variable - */ - CVariableFormat getFormat(); - - /** - * Sets the current format of this variable to <code>format</code>. - * - * @param format the new format type - * @throws DebugException if this method fails. - */ - void changeFormat( CVariableFormat format ) throws DebugException; -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java deleted file mode 100644 index bdd060f4cb0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java +++ /dev/null @@ -1,1542 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Matthias Spycher (matthias@coware.com) - patch for bug #112008 - * Ken Ryall (Nokia) - bugs 170027, 105196 - * Ling Wang (Nokia) - bug 176081 - * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299 - * QNX Software Systems - catchpoints - bug 226689 - * James Blackburn (Broadcom) - bug 314865 - * Marc Khouzam (Ericsson) - Support for dynamic printf (400628) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core; - -import java.io.File; -import java.io.IOException; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.CDebugUtils; -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.event.ICDIBreakpointMovedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIBreakpointProblemEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; -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.event.ICDIExecutableReloadedEvent; -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.ICDIBreakpoint2; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement2; -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.ICDIFunctionBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -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.ICDITargetConfiguration2; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint2; -import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointFilterExtension; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICDynamicPrintf; -import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; -import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.cdt.debug.core.model.ICTracepoint; -import org.eclipse.cdt.debug.core.model.ICWatchpoint; -import org.eclipse.cdt.debug.core.model.ICWatchpoint2; -import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; -import org.eclipse.cdt.debug.internal.core.breakpoints.BreakpointProblems; -import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IMarkerDelta; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IBreakpointManager; -import org.eclipse.debug.core.IBreakpointManagerListener; -import org.eclipse.debug.core.IBreakpointsListener; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.ILineBreakpoint; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; - -public class CBreakpointManager implements IBreakpointsListener, IBreakpointManagerListener, ICDIEventListener, IAdaptable { - - static class BreakpointInProgess { - - private ICDIBreakpoint fCDIBreakpoint; - - void setCDIBreakpoint( ICDIBreakpoint b ) { - fCDIBreakpoint = b; - } - - ICDIBreakpoint getCDIBreakpoint() { - return fCDIBreakpoint; - } - } - - class BreakpointMap { - - /** - * Maps CBreakpoints to CDI breakpoints. - */ - private HashMap fCBreakpoints; - - /** - * Maps CDI breakpoints to CBreakpoints. - */ - private HashMap fCDIBreakpoints; - - protected BreakpointMap() { - fCBreakpoints = new HashMap( 10 ); - fCDIBreakpoints = new HashMap( 10 ); - } - - void register( ICBreakpoint breakpoint ) { - fCBreakpoints.put( breakpoint, new BreakpointInProgess() ); - } - - void put( ICBreakpoint breakpoint, ICDIBreakpoint cdiBreakpoint ) { - fCBreakpoints.put( breakpoint, cdiBreakpoint ); - fCDIBreakpoints.put( cdiBreakpoint, breakpoint ); - } - - Object get( ICBreakpoint breakpoint ) { - return fCBreakpoints.get( breakpoint ); - } - - ICDIBreakpoint getCDIBreakpoint( ICBreakpoint breakpoint ) { - Object b = fCBreakpoints.get( breakpoint ); - return ( b instanceof ICDIBreakpoint ) ? (ICDIBreakpoint)b : null; - } - - ICBreakpoint getCBreakpoint( ICDIBreakpoint cdiBreakpoint ) { - ICBreakpoint breakpoint = (ICBreakpoint)fCDIBreakpoints.get( cdiBreakpoint ); - if ( breakpoint == null ) { - ICBreakpoint[] bip = getBreakpointsInProgress(); - for ( int i = 0; i < bip.length; ++i ) { - if ( isSameBreakpoint( bip[i], cdiBreakpoint ) ) { - breakpoint = bip[i]; - break; - } - } - } - return breakpoint; - } - - void removeCDIBreakpoint( ICDIBreakpoint cdiBreakpoint ) { - if ( cdiBreakpoint != null ) { - ICBreakpoint breakpoint = (ICBreakpoint)fCDIBreakpoints.remove( cdiBreakpoint ); - if ( breakpoint != null ) - fCBreakpoints.remove( breakpoint ); - } - } - - boolean isRegistered( ICBreakpoint breakpoint ) { - return ( fCBreakpoints.get( breakpoint ) != null ); - } - - boolean isInProgress( ICBreakpoint breakpoint ) { - return ( fCBreakpoints.get( breakpoint ) instanceof BreakpointInProgess ); - } - - ICBreakpoint[] getAllCBreakpoints() { - Set set = fCBreakpoints.keySet(); - return (ICBreakpoint[])set.toArray( new ICBreakpoint[set.size()] ); - } - - void dispose() { - fCBreakpoints.clear(); - fCDIBreakpoints.clear(); - } - - private ICBreakpoint[] getBreakpointsInProgress() { - ArrayList list = new ArrayList(); - Set set = fCBreakpoints.entrySet(); - Iterator it = set.iterator(); - while ( it.hasNext() ) { - Map.Entry entry = (Map.Entry)it.next(); - if ( entry.getValue() instanceof BreakpointInProgess ) { - list.add( entry.getKey() ); - } - } - return (ICBreakpoint[])list.toArray( new ICBreakpoint[list.size()] ); - } - - private boolean isSameBreakpoint( ICBreakpoint breakpoint, ICDIBreakpoint cdiBreakpoint ) { - try { - if ( breakpoint instanceof ICFunctionBreakpoint && cdiBreakpoint instanceof ICDIFunctionBreakpoint ) { - return ( ((ICFunctionBreakpoint)breakpoint).getFunction().compareTo( ((ICDIFunctionBreakpoint)cdiBreakpoint).getLocator().getFunction() ) == 0 ); - } - if ( breakpoint instanceof ICAddressBreakpoint && cdiBreakpoint instanceof ICDIAddressBreakpoint ) { - IAddressFactory factory = getDebugTarget().getAddressFactory(); - return factory.createAddress( ((ICAddressBreakpoint)breakpoint).getAddress() ).equals( factory.createAddress( ((ICDIAddressBreakpoint)cdiBreakpoint).getLocator().getAddress() ) ); - } - if ( breakpoint instanceof ICLineBreakpoint && cdiBreakpoint instanceof ICDILineBreakpoint ) { - ICDILocator location = ((ICDILineBreakpoint)cdiBreakpoint).getLocator(); - String file = location.getFile(); - String sourceHandle = file; - if ( !isEmpty( file ) ) { - Object sourceElement = getSourceElement( file ); - if ( sourceElement instanceof IFile ) { - sourceHandle = ((IFile)sourceElement).getLocation().toOSString(); - } - else if ( sourceElement instanceof IStorage ) { - sourceHandle = ((IStorage)sourceElement).getFullPath().toOSString(); - } - else if ( sourceElement instanceof ITranslationUnit ) { - sourceHandle = ((ITranslationUnit)sourceElement).getLocation().toOSString(); - } - String bpSourceHandle = ((ICLineBreakpoint)breakpoint).getSourceHandle(); - if ( sourceElement instanceof LocalFileStorage ) { // see bug #112008 - try { - bpSourceHandle = new File( bpSourceHandle ).getCanonicalPath(); - } - catch( IOException e ) { - } - } - return sourceHandle.equals( bpSourceHandle ) && location.getLineNumber() == ((ICLineBreakpoint)breakpoint).getLineNumber(); - } - } - if ( breakpoint instanceof ICWatchpoint && cdiBreakpoint instanceof ICDIWatchpoint ) { - try { - ICWatchpoint watchpoint = (ICWatchpoint)breakpoint; - if ( watchpoint instanceof ICWatchpoint2 && cdiBreakpoint instanceof ICDIWatchpoint2 ) { - ICWatchpoint2 wp2 = (ICWatchpoint2)breakpoint; - ICDIWatchpoint2 cdiwp2 = (ICDIWatchpoint2)cdiBreakpoint; - if ( !wp2.getMemorySpace().equals( cdiwp2.getMemorySpace() ) - || !wp2.getRange().equals( cdiwp2.getRange() ) ) { - return false; - } - } - ICDIWatchpoint cdiWatchpoint = (ICDIWatchpoint)cdiBreakpoint; - return ( watchpoint.getExpression().compareTo( cdiWatchpoint.getWatchExpression() ) == 0 && - watchpoint.isReadType() == cdiWatchpoint.isReadType() && - watchpoint.isWriteType() == cdiWatchpoint.isWriteType() ); - } - catch( CDIException e ) { - } - } - if ( breakpoint instanceof ICEventBreakpoint && cdiBreakpoint instanceof ICDIEventBreakpoint) { - ICEventBreakpoint mevtbkpt = (ICEventBreakpoint) breakpoint; - ICDIEventBreakpoint cdievtbkpt = (ICDIEventBreakpoint) cdiBreakpoint; - if (!mevtbkpt.getEventType().equals(cdievtbkpt.getEventType())) return false; - return (mevtbkpt.getEventArgument().equals(cdievtbkpt.getExtraArgument())); - } - } - catch( CoreException e ) { - } - return false; - } - } - - private CDebugTarget fDebugTarget; - - private BreakpointMap fMap; - - private boolean fSkipBreakpoint = false; - - private ArrayList fBreakpointProblems = new ArrayList(); - - public CBreakpointManager( CDebugTarget target ) { - super(); - fDebugTarget = target; - fMap = new BreakpointMap(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsAdded(org.eclipse.debug.core.model.IBreakpoint[]) - */ - @Override - public void breakpointsAdded( IBreakpoint[] breakpoints ) { - if ( !isTargetAvailable() ) - return; - setBreakpointsOnTarget( breakpoints ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsRemoved(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[]) - */ - @Override - public void breakpointsRemoved( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) { - if ( !isTargetAvailable() ) - return; - ArrayList list = new ArrayList( breakpoints.length ); - synchronized( getBreakpointMap() ) { - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( breakpoints[i] instanceof ICBreakpoint ) { - try { // Remove any problem markers for this breakpoint - BreakpointProblems.removeProblemsForBreakpoint((ICBreakpoint)breakpoints[i]); - } catch (CoreException e) {} - Object obj = getBreakpointMap().get( (ICBreakpoint)breakpoints[i] ); - ICDIBreakpoint b = null; - if ( obj instanceof ICDIBreakpoint ) { - b = (ICDIBreakpoint)obj; - } - else if ( obj instanceof BreakpointInProgess ) { - b = ((BreakpointInProgess)obj).getCDIBreakpoint(); - } - if ( b != null ) { - list.add( b ); - } - } - } - } - if ( list.isEmpty() ) - return; - final ICDIBreakpoint[] cdiBreakpoints = (ICDIBreakpoint[])list.toArray( new ICDIBreakpoint[list.size()] ); - final ICDITarget cdiTarget = getCDITarget(); - DebugPlugin.getDefault().asyncExec( new Runnable() { - @Override - public void run() { - try { - cdiTarget.deleteBreakpoints( cdiBreakpoints ); - } - catch( CDIException e ) { - } - } - } ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsChanged(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[]) - */ - @Override - public void breakpointsChanged( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) { - ArrayList removeList = new ArrayList( breakpoints.length ); - ArrayList installList = new ArrayList( breakpoints.length ); - synchronized ( getBreakpointMap() ) { - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( !(breakpoints[i] instanceof ICBreakpoint) || !isTargetAvailable() ) - continue; - ICBreakpoint b = (ICBreakpoint)breakpoints[i]; - boolean install = false; - try { - ICDebugTarget[] tfs = getFilterExtension(b).getTargetFilters(); - install = Arrays.asList( tfs ).contains( getDebugTarget() ); - } - catch( CoreException e ) { - } - boolean registered = getBreakpointMap().isRegistered( b ); - boolean inProgress = getBreakpointMap().isInProgress( b ); - if ( registered && !inProgress && !install ) { - removeList.add( b ); - } - if ( !registered && install ) { - installList.add( b ); - } - } - } - breakpointsRemoved( (ICBreakpoint[])removeList.toArray( new ICBreakpoint[removeList.size()] ), new IMarkerDelta[0] ); - breakpointsAdded( (ICBreakpoint[])installList.toArray( new ICBreakpoint[removeList.size()] ) ); - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( breakpoints[i] instanceof ICBreakpoint && isTargetAvailable() ) - changeBreakpointProperties( (ICBreakpoint)breakpoints[i], deltas[i] ); - } - } - - @Override - public void breakpointManagerEnablementChanged( boolean enabled ) { - doSkipBreakpoints( !enabled ); - } - - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - for( int i = 0; i < events.length; i++ ) { - ICDIEvent event = events[i]; - ICDIObject source = event.getSource(); - if ( source != null && source.getTarget().equals( getDebugTarget().getCDITarget() ) ) { - if ( event instanceof ICDICreatedEvent ) { - if ( source instanceof ICDIBreakpoint ) - handleBreakpointCreatedEvent( (ICDIBreakpoint)source ); - } - else if ( event instanceof ICDIDestroyedEvent ) { - if ( source instanceof ICDIBreakpoint ) - handleBreakpointDestroyedEvent( (ICDIBreakpoint)source ); - } - else if ( event instanceof ICDIChangedEvent ) { - if ( source instanceof ICDIBreakpoint ) - handleBreakpointChangedEvent( (ICDIBreakpoint)source ); - } - else if ( event instanceof ICDIBreakpointMovedEvent ) { - if ( source instanceof ICDIBreakpoint ) - handleBreakpointMovedEvent( (ICDIBreakpointMovedEvent) event ); - } - else if ( event instanceof ICDIExecutableReloadedEvent ) { - if ( source instanceof ICDITarget ) - handleExecutableReloadedEvent( (ICDIExecutableReloadedEvent) event ); - } - else if ( event instanceof ICDIBreakpointProblemEvent ) { - if ( source instanceof ICDIBreakpoint ) - handleBreakpointProblemEvent( (ICDIBreakpointProblemEvent) event ); - } - } - } - } - - @Override - public Object getAdapter( Class adapter ) { - if ( CBreakpointManager.class.equals( adapter ) ) - return this; - if ( CDebugTarget.class.equals( adapter ) ) - return getDebugTarget(); - if ( ICDebugTarget.class.equals( adapter ) ) - return getDebugTarget(); - if ( IDebugTarget.class.equals( adapter ) ) - return getDebugTarget(); - return null; - } - - public CDebugTarget getDebugTarget() { - return fDebugTarget; - } - - public void initialize() { - DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener( this ); - DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener( this ); - getDebugTarget().getCDISession().getEventManager().addEventListener( this ); - } - - public void dispose() { - getDebugTarget().getCDISession().getEventManager().removeEventListener( this ); - DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( this ); - DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener( this ); - removeAllBreakpoints(); - getBreakpointMap().dispose(); - } - - public IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) { - BigInteger address = null; - synchronized ( getBreakpointMap() ) { - ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint ); - if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) { - ICDILocator locator = ((ICDILocationBreakpoint)cdiBreakpoint).getLocator(); - if ( locator != null ) { - address = locator.getAddress(); - } - } - } - return ( address != null ) ? getDebugTarget().getAddressFactory().createAddress( address ) : null; - } - - public IBreakpoint getBreakpoint( ICDIBreakpoint cdiBreakpoint ) { - ICBreakpoint b; - synchronized ( getBreakpointMap() ) { - b = getBreakpointMap().getCBreakpoint( cdiBreakpoint ); - } - return b; - } - - /** - * @return true if the breakpoint is of a temporary type, otherwise false - */ - private boolean isTemporary(ICDIBreakpoint cdiBreakpoint) { - if (cdiBreakpoint instanceof ICDIBreakpoint2) { - return (((ICDIBreakpoint2)cdiBreakpoint).getType() & ICBreakpointType.TEMPORARY) != 0; - } - else { - return cdiBreakpoint.isTemporary(); - } - } - - private void handleBreakpointCreatedEvent( ICDIBreakpoint cdiBreakpoint ) { - if ( cdiBreakpoint instanceof ICDIWatchpoint ) - doHandleWatchpointCreatedEvent( (ICDIWatchpoint)cdiBreakpoint ); - if ( cdiBreakpoint instanceof ICDIEventBreakpoint ) - doHandleEventBreakpointCreatedEvent( (ICDIEventBreakpoint)cdiBreakpoint ); - else if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) - doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint ); - try { - if ( !isTemporary(cdiBreakpoint) && !DebugPlugin.getDefault().getBreakpointManager().isEnabled() && cdiBreakpoint.isEnabled() ) { - changeBreakpointPropertiesOnTarget(cdiBreakpoint, false, null); - } - } catch (CDIException e){ - } - } - - private void doHandleEventBreakpointCreatedEvent(ICDIEventBreakpoint cdiEventBkpt) { - ICBreakpoint breakpoint = null; - ICBreakpoint newBreakpoint = null; - boolean createNewCBkpt = false; - final BreakpointMap bkptMap = getBreakpointMap(); - - synchronized( bkptMap ) { - createNewCBkpt = (bkptMap.getCBreakpoint( cdiEventBkpt ) == null); - } - - // This has to be done outside the breakpoint map lock, or a deadlock - // can occur (according to rev 1.71). Not certain we'll use this new CDT - // breakpoint; we need to check the map again. - if (createNewCBkpt) { - try { - newBreakpoint = createEventBreakpoint( cdiEventBkpt ); - } - catch( CDIException e ) {} - catch( CoreException e ) {} - } - - synchronized( bkptMap ) { - breakpoint = bkptMap.getCBreakpoint( cdiEventBkpt ); - if ( breakpoint == null ) { - breakpoint = newBreakpoint; - } - - if ( breakpoint != null ) { - // filter must be set up prior to adding the breakpoint to the - // map to avoid a race condition in breakpointsChanged for the - // "registered && !inProgress && !install" condition - try { - getFilterExtension(breakpoint).setTargetFilter( getDebugTarget() ); - } - catch( CoreException e ) {} - - bkptMap.put( breakpoint, cdiEventBkpt ); - } - } - - // Delete the new CDT breakpoint if we didn't end up using it - if (newBreakpoint != null && newBreakpoint != breakpoint) { - try { - newBreakpoint.delete(); - } catch (CoreException e) {} - } - - if ( breakpoint != null ) { - try { - ((CBreakpoint)breakpoint).register( true ); - } - catch( CoreException e ) { - } - getBreakpointNotifier().breakpointInstalled( getDebugTarget(), breakpoint ); - changeBreakpointProperties( breakpoint, cdiEventBkpt ); - } - - } - - private void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint cdiBreakpoint ) { - if ( isTemporary(cdiBreakpoint) ) - return; - ICBreakpoint breakpoint = null; - ICBreakpoint newBreakpoint = null; - final BreakpointMap bkptMap = getBreakpointMap(); - boolean createNewCBkpt = false; - synchronized( bkptMap ) { - createNewCBkpt = (bkptMap.getCBreakpoint( cdiBreakpoint ) == null); - } - - // This has to be done outside the breakpoint map lock, or a deadlock - // can occur (according to rev 1.71). Not certain we'll use this new CDT - // breakpoint; we need to check the map again. - if ( createNewCBkpt ) { - newBreakpoint = createLocationBreakpoint( cdiBreakpoint ); - } - - synchronized( bkptMap ) { - breakpoint = bkptMap.getCBreakpoint( cdiBreakpoint ); - if ( breakpoint == null ) { - breakpoint = newBreakpoint; - } - - if ( breakpoint != null ) { - // filter must be set up prior to adding the breakpoint to the - // map to avoid a race condition in breakpointsChanged for the - // "registered && !inProgress && !install" condition - try { - getFilterExtension(breakpoint).setTargetFilter( getDebugTarget() ); - } - catch( CoreException e ) {} - - bkptMap.put( breakpoint, cdiBreakpoint ); - } - } - - // Delete the new CDT breakpoint if we didn't end up using it - if (newBreakpoint != null && newBreakpoint != breakpoint) { - try { - newBreakpoint.delete(); - } catch (CoreException e) {} - } - - if ( breakpoint != null ) { - try { - BreakpointProblems.removeProblemsForResolvedBreakpoint(breakpoint, getDebugTarget().getInternalID()); - ((CBreakpoint)breakpoint).register( true ); - } - catch( CoreException e ) { - } - getBreakpointNotifier().breakpointInstalled( getDebugTarget(), breakpoint ); - changeBreakpointProperties( breakpoint, cdiBreakpoint ); - } - } - - private void doHandleWatchpointCreatedEvent( ICDIWatchpoint cdiWatchpoint ) { - ICBreakpoint breakpoint = null; - ICBreakpoint newBreakpoint = null; - boolean createNewCBkpt = false; - final BreakpointMap bkptMap = getBreakpointMap(); - - synchronized( bkptMap ) { - createNewCBkpt = (bkptMap.getCBreakpoint( cdiWatchpoint ) == null); - } - - // This has to be done outside the breakpoint map lock, or a deadlock - // can occur (according to rev 1.71). Not certain we'll use this new CDT - // breakpoint; we need to check the map again. - if (createNewCBkpt) { - try { - newBreakpoint = createWatchpoint( cdiWatchpoint ); - } - catch( CDIException e ) {} - catch( CoreException e ) {} - } - - synchronized( bkptMap ) { - breakpoint = bkptMap.getCBreakpoint( cdiWatchpoint ); - if ( breakpoint == null ) { - breakpoint = newBreakpoint; - } - - if ( breakpoint != null ) { - // filter must be set up prior to adding the breakpoint to the - // map to avoid a race condition in breakpointsChanged for the - // "registered && !inProgress && !install" condition - try { - getFilterExtension(breakpoint).setTargetFilter( getDebugTarget() ); - } - catch( CoreException e ) {} - - bkptMap.put( breakpoint, cdiWatchpoint ); - } - } - - // Delete the new CDT breakpoint if we didn't end up using it - if (newBreakpoint != null && newBreakpoint != breakpoint) { - try { - newBreakpoint.delete(); - } catch (CoreException e) {} - } - - - if ( breakpoint != null ) { - try { - ((CBreakpoint)breakpoint).register( true ); - } - catch( CoreException e ) { - } - getBreakpointNotifier().breakpointInstalled( getDebugTarget(), breakpoint ); - changeBreakpointProperties( breakpoint, cdiWatchpoint ); - } - } - - private void handleBreakpointMovedEvent( ICDIBreakpointMovedEvent movedEvent ) - { - ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( (ICDIBreakpoint) movedEvent.getSource() ); - if (breakpoint != null) - { - try { - int newLineNumber = movedEvent.getNewLocation().getLineNumber(); - int currLineNumber = breakpoint.getMarker().getAttribute(IMarker.LINE_NUMBER, newLineNumber); - breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, newLineNumber); - IMarker marker = BreakpointProblems.reportBreakpointMoved( - breakpoint, currLineNumber, newLineNumber, getDebugTarget().getName(), getDebugTarget().getInternalID()); - if (marker != null) - fBreakpointProblems.add(marker); - } catch (CoreException e) {} - } - - } - - private void handleExecutableReloadedEvent( ICDIExecutableReloadedEvent reloadedEvent ) - { - ArrayList uninstalledCBplist = new ArrayList(); - - IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); - IBreakpoint[] breakpoints = manager.getBreakpoints( CDIDebugModel.getPluginIdentifier() ); - - for (int i = 0; i < breakpoints.length; i++) { - if (breakpoints[i] instanceof ICBreakpoint && (getBreakpointMap().getCDIBreakpoint((ICBreakpoint) breakpoints[i]) == null)) - { - uninstalledCBplist.add(breakpoints[i]); - } - } - - setBreakpointsOnTarget((IBreakpoint[]) uninstalledCBplist.toArray(new IBreakpoint[uninstalledCBplist.size()])); - } - - private void handleBreakpointProblemEvent( ICDIBreakpointProblemEvent problemEvent ) - { - ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( problemEvent.getBreakpoint() ); - if (breakpoint != null) - { - try { - IMarker marker; - marker = BreakpointProblems.reportBreakpointProblem(breakpoint, problemEvent.getDescription(), - problemEvent.getSeverity(), problemEvent.getProblemType(), problemEvent.removeExisting(), - problemEvent.removeOnly(), getDebugTarget().getName(), getDebugTarget().getInternalID()); - if (marker != null) - fBreakpointProblems.add(marker); - } catch (DebugException e) {} - } - - } - - private void handleBreakpointChangedEvent( ICDIBreakpoint cdiBreakpoint ) { - ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint ); - if ( breakpoint != null ) { - Map map = new HashMap( 3 ); - try { - if ( !fSkipBreakpoint && DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) { - map.put( IBreakpoint.ENABLED, Boolean.valueOf( cdiBreakpoint.isEnabled() ) ); - } - else { - map.put( IBreakpoint.ENABLED, Boolean.valueOf( breakpoint.isEnabled() ) ); - } - } - catch( CDIException e ) { - } - catch( CoreException e ) { - } - try { - map.put( ICBreakpoint.IGNORE_COUNT, new Integer( cdiBreakpoint.getCondition().getIgnoreCount() ) ); - } - catch( CDIException e ) { - } - try { - map.put( ICBreakpoint.CONDITION, cdiBreakpoint.getCondition().getExpression() ); - } - catch( CDIException e ) { - } - getBreakpointNotifier().breakpointChanged( getDebugTarget(), breakpoint, map ); - } - } - - private void handleBreakpointDestroyedEvent( ICDIBreakpoint cdiBreakpoint ) { - ICBreakpoint breakpoint = null; - synchronized( getBreakpointMap() ) { - breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint ); - getBreakpointMap().removeCDIBreakpoint( cdiBreakpoint ); - } - if ( breakpoint != null ) { - if ( isFilteredByTarget( breakpoint, getDebugTarget() ) ) { - try { - getFilterExtension(breakpoint).removeTargetFilter( getDebugTarget() ); - } - catch( CoreException e ) { - } - } - try { - BreakpointProblems.removeProblemsForBreakpoint(breakpoint); - } catch (CoreException e) {} - getBreakpointNotifier().breakpointsRemoved( getDebugTarget(), new IBreakpoint[] { breakpoint } ); - } - } - - private BreakpointMap getBreakpointMap() { - return fMap; - } - - private void removeAllBreakpoints() { - // Remove all breakpoint problem markers - for (Iterator iter = fBreakpointProblems.iterator(); iter.hasNext();) { - IMarker marker = (IMarker) iter.next(); - try { - marker.delete(); - } catch (CoreException e) {} - } - - ArrayList installedCDIBplist = new ArrayList(); - ArrayList installedCBplist = new ArrayList(); - ICBreakpoint[] breakpoints; - synchronized( getBreakpointMap() ) { - breakpoints = getBreakpointMap().getAllCBreakpoints(); - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( !getBreakpointMap().isInProgress( breakpoints[i] ) ) { - installedCDIBplist.add( getBreakpointMap().getCDIBreakpoint( breakpoints[i] ) ); - - installedCBplist.add(breakpoints[i]); - } - } - } - if ( installedCDIBplist.isEmpty() ) - return; - - final ICDIBreakpoint[] cdiBreakpoints = (ICDIBreakpoint[])installedCDIBplist.toArray( new ICDIBreakpoint[installedCDIBplist.size()] ); - final ICDITarget cdiTarget = getCDITarget(); - - // Clean up the target filter to avoid that the CDebugTarget remains referenced by the breakpoint. - // Note that though we're "removing" breakpoints from a debug session, the breakpoint objects in the - // platform aren't going anywhere. They are "global" model elements. They go away only when the user - // deletes them. - CDebugTarget target = getDebugTarget(); - for (Iterator iter = installedCBplist.iterator(); iter.hasNext();) { - ICBreakpoint breakpoint = (ICBreakpoint) iter.next(); - if ( isFilteredByTarget( breakpoint, target ) ) { - try { - getFilterExtension(breakpoint).removeTargetFilter( target ); - } - catch( CoreException e ) { - CDebugCorePlugin.log( e.getStatus() ); - } - } - } - - DebugPlugin.getDefault().asyncExec( new Runnable() { - @Override - public void run() { - try { - cdiTarget.deleteBreakpoints( cdiBreakpoints ); - } - catch( CDIException e ) { - } - } - } ); - - getBreakpointNotifier().breakpointsRemoved( getDebugTarget(), (ICBreakpoint[])installedCBplist.toArray( new ICBreakpoint[installedCBplist.size()] ) ); - } - - private ICBreakpoint[] register( IBreakpoint[] breakpoints ) { - ArrayList list = new ArrayList( breakpoints.length ); - synchronized ( getBreakpointMap() ) { - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( breakpoints[i] instanceof ICBreakpoint && isTargetBreakpoint( (ICBreakpoint)breakpoints[i] ) && !(getBreakpointMap().isRegistered( (ICBreakpoint)breakpoints[i] )) ) { - getBreakpointMap().register( (ICBreakpoint)breakpoints[i] ); - list.add( breakpoints[i] ); - } - } - } - return (ICBreakpoint[])list.toArray( new ICBreakpoint[list.size()] ); - } - - private void setBreakpointsOnTarget( IBreakpoint[] breakpoints ) { - final ICBreakpoint[] bkpts = register( breakpoints ); - if ( bkpts.length > 0 ) { - DebugPlugin.getDefault().asyncExec( new Runnable() { - @Override - public void run() { - setBreakpointsOnTarget0( bkpts ); - } - } ); - } - } - - protected void setBreakpointsOnTarget0( ICBreakpoint[] breakpoints ) { - ICDITarget cdiTarget = getCDITarget(); - ICDIBreakpointManagement2 bpManager2 = null; - if (cdiTarget instanceof ICDIBreakpointManagement2) - bpManager2 = (ICDIBreakpointManagement2) cdiTarget; - for ( int i = 0; i < breakpoints.length; ++i ) { - try { - ICDIBreakpoint b = null; - int breakpointType = ICBreakpointType.REGULAR; - ICBreakpoint icbreakpoint = breakpoints[i]; - // Bug 314865: CDI breakpoint is only created enabled if the global breakpoint disable toggle isn't set - boolean enabled = icbreakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled(); - if (icbreakpoint instanceof ICBreakpointType) { - breakpointType = ((ICBreakpointType) icbreakpoint).getType(); - } - if ( icbreakpoint instanceof ICTracepoint) { - ICTracepoint tracepoint = (ICTracepoint)icbreakpoint; - IMarker marker = BreakpointProblems.reportUnsupportedTracepoint(tracepoint, getDebugTarget().getName(), getDebugTarget().getInternalID()); - if (marker != null) - fBreakpointProblems.add(marker); - } else if ( icbreakpoint instanceof ICDynamicPrintf) { - ICDynamicPrintf dprintf = (ICDynamicPrintf)icbreakpoint; - IMarker marker = BreakpointProblems.reportUnsupportedDynamicPrintf(dprintf, getDebugTarget().getName(), getDebugTarget().getInternalID()); - if (marker != null) - fBreakpointProblems.add(marker); - } - else if ( icbreakpoint instanceof ICFunctionBreakpoint ) { - ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)icbreakpoint; - String function = breakpoint.getFunction(); - String fileName = breakpoint.getFileName(); - ICDIFunctionLocation location = cdiTarget.createFunctionLocation( fileName, function ); - ICDICondition condition = createCondition( breakpoint ); - IMarker marker = BreakpointProblems.reportUnresolvedBreakpoint(breakpoint, getDebugTarget().getName(), getDebugTarget().getInternalID()); - if (marker != null) - fBreakpointProblems.add(marker); - if (bpManager2 != null) - b = bpManager2.setFunctionBreakpoint( breakpointType, location, condition, true, enabled ); - else - b = cdiTarget.setFunctionBreakpoint( breakpointType, location, condition, true ); - } else if ( icbreakpoint instanceof ICAddressBreakpoint ) { - ICAddressBreakpoint breakpoint = (ICAddressBreakpoint)icbreakpoint; - String address = breakpoint.getAddress(); - ICDIAddressLocation location = cdiTarget.createAddressLocation( new BigInteger ( ( address.startsWith( "0x" ) ) ? address.substring( 2 ) : address, 16 ) ); //$NON-NLS-1$ - ICDICondition condition = createCondition( breakpoint ); - if (bpManager2 != null) - b = bpManager2.setAddressBreakpoint( breakpointType, location, condition, true, enabled ); - else - b = cdiTarget.setAddressBreakpoint( breakpointType, location, condition, true ); - } else if ( icbreakpoint instanceof ICLineBreakpoint ) { - ICLineBreakpoint breakpoint = (ICLineBreakpoint)icbreakpoint; - String handle = breakpoint.getSourceHandle(); - IPath path = convertPath( handle ); - ICDILineLocation location = cdiTarget.createLineLocation( path.toPortableString(), breakpoint.getLineNumber() ); - ICDICondition condition = createCondition( breakpoint ); - IMarker marker = BreakpointProblems.reportUnresolvedBreakpoint(breakpoint, getDebugTarget().getName(), getDebugTarget().getInternalID()); - if (marker != null) - fBreakpointProblems.add(marker); - if (bpManager2 != null) - b = bpManager2.setLineBreakpoint( breakpointType, location, condition, true, enabled ); - else - b = cdiTarget.setLineBreakpoint( breakpointType, location, condition, true ); - } else if ( icbreakpoint instanceof ICWatchpoint ) { - ICWatchpoint watchpoint = (ICWatchpoint)icbreakpoint; - int accessType = 0; - accessType |= (watchpoint.isWriteType()) ? ICDIWatchpoint.WRITE : 0; - accessType |= (watchpoint.isReadType()) ? ICDIWatchpoint.READ : 0; - String expression = watchpoint.getExpression(); - ICDICondition condition = createCondition( watchpoint ); - if ( bpManager2 != null ) { - if ( icbreakpoint instanceof ICWatchpoint2 ) { - ICWatchpoint2 wp2 = (ICWatchpoint2)watchpoint; - b = bpManager2.setWatchpoint( breakpointType, accessType, expression, wp2.getMemorySpace(), - wp2.getRange(), condition, enabled ); - } else { - b = bpManager2.setWatchpoint( breakpointType, accessType, expression, condition, enabled ); - } - } else { - b = cdiTarget.setWatchpoint(breakpointType, accessType, expression, condition ); - } - } else if (icbreakpoint instanceof ICEventBreakpoint) { - ICEventBreakpoint eventbkpt = (ICEventBreakpoint) icbreakpoint; - ICDICondition condition = createCondition(eventbkpt); - if (cdiTarget instanceof ICDIBreakpointManagement3) { - ICDIBreakpointManagement3 bpManager3 = (ICDIBreakpointManagement3) cdiTarget; - b = bpManager3.setEventBreakpoint(eventbkpt.getEventType(), eventbkpt - .getEventArgument(), breakpointType, condition, true, enabled); - } else { - throw new UnsupportedOperationException("BreakpointManager does not support this type of breapoints"); - } - - } - if ( b != null ) { - Object obj = getBreakpointMap().get( icbreakpoint ); - if ( obj instanceof BreakpointInProgess ) { - ((BreakpointInProgess)obj).setCDIBreakpoint( b ); - } - } - // Hack: see bug 105196: [CDI]: Add "enabled" flag to the "set...Breakpoint" methods - if (bpManager2 == null && b != null && b.isEnabled() != enabled ) { - b.setEnabled( enabled ); - } - } - catch( CoreException e ) { - } - catch( NumberFormatException e ) { - } - catch( CDIException e ) { - } - } - } - - protected ICDITarget getCDITarget() { - return getDebugTarget().getCDITarget(); - } - - private ICDICondition createCondition( ICBreakpoint breakpoint ) throws CoreException, CDIException { - return getCDITarget().createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition(), getThreadNames( breakpoint ) ); - } - - private String[] getThreadNames( ICBreakpoint breakpoint ) { - try { - ICThread[] threads = getFilterExtension(breakpoint).getThreadFilters( getDebugTarget() ); - if ( threads == null ) - return new String[0]; - String[] names = new String[threads.length]; - for ( int i = 0; i < threads.length; ++i ) { - names[i] = threads[i].getName(); - } - return names; - } - catch( DebugException e ) { - } - catch( CoreException e ) { - } - return new String[0]; - } - - private ICLineBreakpoint createLocationBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) { - ICLineBreakpoint breakpoint = null; - try { - ICDILocator location = cdiBreakpoint.getLocator(); - String file = location.getFile(); - String sourceHandle = file; - IResource resource = getProject(); - if (file != null && file.length() > 0) { - Object sourceElement = getSourceElement(file); - if ( sourceElement instanceof IFile ) { - sourceHandle = ((IFile)sourceElement).getLocation().toOSString(); - resource = (IResource)sourceElement; - } - else if ( sourceElement instanceof IStorage ) { - sourceHandle = ((IStorage)sourceElement).getFullPath().toOSString(); - resource = ResourcesPlugin.getWorkspace().getRoot(); - } - else if ( sourceElement instanceof ITranslationUnit ) { - ITranslationUnit translationUnit = (ITranslationUnit)sourceElement; - sourceHandle = translationUnit.getPath().toString(); - resource = translationUnit.getResource(); - - // an IExternalTranslationUnit doesn't have an IResource - if (resource == null) { - resource = getProject(); - } - } - } else { - sourceHandle = getExecFileHandle(); - } - if ( cdiBreakpoint instanceof ICDILineBreakpoint ) { - breakpoint = createLineBreakpoint( sourceHandle, resource, cdiBreakpoint ); - } - else if ( cdiBreakpoint instanceof ICDIFunctionBreakpoint ) { - breakpoint = createFunctionBreakpoint( sourceHandle, resource,cdiBreakpoint ); - } - else if ( cdiBreakpoint instanceof ICDIAddressBreakpoint ) { - breakpoint = createAddressBreakpoint( sourceHandle, resource,cdiBreakpoint ); - } - } - catch( CDIException e ) { - } - catch( CoreException e ) { - } - return breakpoint; - } - - private ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { - ICLineBreakpoint breakpoint = CDIDebugModel.createLineBreakpoint( sourceHandle, - resource, - getCdiBreakpointType(cdiBreakpoint), - cdiBreakpoint.getLocator().getLineNumber(), - cdiBreakpoint.isEnabled(), - cdiBreakpoint.getCondition().getIgnoreCount(), - cdiBreakpoint.getCondition().getExpression(), - false ); -// ICDILocator locator = cdiBreakpoint.getLocator(); -// if ( locator != null ) { -// BigInteger address = locator.getAddress(); -// if ( address != null ) { -// breakpoint.setAddress( address.toString() ); -// } -// } - return breakpoint; - } - - /** - * Utility method that queries the CDI client for the breakpoint type. - * - * @param cdiBreakpoint - * the CDI breakpoint - * @return an ICDIBreakpointType constant - */ - @SuppressWarnings("deprecation") - private int getCdiBreakpointType(ICDIBreakpoint cdiBreakpoint) { - if (cdiBreakpoint instanceof ICDIBreakpoint2) { - // the new way - return ((ICDIBreakpoint2)cdiBreakpoint).getType(); - } - else { - // the old way - int type = cdiBreakpoint.isHardware() ? ICBreakpointType.HARDWARE : ICBreakpointType.REGULAR; - if (cdiBreakpoint.isTemporary()) { - type |= ICBreakpointType.TEMPORARY; - } - return type; - } - } - - private ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { - ICDILocator location = cdiBreakpoint.getLocator(); - int line = location.getLineNumber(); - ICFunctionBreakpoint breakpoint = CDIDebugModel.createFunctionBreakpoint( - sourceHandle, - resource, - getCdiBreakpointType(cdiBreakpoint), - location.getFunction(), - -1, - -1, - line, - cdiBreakpoint.isEnabled(), - cdiBreakpoint.getCondition().getIgnoreCount(), - cdiBreakpoint.getCondition().getExpression(), - false); - return breakpoint; - } - - private ICAddressBreakpoint createAddressBreakpoint( String sourceHandle, IResource resource, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { - String binary = getExecFileHandle(); - IAddress address = getDebugTarget().getAddressFactory().createAddress( cdiBreakpoint.getLocator().getAddress() ); - ICDILocator location = cdiBreakpoint.getLocator(); - int line = location.getLineNumber(); - ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( - binary, - sourceHandle, - resource, - ICBreakpointType.REGULAR, - line, - address, - cdiBreakpoint.isEnabled(), - cdiBreakpoint.getCondition().getIgnoreCount(), - cdiBreakpoint.getCondition().getExpression(), - false); - return breakpoint; - } - - private ICWatchpoint createWatchpoint( ICDIWatchpoint cdiWatchpoint ) throws CDIException, CoreException { - String sourceHandle = getExecFileHandle(); - ICWatchpoint watchpoint = null; - if ( cdiWatchpoint instanceof ICDIWatchpoint2 ){ - watchpoint = CDIDebugModel.createWatchpoint( sourceHandle, - getProject(), - cdiWatchpoint.isWriteType(), - cdiWatchpoint.isReadType(), - cdiWatchpoint.getWatchExpression(), - ( (ICDIWatchpoint2)cdiWatchpoint ).getMemorySpace(), - ( (ICDIWatchpoint2)cdiWatchpoint ).getRange(), - cdiWatchpoint.isEnabled(), - cdiWatchpoint.getCondition().getIgnoreCount(), - cdiWatchpoint.getCondition().getExpression(), - false); - } else { - watchpoint = CDIDebugModel.createWatchpoint( sourceHandle, - getProject(), - cdiWatchpoint.isWriteType(), - cdiWatchpoint.isReadType(), - cdiWatchpoint.getWatchExpression(), - cdiWatchpoint.isEnabled(), - cdiWatchpoint.getCondition().getIgnoreCount(), - cdiWatchpoint.getCondition().getExpression(), - false ); - } - return watchpoint; - } - - private ICEventBreakpoint createEventBreakpoint(ICDIEventBreakpoint cdiEventBkpt) throws CDIException, - CoreException { - - ICEventBreakpoint eventBkpt; - eventBkpt = CDIDebugModel.eventBreakpointExists(cdiEventBkpt.getEventType(), cdiEventBkpt - .getExtraArgument()); - if (eventBkpt != null) - return eventBkpt; - eventBkpt = CDIDebugModel.createEventBreakpoint(cdiEventBkpt.getEventType(), cdiEventBkpt - .getExtraArgument(), false); - return eventBkpt; - } - - private void changeBreakpointProperties( ICBreakpoint breakpoint, IMarkerDelta delta ) { - ICDIBreakpoint cdiBreakpoint = null; - synchronized( getBreakpointMap() ) { - if ( !getBreakpointMap().isInProgress( breakpoint ) ) - cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint ); - } - if ( cdiBreakpoint == null ) - return; - ICDITarget cdiTarget = getCDITarget(); - try { - boolean enabled = breakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled(); - boolean oldEnabled = ( delta != null ) ? delta.getAttribute( IBreakpoint.ENABLED, true ) : enabled; - int ignoreCount = breakpoint.getIgnoreCount(); - int oldIgnoreCount = ( delta != null ) ? delta.getAttribute( ICBreakpoint.IGNORE_COUNT, 0 ) : ignoreCount; - String condition = breakpoint.getCondition(); - String oldCondition = ( delta != null ) ? delta.getAttribute( ICBreakpoint.CONDITION, "" ) : condition; //$NON-NLS-1$ - String[] newThreadIs = getThreadNames( breakpoint ); - Boolean enabled0 = null; - ICDICondition condition0 = null; - if ( enabled != oldEnabled && enabled != cdiBreakpoint.isEnabled() ) { - enabled0 = Boolean.valueOf( enabled ); - } - if ( ignoreCount != oldIgnoreCount || condition.compareTo( oldCondition ) != 0 || areThreadFiltersChanged( newThreadIs, cdiBreakpoint ) ) { - ICDICondition cdiCondition = cdiTarget.createCondition( ignoreCount, condition, newThreadIs ); - if ( !cdiCondition.equals( cdiBreakpoint.getCondition() ) ) { - condition0 = cdiCondition; - } - } - int line = 0; - if (breakpoint instanceof ILineBreakpoint) { - ILineBreakpoint l = (ILineBreakpoint) breakpoint; - line = l.getLineNumber(); - } - int oldLine = ( delta != null ) ? delta.getAttribute( IMarker.LINE_NUMBER, 0 ) : 0; - boolean basic = oldLine>0 && oldLine != line; - - if (breakpoint instanceof ICBreakpointType) { - int oldType = ( delta != null ) ? delta.getAttribute( ICBreakpointType.TYPE, -1 ) : -1; - basic |= oldType != -1 && (oldType != ((ICBreakpointType) breakpoint).getType()); - } - - if (basic) { - final ICBreakpoint[] breakpoints = new ICBreakpoint[] {breakpoint}; - breakpointsRemoved(breakpoints, null); - handleBreakpointDestroyedEvent(cdiBreakpoint); // events has to processed before add executes - breakpointsAdded(breakpoints); - } else if (enabled0 != null || condition0 != null) { - changeBreakpointPropertiesOnTarget(cdiBreakpoint, enabled0, condition0); - } - } - catch( CoreException e ) { - } - catch( CDIException e ) { - } - } - - private void changeBreakpointProperties( ICBreakpoint breakpoint, ICDIBreakpoint cdiBreakpoint ) { - Boolean enabled = null; - try { - boolean shouldBeEnabled = breakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled(); - if ( cdiBreakpoint.isEnabled() != shouldBeEnabled ) - enabled = shouldBeEnabled; - } - catch( CDIException e ) { - } - catch( CoreException e ) { - } - ICDICondition condition = null; - try { - ICDICondition c = createCondition( breakpoint ); - if ( !cdiBreakpoint.getCondition().equals( c ) ) - condition = c; - } - catch( CDIException e ) { - } - catch( CoreException e ) { - } - if ( enabled != null || condition != null ) - changeBreakpointPropertiesOnTarget( cdiBreakpoint, enabled, condition ); - } - - private void changeBreakpointPropertiesOnTarget( final ICDIBreakpoint breakpoint, final Boolean enabled, final ICDICondition condition ) { - DebugPlugin.getDefault().asyncExec( new Runnable() { - @Override - public void run() { - if ( enabled != null ) { - try { - breakpoint.setEnabled( enabled.booleanValue() ); - } - catch( CDIException e ) { - } - } - if ( condition != null ) { - try { - breakpoint.setCondition( condition ); - } - catch( CDIException e ) { - } - } - } - } ); - } - - public void setInitialBreakpoints() { - IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); - IBreakpoint[] bps = manager.getBreakpoints( CDIDebugModel.getPluginIdentifier() ); - - ICDITargetConfiguration config = getDebugTarget().getCDITarget().getConfiguration(); - - if (!(config instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)config).supportsAddressBreaksOnStartup()) - { // Disable address breaks of the target does not support setting them on startup - for( int i = 0; i < bps.length; i++ ) { - if ( bps[i] instanceof ICBreakpoint && isTargetBreakpoint( (ICBreakpoint)bps[i] ) && !getBreakpointMap().isRegistered( (ICBreakpoint)bps[i] ) ) { - if ( bps[i] instanceof ICAddressBreakpoint ) { - // disable address breakpoints to prevent the debugger to insert them prematurely - try { - bps[i].setEnabled( false ); - } - catch( CoreException e ) { - } - } - } - } - } - - ICBreakpoint[] breakpoints = register( bps ); - setBreakpointsOnTarget0( breakpoints ); - } - - /** - * Checks if matching between the symbolics referenced by the breakpoint - * and the symbolics of the contained CDebugTarget should be done using also source handle. - * @param breakpoint - * @return true if source handle should be used - */ - private boolean breakpointUsesSourceMatching(ICBreakpoint breakpoint) { - boolean result = false; - if (breakpoint instanceof ICLineBreakpoint) { - result = true; - if (breakpoint instanceof ICFunctionBreakpoint) { - // ICDIFunctionBreakpoint on function elements from binary objects can be - // set without having a source handle. For this case of line breakpoint - // don't try to match breakpoints with source locator of contained CDebugTarget. - String handle = null; - try { - handle = breakpoint.getSourceHandle(); - } catch (CoreException ex) { - // ignore exception. source handle will be empty anyway. - } - result = (handle != null) && (handle.length() > 0); - - } - } - return result; - } - - private boolean isTargetBreakpoint( ICBreakpoint breakpoint ) { - if ( breakpoint instanceof ICAddressBreakpoint ) - return supportsAddressBreakpoint( (ICAddressBreakpoint)breakpoint ); - - // If the breakpoint is set on a resource in this project - // it should be enabled irrespective of what the CSourceLookupDirector thinks - if (breakpoint.getMarker() != null) { - IProject project = breakpoint.getMarker().getResource().getProject(); - if (getProject().equals(project)) - return true; - if (CDebugUtils.isReferencedProject(getProject(), project)) - return true; - } - - // Is it a line breakpoint with source handle ? - if ( breakpointUsesSourceMatching( breakpoint ) ) { - try { - String handle = breakpoint.getSourceHandle(); - ISourceLocator sl = getSourceLocator(); - if ( sl instanceof ICSourceLocator ) - return ( ((ICSourceLocator)sl).findSourceElement( handle ) != null ); - else if ( sl instanceof CSourceLookupDirector ) { - return ( ((CSourceLookupDirector)sl).contains( breakpoint ) ); - } - } - catch( CoreException e ) { - CDebugCorePlugin.log(e); - } - } else { - // Check the marker resource against the source containers ... - IResource resource = breakpoint.getMarker().getResource(); - IProject project = resource.getProject(); - if ( project != null && project.exists() ) { - ISourceLocator sl = getSourceLocator(); - if ( sl instanceof ICSourceLocator ) - return ((ICSourceLocator)sl).contains( project ); - else if ( sl instanceof CSourceLookupDirector ) - return ((CSourceLookupDirector)sl).contains( project ); - } - } - // Allow unclassified breakpoints i.e. those which aren't project scoped, - // or not resource related (e.g. watchpoints) - return true; - } - - public boolean supportsBreakpoint( ICBreakpoint breakpoint ) { - boolean s = false; - synchronized( getBreakpointMap() ) { - s = getBreakpointMap().isRegistered( breakpoint ); - } - return s; - } - - /** - * Checks for a match between the symbolics referenced by the breakpoint - * and the symbolics of the contained CDebugTarget. - * @param breakpoint - * @return true if the symbolics match or if the breakpoint has no symbolics - */ - public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint ) { - boolean sessionHasSymbols = getExecFileHandle() != null && getExecFileHandle().length() > 0; - boolean bpHasSymbols = false; - try { - String module = breakpoint.getModule(); - if ( module != null && module.length() > 0 ) { - bpHasSymbols = true; - if ( sessionHasSymbols ) { - return getExecFileHandle().equals( module ); - } - } - } - catch( CoreException e ) { - } - - // supporting old breakpoints (> 3.0) - try { - String sourceHandle = breakpoint.getSourceHandle(); - if ( sourceHandle != null && sourceHandle.length() > 0 ) { - bpHasSymbols = true; - if ( sessionHasSymbols ) { - return getExecFileHandle().equals( sourceHandle ); - } - } - } - catch( CoreException e ) { - } - - // an address breakpoint can also be set in the absence of any symbols - return !bpHasSymbols; - } - - public void skipBreakpoints( boolean enabled ) { - if ( fSkipBreakpoint != enabled && (DebugPlugin.getDefault().getBreakpointManager().isEnabled() || !enabled) ) { - fSkipBreakpoint = enabled; - doSkipBreakpoints( enabled ); - } - } - - public void watchpointOutOfScope( ICDIWatchpoint cdiWatchpoint ) { - handleBreakpointDestroyedEvent( cdiWatchpoint ); - } - - private void doSkipBreakpoints( boolean enabled ) { - ICBreakpoint[] cBreakpoints = getBreakpointMap().getAllCBreakpoints(); - for ( int i = 0; i < cBreakpoints.length; ++i ) { - try { - if ( cBreakpoints[i].isEnabled() ) { - ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( cBreakpoints[i] ); - if ( cdiBreakpoint != null ) { - cdiBreakpoint.setEnabled( !enabled ); - } - } - } - catch( CoreException e ) { - // ignore - } - catch( CDIException e ) { - // ignore - } - } - } - - private IPath convertPath( String sourceHandle ) { - IPath path = null; - if ( Path.EMPTY.isValidPath( sourceHandle ) ) { - ISourceLocator sl = getSourceLocator(); - if ( sl instanceof CSourceLookupDirector ) { - path = ((CSourceLookupDirector)sl).getCompilationPath( sourceHandle ); - } - if ( path == null ) { - path = new Path( sourceHandle ); - } - } - return path; - } - - private IProject getProject() { - return getDebugTarget().getProject(); - } - - private String getExecFileHandle() { - CDebugTarget target = getDebugTarget(); - if ( target != null ) { - IBinaryObject binary = target.getExecFile(); - if ( binary != null ) { - IPath path = binary.getPath(); - if ( path != null ) { - return path.toOSString(); - } - } - } - return null; - } - - private ISourceLocator getSourceLocator() { - return getDebugTarget().getLaunch().getSourceLocator(); - } - - protected Object getSourceElement( String file ) { - Object sourceElement = null; - ISourceLocator locator = getSourceLocator(); - if ( locator instanceof ICSourceLocator || locator instanceof CSourceLookupDirector ) { - if ( locator instanceof ICSourceLocator ) - sourceElement = ((ICSourceLocator)locator).findSourceElement( file ); - else - sourceElement = ((CSourceLookupDirector)locator).getSourceElement( file ); - } - return sourceElement; - } - - protected boolean isEmpty( String str ) { - return !( str != null && str.trim().length() > 0 ); - } - - private boolean isTargetAvailable() { - return getDebugTarget().getCDITarget().getConfiguration().supportsBreakpoints() && getDebugTarget().isAvailable(); - } - - private CBreakpointNotifier getBreakpointNotifier() { - return CBreakpointNotifier.getInstance(); - } - - private boolean isFilteredByTarget( ICBreakpoint breakpoint, ICDebugTarget target ) { - boolean result = false; - try { - ICDebugTarget[] tfs = getFilterExtension(breakpoint).getTargetFilters(); - result = Arrays.asList( tfs ).contains( target ); - } - catch( CoreException e ) { - // ignore - } - return result; - } - - private boolean areThreadFiltersChanged( String[] newIds, ICDIBreakpoint cdiBreakpoint ) { - try { - String[] oldIds = cdiBreakpoint.getCondition().getThreadIds(); - if ( oldIds.length != newIds.length ) - return true; - List list = Arrays.asList( oldIds ); - for ( int i = 0; i < newIds.length; ++i ) { - if ( !list.contains( newIds[i] ) ) { - return true; - } - } - } - catch( CDIException e ) { - } - return false; - } - - private ICBreakpointFilterExtension getFilterExtension(ICBreakpoint bp) throws CoreException{ - return bp.getExtension( - CDIDebugModel.getPluginIdentifier(), ICBreakpointFilterExtension.class); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java deleted file mode 100644 index 01ea87d4319..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.internal.core; - -import java.util.Date; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDIDebugger; -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.core.resources.IFile; -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.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.variables.VariablesPlugin; -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; - -import com.ibm.icu.text.DateFormat; -import com.ibm.icu.text.MessageFormat; - -public class CDebugAdapter implements ICDIDebugger { - final ICDebugger fDebugger; - - /** - * @param debugger - */ - public CDebugAdapter(ICDebugger debugger) { - fDebugger = debugger; - } - - /* (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 { - ILaunchConfiguration config = launch.getLaunchConfiguration(); - if (exe == null) { - abort(InternalDebugCoreMessages.CDebugAdapter_Program_file_not_specified, null, - ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM); - } - IFile[] exeFile = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(exe.getPath()); - if (exeFile.length == 0) { - abort(InternalDebugCoreMessages.CDebugAdapter_0, null, -1); - } - int pid = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1); - String coreFile = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null); - ICDISession session; - try { - if (pid == -1 && coreFile == null) { - session = fDebugger.createLaunchSession(config, exeFile[0]); - } else if (pid != -1) { - session = fDebugger.createAttachSession(config, exeFile[0], pid); - } else { - session = fDebugger.createCoreSession(config, exeFile[0], new Path(coreFile)); - } - Process debugger = session.getSessionProcess(); - if (debugger != null) { - IProcess debuggerProcess = DebugPlugin.newProcess(launch, debugger, renderDebuggerProcessLabel()); - launch.addProcess(debuggerProcess); - } - return session; - } catch (CDIException e) { - abort(e.getLocalizedMessage(), e, -1); - } - throw new IllegalStateException(); // should never happen - } - - protected String renderDebuggerProcessLabel() { - String format = "{0} ({1})"; //$NON-NLS-1$ - String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis())); - String message = InternalDebugCoreMessages.CDebugAdapter_1; - return MessageFormat.format(format, message, timestamp); - } - - protected void abort(String message, Throwable exception, int code) throws CoreException { - MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), code, message, exception); - status.add(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code, - exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$ - exception)); - throw new CoreException(status); - } - - public static ICProject getCProject(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); - ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project); - if (cProject != null && cProject.exists()) { - return cProject; - } - } - } - return null; - } - - public static String getProjectName(ILaunchConfiguration configuration) throws CoreException { - return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null); - } - - public static String getProgramName(ILaunchConfiguration configuration) throws CoreException { - String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null); - if (programName != null) { - programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName); - } - return programName; - } - - public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException { - String path = getProgramName(configuration); - if (path == null) { - return null; - } - return new Path(path); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugCorePreferenceInitializer.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugCorePreferenceInitializer.java index a6a33294142..d951fd1b0e7 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugCorePreferenceInitializer.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugCorePreferenceInitializer.java @@ -16,7 +16,6 @@ import java.nio.charset.Charset; import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.cdi.ICDIFormat; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.DefaultScope; @@ -42,9 +41,6 @@ public class CDebugCorePreferenceInitializer extends AbstractPreferenceInitializ IEclipsePreferences defaultPreferences = DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID); defaultPreferences.putInt(ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS, ICDebugConstants.DEF_NUMBER_OF_INSTRUCTIONS); - defaultPreferences.putInt(ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, ICDIFormat.NATURAL); - defaultPreferences.putInt(ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, ICDIFormat.NATURAL); - defaultPreferences.putInt(ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, ICDIFormat.NATURAL); defaultPreferences.put(ICDebugConstants.PREF_DEBUG_CHARSET, Charset.defaultCharset().name()); if (Platform.getOS().equals(Platform.OS_WIN32)) { defaultPreferences.put(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, "UTF-16"); //$NON-NLS-1$ diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDisassemblyContextProvider.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDisassemblyContextProvider.java deleted file mode 100644 index 469781e5fc0..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDisassemblyContextProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.core; - -import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider; -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.debug.core.model.IDebugTarget; - -/** - * org.eclipse.cdt.debug.internal.core.CDisassemblyContextProvider: - * //TODO Add description. - */ -public class CDisassemblyContextProvider implements IDisassemblyContextProvider { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider#getDisassemblyContext(java.lang.Object) - */ - @Override - public Object getDisassemblyContext( Object element ) { - if ( element instanceof ICDebugElement ) { - IDebugTarget target = ((ICDebugElement)element).getDebugTarget(); - return ((CDebugTarget)target).getDisassemblyRetrieval(); - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CGlobalVariableManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CGlobalVariableManager.java deleted file mode 100644 index 24bc5b35688..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CGlobalVariableManager.java +++ /dev/null @@ -1,297 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 - * Gaetano Santoro (gaetano.santoro@st.com): patch for - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=274499 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core; - -import java.io.IOException; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICGlobalVariableManager; -import org.eclipse.cdt.debug.core.model.ICGlobalVariable; -import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.CVariable; -import org.eclipse.cdt.debug.internal.core.model.CVariableFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * Manages all global variables registered with a debug target. - */ -public class CGlobalVariableManager implements ICGlobalVariableManager { - - private static final String GLOBAL_VARIABLE_LIST = "globalVariableList"; //$NON-NLS-1$ - private static final String GLOBAL_VARIABLE = "globalVariable"; //$NON-NLS-1$ - private static final String ATTR_GLOBAL_VARIABLE_PATH = "path"; //$NON-NLS-1$ - private static final String ATTR_GLOBAL_VARIABLE_NAME = "name"; //$NON-NLS-1$ - - private CDebugTarget fDebugTarget; - - private IGlobalVariableDescriptor[] fInitialDescriptors = new IGlobalVariableDescriptor[0]; - - private List<ICGlobalVariable> fGlobals; - - /** - * Constructor for CGlobalVariableManager. - */ - public CGlobalVariableManager( CDebugTarget target ) { - super(); - setDebugTarget( target ); - initialize(); - } - - protected CDebugTarget getDebugTarget() { - return fDebugTarget; - } - - private void setDebugTarget( CDebugTarget debugTarget ) { - fDebugTarget = debugTarget; - } - - public ICGlobalVariable[] getGlobals() { - if ( fGlobals == null ) { - try { - addGlobals( getInitialDescriptors() ); - } - catch( DebugException e ) { - DebugPlugin.log( e ); - } - } - return fGlobals.toArray( new ICGlobalVariable[fGlobals.size()] ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#addGlobals(IGlobalVariableDescriptor[]) - */ - @Override - public void addGlobals( IGlobalVariableDescriptor[] descriptors ) throws DebugException { - fGlobals = new ArrayList<ICGlobalVariable>( 10 ); - MultiStatus ms = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(), 0, "", null ); //$NON-NLS-1$ - List<ICGlobalVariable> globals = new ArrayList<ICGlobalVariable>( descriptors.length ); - for ( int i = 0; i < descriptors.length; ++i ) { - try { - globals.add( getDebugTarget().createGlobalVariable( descriptors[i] ) ); - } - catch( DebugException e ) { - ms.add( e.getStatus() ); - } - } - if ( globals.size() > 0 ) { - synchronized( fGlobals ) { - fGlobals.addAll( globals ); - } - } - getDebugTarget().fireChangeEvent( DebugEvent.CONTENT ); - if ( !ms.isOK() ) { - throw new DebugException( ms ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#removeGlobals(ICGlobalVariable[]) - */ - @Override - public void removeGlobals( ICGlobalVariable[] globals ) { - synchronized( fGlobals ) { - fGlobals.removeAll( Arrays.asList( globals ) ); - } - for ( int i = 0; i < globals.length; ++i ) { - if ( globals[i] instanceof CVariable ) - ((CVariable)globals[i]).dispose(); - } - getDebugTarget().fireChangeEvent( DebugEvent.CONTENT ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#removeAllGlobals() - */ - @Override - public void removeAllGlobals() { - if (fGlobals == null ) { - return; - } - - ICGlobalVariable[] globals; - synchronized( fGlobals ) { - globals = fGlobals.toArray( new ICGlobalVariable[fGlobals.size()] ); - fGlobals.clear(); - } - for ( int i = 0; i < globals.length; ++i ) { - if ( globals[i] instanceof CVariable ) - ((CVariable)globals[i]).dispose(); - } - getDebugTarget().fireChangeEvent( DebugEvent.CONTENT ); - } - - public void dispose() { - if ( fGlobals != null ) { - for (ICGlobalVariable global : fGlobals) { - ((CVariable)global).dispose(); - } - fGlobals.clear(); - fGlobals = null; - } - } - - public String getMemento() { - Document document = null; - try { - document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - Element node = document.createElement( GLOBAL_VARIABLE_LIST ); - document.appendChild( node ); - ICGlobalVariable[] globals = getGlobals(); - for (ICGlobalVariable global : globals) { - IGlobalVariableDescriptor descriptor = global.getDescriptor(); - // children of globals don't have a descriptor, though getGlobals() shouldn't return only top level globals - if (descriptor != null) { - Element child = document.createElement( GLOBAL_VARIABLE ); - child.setAttribute( ATTR_GLOBAL_VARIABLE_NAME, descriptor.getName() ); - child.setAttribute( ATTR_GLOBAL_VARIABLE_PATH, descriptor.getPath().toOSString() ); - node.appendChild( child ); - } - } - return CDebugUtils.serializeDocument( document ); - } - catch( ParserConfigurationException e ) { - DebugPlugin.log( e ); - } - catch( IOException e ) { - DebugPlugin.log( e ); - } - catch( TransformerException e ) { - DebugPlugin.log( e ); - } - return null; - } - - private void initializeFromMemento( String memento ) throws CoreException { - Exception ex = null; - try { - Element root = null; - DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - StringReader reader = new StringReader( memento ); - InputSource source = new InputSource( reader ); - root = parser.parse( source ).getDocumentElement(); - if ( root.getNodeName().equalsIgnoreCase( GLOBAL_VARIABLE_LIST ) ) { - List<IGlobalVariableDescriptor> descriptors = new ArrayList<IGlobalVariableDescriptor>(); - NodeList list = root.getChildNodes(); - int length = list.getLength(); - for( int i = 0; i < length; ++i ) { - Node node = list.item( i ); - short type = node.getNodeType(); - if ( type == Node.ELEMENT_NODE ) { - Element entry = (Element)node; - if ( entry.getNodeName().equalsIgnoreCase( GLOBAL_VARIABLE ) ) { - String name = entry.getAttribute( ATTR_GLOBAL_VARIABLE_NAME ); - String pathString = entry.getAttribute( ATTR_GLOBAL_VARIABLE_PATH ); - IPath path = new Path( pathString ); - if ( path.isValidPath( pathString ) ) { - descriptors.add( CVariableFactory.createGlobalVariableDescriptor( name, path ) ); - } - } - } - } - fInitialDescriptors = descriptors.toArray( new IGlobalVariableDescriptor[descriptors.size()] ); - return; - } - } - catch( ParserConfigurationException e ) { - ex = e; - } - catch( SAXException e ) { - ex = e; - } - catch( IOException e ) { - ex = e; - } - abort(InternalDebugCoreMessages.CGlobalVariableManager_0, ex); - } - - private void initialize() { - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - String memento = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_GLOBAL_VARIABLES, "" ); //$NON-NLS-1$ - if ( memento != null && memento.trim().length() != 0 ) - initializeFromMemento( memento ); - } - catch( CoreException e ) { - DebugPlugin.log( e ); - } - } - - /** - * Throws an internal error exception - */ - private void abort( String message, Throwable e ) throws CoreException { - IStatus s = new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, message, e ); - throw new CoreException( s ); - } - - private IGlobalVariableDescriptor[] getInitialDescriptors() { - return fInitialDescriptors; - } - - public void save() { - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_GLOBAL_VARIABLES, getMemento() ); - wc.doSave(); - } - catch( CoreException e ) { - DebugPlugin.log( e ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#getDescriptors() - */ - @Override - public IGlobalVariableDescriptor[] getDescriptors() { - if ( fGlobals == null ) - return getInitialDescriptors(); - List<IGlobalVariableDescriptor> descrs = new ArrayList<IGlobalVariableDescriptor>(); - for (ICGlobalVariable global : fGlobals) { - IGlobalVariableDescriptor descr = global.getDescriptor(); - if (descr != null) { // children of globals don't have a descriptor, though 'fGlobals' should contain only top level globals - descrs.add(descr); - } - } - return descrs.toArray(new IGlobalVariableDescriptor[descrs.size()]); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java deleted file mode 100644 index bdb16e2bb53..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java +++ /dev/null @@ -1,499 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.internal.core; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.core.IAddressFactory2; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -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.ICDIMemorySpaceEncoder; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlock; -import org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.CExpression; -import org.eclipse.cdt.debug.internal.core.model.CMemoryBlockExtension; -import org.eclipse.cdt.debug.internal.core.model.CStackFrame; -import org.eclipse.cdt.debug.internal.core.model.CThread; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IMemoryBlock; -import org.eclipse.debug.core.model.IMemoryBlockExtension; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IValue; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import com.ibm.icu.text.MessageFormat; - -/** - * Implements the memory retrieval features based on the CDI model. - */ -public class CMemoryBlockRetrievalExtension extends PlatformObject implements IMemorySpaceAwareMemoryBlockRetrieval { - - private static final String MEMORY_BLOCK_EXPRESSION_LIST = "memoryBlockExpressionList"; //$NON-NLS-1$ - private static final String MEMORY_BLOCK_EXPRESSION_ITEM = "memoryBlockExpressionItem"; //$NON-NLS-1$ - private static final String MEMORY_BLOCK_EXPRESSION = "expression"; //$NON-NLS-1$ - private static final String MEMORY_BLOCK_MEMSPACEID = "memorySpaceID"; //$NON-NLS-1$ - private static final String ATTR_MEMORY_BLOCK_MEMSPACEID_TEXT = "text"; //$NON-NLS-1$ - private static final String ATTR_MEMORY_BLOCK_EXPRESSION_TEXT = "text"; //$NON-NLS-1$ - - CDebugTarget fDebugTarget; - - /** - * Constructor for CMemoryBlockRetrievalExtension. - */ - public CMemoryBlockRetrievalExtension( CDebugTarget debugTarget ) { - fDebugTarget = debugTarget; - } - - protected CDebugTarget getDebugTarget() { - return fDebugTarget; - } - - public void initialize() { - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - String memento = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_MEMORY_BLOCKS, "" ); //$NON-NLS-1$ - if ( memento != null && memento.trim().length() != 0 ) - initializeFromMemento( memento ); - } - catch( CoreException e ) { - CDebugCorePlugin.log( e ); - } - } - - private void parseMementoExprItem(Element element, List<String> expressions, List<String> memorySpaceIDs) { - NodeList list = element.getChildNodes(); - int length = list.getLength(); - String exp = null; - String memorySpaceID = null; - for( int i = 0; i < length; ++i ) { - Node node = list.item( i ); - if ( node.getNodeType() == Node.ELEMENT_NODE ) { - Element entry = (Element)node; - if ( entry.getNodeName().equalsIgnoreCase( MEMORY_BLOCK_EXPRESSION ) ) { - exp = entry.getAttribute( ATTR_MEMORY_BLOCK_EXPRESSION_TEXT ); - } else if ( entry.getNodeName().equalsIgnoreCase( MEMORY_BLOCK_MEMSPACEID ) ) { - memorySpaceID = entry.getAttribute( ATTR_MEMORY_BLOCK_MEMSPACEID_TEXT ); - } - } - } - if (exp != null) { - expressions.add( exp ); - memorySpaceIDs.add( memorySpaceID ); - } - } - - - private void initializeFromMemento( String memento ) throws CoreException { - Element root = DebugPlugin.parseDocument( memento ); - if ( root.getNodeName().equalsIgnoreCase( MEMORY_BLOCK_EXPRESSION_LIST ) ) { - List<String> expressions = new ArrayList<String>(); - List<String> memorySpaceIDs = new ArrayList<String>(); - NodeList list = root.getChildNodes(); - int length = list.getLength(); - for( int i = 0; i < length; ++i ) { - Node node = list.item( i ); - if ( node.getNodeType() == Node.ELEMENT_NODE ) { - Element entry = (Element)node; - if ( entry.getNodeName().equalsIgnoreCase( MEMORY_BLOCK_EXPRESSION_ITEM ) ) { - parseMementoExprItem(entry, expressions, memorySpaceIDs); - } - } - } - createMemoryBlocks( expressions.toArray( new String[expressions.size()]) , - memorySpaceIDs.toArray( new String[memorySpaceIDs.size()])); - - return; - } - abort(InternalDebugCoreMessages.CMemoryBlockRetrievalExtension_3, null); - } - - /** - * Convert a simple literal address (e.g., "0x1000") to a BigInteger value - * using the debug target's address factory. - * - * We throw a NumberFormatException if the string is not a valid literal - * address. If the backend implements the new&improved factory interface, - * we'll throw a NumberFormatException if the string is a literal address - * but is outside of the valid range. Old address factories will simply - * truncate the value. - * - * @param expression - * @return - * @throws DebugException if target not available - */ - private BigInteger evaluateLiteralAddress(String addr) throws DebugException { - CDebugTarget target = getDebugTarget(); - if (target == null) { - throw new DebugException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, - InternalDebugCoreMessages.CMemoryBlockRetrievalExtension_CDebugTarget_not_available, null)); - } - IAddressFactory addrFactory = target.getAddressFactory(); - if (addrFactory instanceof IAddressFactory2) { - return ((IAddressFactory2)addrFactory).createAddress(addr, false).getValue(); - } - else { - return addrFactory.createAddress(addr).getValue(); - } - } - - private void createMemoryBlocks( String[] expressions, String[] memorySpaceIDs ) { - List<CMemoryBlockExtension> list = new ArrayList<CMemoryBlockExtension>( expressions.length ); - for ( int i = 0; i < expressions.length; ++i ) { - try { - IAddress address = getDebugTarget().getAddressFactory().createAddress( expressions[i] ); - if ( address != null ) { - if (memorySpaceIDs[i] == null) { - list.add( new CMemoryBlockExtension( getDebugTarget(), address.toHexAddressString(), address.getValue() ) ); - } else { - list.add( new CMemoryBlockExtension( getDebugTarget(), expressions[i], address.getValue(), memorySpaceIDs[i] ) ); - } - } - } catch (NumberFormatException exc) { - CDebugCorePlugin.log(exc); - } - } - DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks( list.toArray( new IMemoryBlock[list.size()] ) ); - } - - public String getMemento() throws CoreException { - IMemoryBlock[] blocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks( getDebugTarget() ); - Document document = DebugPlugin.newDocument(); - Element exprList = document.createElement( MEMORY_BLOCK_EXPRESSION_LIST ); - for ( int i = 0; i < blocks.length; ++i ) { - if ( blocks[i] instanceof IMemoryBlockExtension ) { - IMemoryBlockExtension memBlockExt = (IMemoryBlockExtension)blocks[i]; - Element exprItem = document.createElement( MEMORY_BLOCK_EXPRESSION_ITEM ); - exprList.appendChild(exprItem); - - String memorySpaceID = null; - if (memBlockExt instanceof IMemorySpaceAwareMemoryBlock) { - memorySpaceID = ((IMemorySpaceAwareMemoryBlock)memBlockExt).getMemorySpaceID(); - } - BigInteger addrBigInt = memBlockExt.getBigBaseAddress(); - - Element child = document.createElement( MEMORY_BLOCK_EXPRESSION ); - child.setAttribute( ATTR_MEMORY_BLOCK_EXPRESSION_TEXT, "0x" + addrBigInt.toString(16) ); //$NON-NLS-1$ - exprItem.appendChild( child ); - - if (memorySpaceID != null) { - child = document.createElement( MEMORY_BLOCK_MEMSPACEID ); - child.setAttribute( ATTR_MEMORY_BLOCK_MEMSPACEID_TEXT, memorySpaceID); - exprItem.appendChild( child ); - } - } - } - document.appendChild( exprList ); - return DebugPlugin.serializeDocument( document ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtensionRetrieval#getExtendedMemoryBlock(java.lang.String, org.eclipse.debug.core.model.IDebugElement) - */ - @Override - public IMemoryBlockExtension getExtendedMemoryBlock( String expression, Object selected ) throws DebugException { - return getMemoryBlock(expression, selected, null); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#getExtendedMemoryBlock(java.lang.String, java.lang.Object, java.lang.String) - */ - @Override - public IMemorySpaceAwareMemoryBlock getMemoryBlock( String expression, Object selected, String memorySpaceID ) throws DebugException { - String address = null; - CExpression exp = null; - String msg = null; - try { - if (selected instanceof IDebugElement) { - IDebugElement debugElement = (IDebugElement)selected; - IDebugTarget target = debugElement.getDebugTarget(); - if (!(target instanceof CDebugTarget)) { - throw new DebugException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, msg, null ) ); - } - - // See if the expression is a simple numeric value; if it is, we can avoid some costly - // processing (calling the backend to resolve the expression) - try { - return new CMemoryBlockExtension((CDebugTarget)target, expression, evaluateLiteralAddress(expression), memorySpaceID); - } catch (NumberFormatException nfexc) {} - - // OK, expression is not a simple literal address; keep trucking and try to resolve as expression - CStackFrame frame = getStackFrame( debugElement ); - if ( frame != null ) { - // Get the address of the expression - ICDIExpression cdiExpression = frame.getCDITarget().createExpression( expression ); - exp = new CExpression( frame, cdiExpression, null ); - IValue value = exp.getValue(); - if ( value instanceof ICValue ) { - ICType type = ((ICValue)value).getType(); - if ( type != null ) { - // get the address for the expression, allow all types - String rawExpr = exp.getExpressionString(); - String voidExpr = "(void *)(" + rawExpr + ')'; //$NON-NLS-1$ - String attempts[] = { rawExpr, voidExpr }; - for (int i = 0; i < attempts.length; i++) { - String expr = attempts[i]; - address = frame.evaluateExpressionToString(expr); - if (address != null) { - try { - BigInteger a = (address.startsWith("0x")) ? new BigInteger(address.substring(2), 16) : new BigInteger(address); //$NON-NLS-1$ - return new CMemoryBlockExtension((CDebugTarget) target, expression, a, memorySpaceID); - } catch (NumberFormatException e) { - // not pointer? lets cast it to void* - if (i == 0) - continue; - throw e; - } - } - } - - } - else { - msg = MessageFormat.format(InternalDebugCoreMessages.CMemoryBlockRetrievalExtension_1, expression); - } - } - else { - msg = MessageFormat.format(InternalDebugCoreMessages.CMemoryBlockRetrievalExtension_2, expression); - } - } - } - } - catch( CDIException e ) { - msg = e.getMessage(); - } - catch( NumberFormatException e ) { - msg = MessageFormat.format(InternalDebugCoreMessages.CMemoryBlockRetrievalExtension_0, expression); - } - finally { - if (exp != null) { - exp.dispose(); - } - } - - throw new DebugException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, msg, null ) ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval() - */ - @Override - public boolean supportsStorageRetrieval() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long) - */ - @Override - public IMemoryBlock getMemoryBlock( long startAddress, long length ) throws DebugException { - String expression = Long.toHexString(startAddress); - BigInteger address = new BigInteger(expression, 16); - expression = "0x" + expression; //$NON-NLS-1$ - return new CMemoryBlockExtension( getDebugTarget(), expression, address ); - } - - private CStackFrame getStackFrame( IDebugElement selected ) throws DebugException { - if ( selected instanceof CStackFrame ) { - return (CStackFrame)selected; - } - if ( selected instanceof CThread ) { - IStackFrame frame = ((CThread)selected).getTopStackFrame(); - if ( frame instanceof CStackFrame ) - return (CStackFrame)frame; - } - return null; - } - - public void save() { - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_MEMORY_BLOCKS, getMemento() ); - wc.doSave(); - } - catch( CoreException e ) { - CDebugCorePlugin.log( e.getStatus() ); - } - } - - /** - * Throws an internal error exception - */ - private void abort( String message, Throwable e ) throws CoreException { - IStatus s = new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, message, e ); - throw new CoreException( s ); - } - - public void dispose() { - // Fire a terminate event so our hosts can clean up. See 255120 and 283586 - DebugPlugin.getDefault().fireDebugEventSet( new DebugEvent[]{new DebugEvent( this, DebugEvent.TERMINATE )}); - - // Minimize leaks in case we are ourselves are leaked - fDebugTarget = null; - } - - /** - * Checks the CDI backend to see is memory spaces are supported and actually - * available for the target process. - * - * @return true if the backend supports memory spaces - */ - public boolean hasMemorySpaces() { - return getMemorySpaces().length > 0; - } - - /** - * @see org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#getMemorySpaces(java.lang.Object, org.eclipse.cdt.debug.internal.core.model.provisional.IRequestListener) - */ - @Override - public void getMemorySpaces(final Object context, GetMemorySpacesRequest request) { - // We're not very asynchronous in CDI. DSF is another story. Also, note - // that we ignore the context. That's because we know that there's only - // one instance of this object per process object, and all elements of - // the project object (process, threads, frames) will have the same - // memory spaces - request.setMemorySpaces(getMemorySpaces()); - request.done(); - } - - /** - * This variant is called by code that is CDI-specific. This method and its - * uses predate the introduction of the DSF/CDI-agnostic - * IMemorySpaceAwareMemoryBlockRetrieval - * - * @return the memory spaces available in this debug session - */ - public String [] getMemorySpaces(){ - if (fDebugTarget != null) { - ICDITarget cdiTarget = fDebugTarget.getCDITarget(); - if (cdiTarget instanceof ICDIMemorySpaceManagement) - return ((ICDIMemorySpaceManagement)cdiTarget).getMemorySpaces(); - } - - return new String[0]; - } - - /** - * The default encoding of an {expression, memory space ID} pair into a - * string. A CDI client can provide custom decoding by implementing - * ICDIMemorySpaceEncoder - */ - public static String encodeAddressDefault(String expression, String memorySpaceID) { - return memorySpaceID + ':' + expression; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#encodeAddress(java.math.BigInteger, java.lang.String) - */ - @Override - public String encodeAddress(final String expression, final String memorySpaceID) { - // See if the CDI client provides customized encoding/decoding - if (fDebugTarget != null) { - ICDITarget cdiTarget = fDebugTarget.getCDITarget(); - if (cdiTarget instanceof ICDIMemorySpaceEncoder) { - return ((ICDIMemorySpaceEncoder)cdiTarget).encodeAddress(expression, memorySpaceID); - } - } - - // Nope; use default encoding - return encodeAddressDefault(expression, memorySpaceID); - } - - /* - * The default decoding of a string into an {expression, memory space ID} - * pair. A CDI client can provide custom decoding by implementing ICDIMemorySpaceEncoder - */ - public static DecodeResult decodeAddressDefault(String str) throws CoreException { - int index = str.lastIndexOf(':'); - - // minimum is "<space>:<expression>" - if ((index == -1) || (index == str.length()-1)) { - IStatus s = new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), - CDebugCorePlugin.INTERNAL_ERROR, - InternalDebugCoreMessages.CMemoryBlockRetrievalExtension_invalid_encoded_address, null); - throw new CoreException( s ); - } - - final String memorySpaceID = str.substring(0, index); - final String expression = str.substring(index+1); - - return new DecodeResult() { - @Override - public String getMemorySpaceId() { return memorySpaceID; } - @Override - public String getExpression() { return expression; } - }; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#decodeAddress(java.lang.String, java.lang.StringBuffer) - */ - @Override - public DecodeResult decodeAddress(final String str) throws CoreException { - - // See if the CDI client provides customized encoding/decoding - if (fDebugTarget != null) { - ICDITarget cdiTarget = fDebugTarget.getCDITarget(); - if (cdiTarget instanceof ICDIMemorySpaceEncoder) { - try { - final ICDIMemorySpaceEncoder.DecodeResult result = ((ICDIMemorySpaceEncoder)cdiTarget).decodeAddress(str); - return new DecodeResult() { - @Override - public String getMemorySpaceId() { return result.getMemorySpaceId(); } - @Override - public String getExpression() { return result.getExpression(); } - }; - } - catch (CDIException exc) { - IStatus s = new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, InternalDebugCoreMessages.CMemoryBlockRetrievalExtension_invalid_encoded_address, exc); - throw new CoreException(s); - - } - } - } - - // Nope; use default decoding - return decodeAddressDefault(str); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#creatingBlockRequiresMemorySpaceID() - */ - @Override - public boolean creatingBlockRequiresMemorySpaceID() { - // A behavioral control we're not extending to CDI clients, but is being - // extended to DSF ones. - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CRegisterManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CRegisterManager.java deleted file mode 100644 index cc1d7ced85f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CRegisterManager.java +++ /dev/null @@ -1,381 +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.internal.core; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -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.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup; -import org.eclipse.cdt.debug.core.model.IRegisterDescriptor; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.CRegisterDescriptor; -import org.eclipse.cdt.debug.internal.core.model.CRegisterGroup; -import org.eclipse.cdt.debug.internal.core.model.CStackFrame; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * Manages all register groups in a debug target. - */ -public class CRegisterManager { - - private static final String ELEMENT_REGISTER_GROUP_LIST = "registerGroups"; //$NON-NLS-1$ - private static final String ELEMENT_REGISTER_GROUP = "group"; //$NON-NLS-1$ - private static final String ATTR_REGISTER_GROUP_MEMENTO = "memento"; //$NON-NLS-1$ - - /** - * The debug target associated with this manager. - */ - private CDebugTarget fDebugTarget; - - /** - * Collection of register groups added to this target. Values are of type <code>CRegisterGroup</code>. - */ - protected List fRegisterGroups; - - /** - * The list of all register descriptors. - */ - private IRegisterDescriptor[] fRegisterDescriptors; - - private boolean fUseDefaultRegisterGroups = true; - - private CStackFrame fCurrentFrame; - - private ReentrantLock fInitializationLock = new ReentrantLock(); - - private boolean fInitialized = false; - - /** - * Constructor for CRegisterManager. - */ - public CRegisterManager( CDebugTarget target ) { - fDebugTarget = target; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter( Class adapter ) { - if ( CRegisterManager.class.equals( adapter ) ) - return this; - return null; - } - - public void dispose() { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - @Override - public void run() { - synchronized( fRegisterGroups ) { - Iterator it = fRegisterGroups.iterator(); - while( it.hasNext() ) { - ((CRegisterGroup)it.next()).dispose(); - } - fRegisterGroups.clear(); - } - } - } ); - } - - public IRegisterDescriptor[] getAllRegisterDescriptors() throws DebugException { - return fRegisterDescriptors; - } - - public IRegisterGroup[] getRegisterGroups() { - return (IRegisterGroup[])fRegisterGroups.toArray( new IRegisterGroup[fRegisterGroups.size()] ); - } - - public IRegisterGroup[] getRegisterGroups( CStackFrame frame ) throws DebugException { - setCurrentFrame( frame ); - return getRegisterGroups(); - } - - public void setCurrentFrame( ICStackFrame frame ) throws DebugException { - if ( frame != null && !frame.equals( getCurrentFrame() ) ) { - for ( IRegisterGroup group : getRegisterGroups() ) { - ((CRegisterGroup)group).resetRegisterValues(); - } - setCurrentFrame0( (CStackFrame)frame ); - } - } - - public void initialize() { - if ( !fInitialized ) { - synchronized( fInitializationLock ) { - if ( !fInitialized ) { - boolean failed = false; - ICDIRegisterGroup[] groups = new ICDIRegisterGroup[0]; - try { - groups = getDebugTarget().getCDITarget().getRegisterGroups(); - } - catch( CDIException e ) { - CDebugCorePlugin.log( e ); - failed = true; - } - List<CRegisterDescriptor> list = new ArrayList<CRegisterDescriptor>(); - for( int i = 0; i < groups.length; ++i ) { - try { - ICDIRegisterDescriptor[] cdiDescriptors = groups[i].getRegisterDescriptors(); - for ( int j = 0; j < cdiDescriptors.length; ++j ) { - list.add( new CRegisterDescriptor( groups[i], cdiDescriptors[j] ) ); - } - } - catch( CDIException e ) { - CDebugCorePlugin.log( e ); - failed = true; - } - } - fRegisterDescriptors = list.toArray( new IRegisterDescriptor[list.size()] ); - fInitialized = !failed; - if ( failed ) - fRegisterGroups = Collections.emptyList(); - else - createRegisterGroups(); - } - } - } - } - - public void addRegisterGroup( final String name, final IRegisterDescriptor[] descriptors ) { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - @Override - public void run() { - fRegisterGroups.add( new CRegisterGroup( getDebugTarget(), name, descriptors ) ); - setUseDefaultRegisterGroups( false ); - getDebugTarget().fireChangeEvent( DebugEvent.CONTENT ); - } - } ); - } - - public void removeAllRegisterGroups() { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - @Override - public void run() { - synchronized( fRegisterGroups ) { - Iterator it = fRegisterGroups.iterator(); - while( it.hasNext() ) { - ((CRegisterGroup)it.next()).dispose(); - } - fRegisterGroups.clear(); - } - setUseDefaultRegisterGroups( false ); - getDebugTarget().fireChangeEvent( DebugEvent.CONTENT ); - } - } ); - } - - public void removeRegisterGroups( final IRegisterGroup[] groups ) { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - @Override - public void run() { - for ( int i = 0; i < groups.length; ++i ) { - ((CRegisterGroup)groups[i]).dispose(); - } - fRegisterGroups.removeAll( Arrays.asList( groups ) ); - setUseDefaultRegisterGroups( false ); - getDebugTarget().fireChangeEvent( DebugEvent.CONTENT ); - } - } ); - } - - public void restoreDefaults() { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - @Override - public void run() { - synchronized( fRegisterGroups ) { - Iterator it = fRegisterGroups.iterator(); - while( it.hasNext() ) { - ((CRegisterGroup)it.next()).dispose(); - } - fRegisterGroups.clear(); - initializeDefaults(); - } - getDebugTarget().fireChangeEvent( DebugEvent.CONTENT ); - } - } ); - } - - private void createRegisterGroups() { - fRegisterGroups = Collections.synchronizedList( new ArrayList( 20 ) ); - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - String memento = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_REGISTER_GROUPS, "" ); //$NON-NLS-1$ - if ( memento != null && memento.length() > 0 ) { - initializeFromMemento( memento ); - return; - } - } - catch( CoreException e ) { - } - initializeDefaults(); - } - - public void targetSuspended() { - Iterator it = fRegisterGroups.iterator(); - while( it.hasNext() ) { - ((CRegisterGroup)it.next()).targetSuspended(); - } - } - - public CDebugTarget getDebugTarget() { - return fDebugTarget; - } - - private void initializeFromMemento( String memento ) throws CoreException { - Node node = DebugPlugin.parseDocument( memento ); - if ( node.getNodeType() != Node.ELEMENT_NODE ) { - abort(InternalDebugCoreMessages.CRegisterManager_0, null); - } - Element element = (Element)node; - if ( !ELEMENT_REGISTER_GROUP_LIST.equals( element.getNodeName() ) ) { - abort(InternalDebugCoreMessages.CRegisterManager_1, null); - } - Node childNode = element.getFirstChild(); - while( childNode != null ) { - if ( childNode.getNodeType() == Node.ELEMENT_NODE ) { - Element child = (Element)childNode; - if ( ELEMENT_REGISTER_GROUP.equals( child.getNodeName() ) ) { - String groupMemento = child.getAttribute( ATTR_REGISTER_GROUP_MEMENTO ); - CRegisterGroup group = new CRegisterGroup( getDebugTarget() ); - try { - group.initializeFromMemento( groupMemento ); - doAddRegisterGroup( group ); - } - catch( CoreException e ) { - // skip this group - } - } - } - childNode = childNode.getNextSibling(); - } - setUseDefaultRegisterGroups( false ); - } - - protected void initializeDefaults() { - setUseDefaultRegisterGroups( true ); - String current = null; - int startIndex = 0; - for ( int i = 0; i < fRegisterDescriptors.length; ++i ) { - CRegisterDescriptor d = (CRegisterDescriptor)fRegisterDescriptors[i]; - if ( current != null && d.getGroupName().compareTo( current ) != 0 ) { - IRegisterDescriptor[] descriptors = new IRegisterDescriptor[i - startIndex]; - System.arraycopy( fRegisterDescriptors, startIndex, descriptors, 0, descriptors.length ); - fRegisterGroups.add( new CRegisterGroup( getDebugTarget(), current, descriptors ) ); - startIndex = i; - } - current = d.getGroupName(); - } - if ( startIndex < fRegisterDescriptors.length ) { - IRegisterDescriptor[] descriptors = new IRegisterDescriptor[fRegisterDescriptors.length - startIndex]; - System.arraycopy( fRegisterDescriptors, startIndex, descriptors, 0, descriptors.length ); - fRegisterGroups.add( new CRegisterGroup( getDebugTarget(), current, descriptors ) ); - } - } - - protected synchronized void doAddRegisterGroup( IRegisterGroup group ) { - fRegisterGroups.add( group ); - } - - public void save() { - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_REGISTER_GROUPS, getMemento() ); - wc.doSave(); - } - catch( CoreException e ) { - CDebugCorePlugin.log( e ); - } - } - - private String getMemento() throws CoreException { - if ( useDefaultRegisterGroups() || fRegisterGroups == null ) - return ""; //$NON-NLS-1$ - Document document = DebugPlugin.newDocument(); - Element element = document.createElement( ELEMENT_REGISTER_GROUP_LIST ); - Iterator it = fRegisterGroups.iterator(); - while( it.hasNext() ) { - CRegisterGroup group = (CRegisterGroup)it.next(); - Element child = document.createElement( ELEMENT_REGISTER_GROUP ); - child.setAttribute( ATTR_REGISTER_GROUP_MEMENTO, group.getMemento() ); - element.appendChild( child ); - } - document.appendChild( element ); - return DebugPlugin.serializeDocument( document ); - } - - private void abort( String message, Throwable exception ) throws CoreException { - IStatus status = new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, message, exception ); - throw new CoreException( status ); - } - - public IRegisterDescriptor findDescriptor( String groupName, String name ) { - for ( int i = 0; i < fRegisterDescriptors.length; ++i ) { - IRegisterDescriptor d = fRegisterDescriptors[i]; - if ( groupName.equals( d.getGroupName() ) && name.equals( d.getName() ) ) - return d; - } - return null; - } - - public void modifyRegisterGroup( final IPersistableRegisterGroup group, final IRegisterDescriptor[] descriptors ) { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - @Override - public void run() { - group.setRegisterDescriptors( descriptors ); - ((CRegisterGroup)group).fireChangeEvent( DebugEvent.CONTENT ); - } - } ); - - } - - protected boolean useDefaultRegisterGroups() { - return fUseDefaultRegisterGroups; - } - - protected void setUseDefaultRegisterGroups( boolean useDefaultRegisterGroups ) { - fUseDefaultRegisterGroups = useDefaultRegisterGroups; - } - - public CStackFrame getCurrentFrame() { - return fCurrentFrame; - } - - private void setCurrentFrame0( CStackFrame currentFrame ) { - fCurrentFrame = currentFrame; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CSettingsManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CSettingsManager.java deleted file mode 100644 index c833a098d21..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CSettingsManager.java +++ /dev/null @@ -1,268 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.internal.core; - -import java.io.IOException; -import java.io.StringReader; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; - -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.model.IDebugTarget; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * Settings manager - * - * The settings manager stores a set of settings, - * (key/value) pairs in the launch configuration so they exist across debug sessions. - * - * All active settings are stored together in a single configuration entry - * (ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_FORMAT). - * - * Every setting is identified by a string identifier. That string identifier can be used to - * store an additional setting, to remove an exiting one or to retrieve a previously stored setting. - * - * The setting value consists of a String. - * - * Settings fade out automatically so clients do not necessarily need to delete old settings. This makes it - * possible to build the string identifiers with names out of the user application, like function names or - * variable names, without the danger of a constantly growing launch configuration. - * However it also causes that the settings manager must only be used for configurations and customizations for which - * always reasonable defaults exist. - * - * As cleanup policy the settings manager only keeps a certain number of settings and drops the - * least recently used one when more settings are added. The least recently used order is maintained - * across debug sessions. - * - */ - -public class CSettingsManager { - - /** - * the name of the XML node for the list - */ - private static final String CONTENT_LIST = "contentList"; //$NON-NLS-1$ - - /** - * the name of the XML node for every format entry - */ - private static final String CONTENT = "content"; //$NON-NLS-1$ - - /** - * the attribute name used to identify the object to store the content for. - */ - private static final String ATTR_CONTENT_ID = "id"; //$NON-NLS-1$ - - /** - * the attribute name of the actual content - */ - private static final String ATTR_CONTENT_VALUE = "val"; //$NON-NLS-1$ - - /** - * Number defining how many settings are stored. - * Whenever an additional setting is added when there are already MAX_USED_COUNT settings, the - * least recently used setting is dropped. - * - * The actual value is chosen to be high enough for normal use cases, but still low enough to avoid that the launch configuration - * gets arbitrarily large - */ - private static int MAX_ELEMENT_COUNT = 100; - - /** - * the map used to actually store the format information - * as key String are used, values are of type String too. - * - * The map automatically is limited to MAX_ELEMENT_COUNT - * elements, dropping the least recently used one - * when more elements are added. - */ - private Map fContentMap = new LinkedHashMap(MAX_ELEMENT_COUNT, 0.75f, true) { - private static final long serialVersionUID = 1; - @Override - protected boolean removeEldestEntry(Map.Entry eldest) { - return size() > MAX_ELEMENT_COUNT; - } - }; - - /** - * the debug target we store the values for - */ - private CDebugTarget fDebugTarget; - - /** - * Store the value for the given id. - * @param id used to identify the information. Different objects/topics should use different identifiers. - * @param value content to be stored - */ - public synchronized void putValue( String id, String value ) { - fContentMap.put(id, value); - } - /** - * remove the stored format for the given id. - * @param id used to identify the formatting information. Different objects/topics should use different identifiers. - */ - public synchronized void removeValue( String id ) { - fContentMap.remove( id ); - } - - /** Retrieve the value for the given id. - * @param id used to identify the formatting information. Different objects/topics should use different identifiers. - * @return returns the entry information for the given id, or null if no such information is available. - */ - public synchronized String getValue( String id ) { - String entry= (String) fContentMap.get( id ); - return entry; - } - - /** constructor. - * @param debugTarget - */ - public CSettingsManager( CDebugTarget debugTarget ) { - fDebugTarget = debugTarget; - initialize(); - } - - /** get the string format of the current content. - * Only stores entries which have been used in the last MAX_USED_COUNT debug sessions. - * @return - */ - private String getMemento() { - Document document = null; - try { - document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - Element node = document.createElement( CONTENT_LIST ); - document.appendChild( node ); - Set entrySet = fContentMap.entrySet(); - Iterator it = entrySet.iterator(); - while ( it.hasNext() ) { - Map.Entry entry= (Map.Entry) it.next(); - String id= (String)entry.getKey(); - String value= (String)entry.getValue(); - Element child = document.createElement( CONTENT ); - child.setAttribute( ATTR_CONTENT_ID, id ); - child.setAttribute( ATTR_CONTENT_VALUE, value ); - node.appendChild( child ); - } - return CDebugUtils.serializeDocument( document, false ); - } - catch( ParserConfigurationException e ) { - DebugPlugin.log( e ); - } - catch( IOException e ) { - DebugPlugin.log( e ); - } - catch( TransformerException e ) { - DebugPlugin.log( e ); - } - return null; - } - - /** set the current state to the one given by the memento. - * @param memento a string representation of the state to be loaded. - * @throws CoreException - */ - private void initializeFromMemento( String memento ) throws CoreException { - try { - fContentMap.clear(); - DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - StringReader reader = new StringReader( memento ); - InputSource source = new InputSource( reader ); - Element root = parser.parse( source ).getDocumentElement(); - if ( root.getNodeName().equalsIgnoreCase( CONTENT_LIST ) ) { - NodeList list = root.getChildNodes(); - int i = list.getLength() - 1; // backwards to keep least recent access order. - for( ; i >= 0; i-- ) { - Node node = list.item( i ); - short type = node.getNodeType(); - if ( type == Node.ELEMENT_NODE ) { - Element elem = (Element)node; - if ( elem.getNodeName().equalsIgnoreCase( CONTENT ) ) { - String id = elem.getAttribute( ATTR_CONTENT_ID ); - String value= elem.getAttribute( ATTR_CONTENT_VALUE ); - if ( id == null || id.length() == 0 ) { - DebugPlugin.logMessage( "unexpected entry in CSettingsManager.initializeFromMemento", null ); //$NON-NLS-1$ - continue; - } - putValue( id, value ); - } - } - } - return; - } - DebugPlugin.logMessage( "unexpected content", null ); //$NON-NLS-1$ - } - catch( ParserConfigurationException e ) { - DebugPlugin.log( e ); - } - catch( SAXException e ) { - DebugPlugin.log( e ); - } - catch( IOException e ) { - DebugPlugin.log( e ); - } - } - - /** - * read the stored format from the launch configuration - */ - private void initialize() { - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - String memento = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_FORMAT, "" ); //$NON-NLS-1$ - if ( memento != null && memento.trim().length() != 0 ) - initializeFromMemento( memento ); - } - catch( CoreException e ) { - DebugPlugin.log( e ); - } - } - - /** - * store the current content in the launch configuration. - */ - public synchronized void save() { - ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration(); - try { - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_FORMAT, getMemento() ); - wc.doSave(); - } - catch( CoreException e ) { - DebugPlugin.log( e ); - } - } - - /** - * accessor to the debug target - */ - IDebugTarget getDebugTarget() { - return fDebugTarget; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CSignalManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CSignalManager.java deleted file mode 100644 index 1326eefebd6..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CSignalManager.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 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core; - -import java.util.ArrayList; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.core.model.ICSignal; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.CSignal; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; - -/** - * Manages the collection of signals on a debug target. - */ -public class CSignalManager implements IAdaptable { - - /** - * The debug target associated with this manager. - */ - private CDebugTarget fDebugTarget; - - /** - * The list of signals. - */ - private ICSignal[] fSignals = null; - - /** - * The dispose flag. - */ - private boolean fIsDisposed = false; - - /** - * Constructor for CSignalManager. - */ - public CSignalManager( CDebugTarget target ) { - fDebugTarget = target; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICSignalManager#getSignals() - */ - public ICSignal[] getSignals() throws DebugException { - if ( !isDisposed() && fSignals == null ) { - try { - ICDISignal[] cdiSignals = getDebugTarget().getCDITarget().getSignals(); - ArrayList list = new ArrayList( cdiSignals.length ); - for( int i = 0; i < cdiSignals.length; ++i ) { - list.add( new CSignal( getDebugTarget(), cdiSignals[i] ) ); - } - fSignals = (ICSignal[])list.toArray( new ICSignal[list.size()] ); - } - catch( CDIException e ) { - throwDebugException( e.getMessage(), DebugException.TARGET_REQUEST_FAILED, e ); - } - } - return (fSignals != null) ? fSignals : new ICSignal[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.CUpdateManager#dispose() - */ - public void dispose() { - if ( fSignals != null ) - for( int i = 0; i < fSignals.length; ++i ) { - ((CSignal)fSignals[i]).dispose(); - } - fSignals = null; - fIsDisposed = true; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( adapter.equals( CSignalManager.class ) ) { - return this; - } - if ( adapter.equals( CDebugTarget.class ) ) { - return getDebugTarget(); - } - return null; - } - - public void signalChanged( ICDISignal cdiSignal ) { - CSignal signal = find( cdiSignal ); - if ( signal != null ) { - signal.fireChangeEvent( DebugEvent.STATE ); - } - } - - private CSignal find( ICDISignal cdiSignal ) { - try { - ICSignal[] signals = getSignals(); - for( int i = 0; i < signals.length; ++i ) - if ( signals[i].getName().equals( cdiSignal.getName() ) ) - return (CSignal)signals[i]; - } - catch( DebugException e ) { - } - return null; - } - - protected boolean isDisposed() { - return fIsDisposed; - } - - /** - * Throws a debug exception with the given message, error code, and underlying exception. - */ - protected void throwDebugException( String message, int code, Throwable exception ) throws DebugException { - throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), code, message, exception ) ); - } - - protected CDebugTarget getDebugTarget() { - return fDebugTarget; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java deleted file mode 100644 index 321256d94da..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java +++ /dev/null @@ -1,190 +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.internal.core; - -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.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDIDebugger; -import org.eclipse.cdt.debug.core.ICDebugConfiguration; -import org.eclipse.cdt.debug.core.ICDebugger; -import org.eclipse.cdt.utils.Platform; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - - - -public class DebugConfiguration implements ICDebugConfiguration { - /** - * The configuration element of the extension. - */ - private IConfigurationElement fElement; - private HashSet fModes; - private HashSet fCPUs; - private String[] fCoreExt; - - public DebugConfiguration(IConfigurationElement element) { - fElement = element; - } - - private IConfigurationElement getConfigurationElement() { - return fElement; - } - - @Override - public ICDebugger getDebugger() throws CoreException { - Object debugger = getConfigurationElement().createExecutableExtension("class"); //$NON-NLS-1$ - if (debugger instanceof ICDebugger) { - return (ICDebugger)debugger; - } - throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, - InternalDebugCoreMessages.DebugConfiguration_0, null)); - } - - @Override - public ICDIDebugger createDebugger() throws CoreException { - Object debugger = getConfigurationElement().createExecutableExtension("class"); //$NON-NLS-1$ - if (debugger instanceof ICDIDebugger) { - return (ICDIDebugger)debugger; - } - return new CDebugAdapter((ICDebugger)debugger); - } - - @Override - public String getName() { - String name = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$ - return name != null ? name : ""; //$NON-NLS-1$ - } - - @Override - public String getID() { - return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$ - } - - @Override - public String getPlatform() { - String platform = getConfigurationElement().getAttribute("platform"); //$NON-NLS-1$ - if (platform == null) { - return "*"; //$NON-NLS-1$ - } - return platform; - } - - @Override - public String[] getCPUList() { - return (String[]) getCPUs().toArray(new String[0]); - } - - @Override - public String[] getModeList() { - return (String[]) getModes().toArray(new String[0]); - } - - @Override - public boolean supportsMode(String mode) { - return getModes().contains(mode); - } - - @Override - public boolean supportsCPU(String cpu) { - String nativeCPU = Platform.getOSArch(); - boolean ret = false; - if (nativeCPU.startsWith(cpu) - || nativeCPU.equalsIgnoreCase("powerpc") //$NON-NLS-1$ - && (cpu.equalsIgnoreCase("ppc") //$NON-NLS-1$ - || cpu.equalsIgnoreCase("xcoff32") || cpu //$NON-NLS-1$ - .equalsIgnoreCase("xcoff64"))) { //$NON-NLS-1$ - ret = getCPUs().contains(CPU_NATIVE); - } - return ret || getCPUs().contains(cpu) || getCPUs().contains("*"); //$NON-NLS-1$ - } - /** - * Returns the set of modes specified in the configuration data. - * - * @return the set of modes specified in the configuration data - */ - protected Set getModes() { - if (fModes == null) { - String modes = getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$ - if (modes == null) { - return new HashSet(0); - } - StringTokenizer tokenizer = new StringTokenizer(modes, ","); //$NON-NLS-1$ - fModes = new HashSet(tokenizer.countTokens()); - while (tokenizer.hasMoreTokens()) { - fModes.add(tokenizer.nextToken().trim()); - } - } - return fModes; - } - - protected Set getCPUs() { - if (fCPUs == null) { - String cpus = getConfigurationElement().getAttribute("cpu"); //$NON-NLS-1$ - if (cpus == null) { - fCPUs = new HashSet(1); - fCPUs.add(CPU_NATIVE); - } - else { - String nativeCPU = Platform.getOSArch(); - StringTokenizer tokenizer = new StringTokenizer(cpus, ","); //$NON-NLS-1$ - fCPUs = new HashSet(tokenizer.countTokens()); - while (tokenizer.hasMoreTokens()) { - String cpu = tokenizer.nextToken().trim(); - fCPUs.add(cpu); - if (nativeCPU.startsWith(cpu)) { // os arch be cpu{le/be} - fCPUs.add(CPU_NATIVE); - } - } - } - } - return fCPUs; - } - - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICDebugConfiguration#getCoreFileExtensions() - */ - @Override - public String[] getCoreFileExtensions() { - if (fCoreExt == null) { - List exts = new ArrayList(); - String cexts = getConfigurationElement().getAttribute("coreFileFilter"); //$NON-NLS-1$ - if (cexts != null) { - StringTokenizer tokenizer = new StringTokenizer(cexts, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) { - String ext = tokenizer.nextToken().trim(); - exts.add(ext); - } - } - exts.add("*"); //$NON-NLS-1$ - fCoreExt = (String[])exts.toArray(new String[exts.size()]); - } - return fCoreExt; - } - - @Override - public String[] getSupportedBuildConfigPatterns() { - IConfigurationElement[] patternElems = fElement.getChildren("buildIdPattern"); //$NON-NLS-1$ - String[] patterns = new String[patternElems.length]; - for (int i = 0; i < patternElems.length; ++i) { - patterns[i] = patternElems[i].getAttribute("pattern"); //$NON-NLS-1$ - } - return patterns; - } - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/SessionManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/SessionManager.java deleted file mode 100644 index df341b2f776..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/SessionManager.java +++ /dev/null @@ -1,81 +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.internal.core; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -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.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IDebugTarget; - -/** - * Default implementation of the session manager. Terminates the session when the last target is terminated; - */ -public class SessionManager implements IDebugEventSetListener { - - public SessionManager() { - DebugPlugin.getDefault().addDebugEventListener( this ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter( Class adapter ) { - if ( SessionManager.class.equals( adapter ) ) - return this; - return null; - } - - public void dispose() { - DebugPlugin.getDefault().removeDebugEventListener( this ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) - */ - @Override - public void handleDebugEvents( DebugEvent[] events ) { - for( int i = 0; i < events.length; i++ ) { - DebugEvent event = events[i]; - if ( event.getKind() == DebugEvent.TERMINATE ) { - Object element = event.getSource(); - if ( element instanceof IDebugTarget && ((IDebugTarget)element).getAdapter( ICDITarget.class ) != null ) { - handleTerminateEvent( ((IDebugTarget)element).getLaunch(), ((IDebugTarget)element).getAdapter( ICDITarget.class ).getSession() ); - } - } - } - } - - private void handleTerminateEvent( ILaunch launch, ICDISession session ) { - IDebugTarget[] targets = launch.getDebugTargets(); - boolean terminate = true; - for( int i = 0; i < targets.length; ++i ) { - if ( targets[i].getAdapter( ICDITarget.class ) != null && session.equals( targets[i].getAdapter( ICDITarget.class ).getSession() ) && !targets[i].isTerminated() && !targets[i].isDisconnected() ) - terminate = false; - } - if ( terminate ) { - try { - session.terminate(); - } - catch( CDIException e ) { - CDebugCorePlugin.log( e ); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpointFilterExtension.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpointFilterExtension.java deleted file mode 100644 index 608ba1bbfbe..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpointFilterExtension.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.breakpoints; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointFilterExtension; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IDebugTarget; - -/** - * - */ -public class CBreakpointFilterExtension implements ICBreakpointFilterExtension { - - @Override - public void initialize(ICBreakpoint breakpoint) { - } - - private Map fFilteredThreadsByTarget = new HashMap( 10 ); - - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getTargetFilters() - */ - @Override - public ICDebugTarget[] getTargetFilters() throws CoreException { - Set set = fFilteredThreadsByTarget.keySet(); - return (ICDebugTarget[])set.toArray( new ICDebugTarget[set.size()] ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getThreadFilters(org.eclipse.cdt.debug.core.model.ICDebugTarget) - */ - @Override - public ICThread[] getThreadFilters( ICDebugTarget target ) throws CoreException { - Set set = (Set)fFilteredThreadsByTarget.get( target ); - return ( set != null ) ? (ICThread[])set.toArray( new ICThread[set.size()] ) : null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#removeTargetFilter(org.eclipse.cdt.debug.core.model.ICDebugTarget) - */ - @Override - public void removeTargetFilter( ICDebugTarget target ) throws CoreException { - if ( fFilteredThreadsByTarget.containsKey( target ) ) { - fFilteredThreadsByTarget.remove( target ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#removeThreadFilters(org.eclipse.cdt.debug.core.model.ICThread[]) - */ - @Override - public void removeThreadFilters( ICThread[] threads ) throws CoreException { - if ( threads != null && threads.length > 0 ) { - IDebugTarget target = threads[0].getDebugTarget(); - if ( fFilteredThreadsByTarget.containsKey( target ) ) { - Set set = (Set)fFilteredThreadsByTarget.get( target ); - if ( set != null ) { - set.removeAll( Arrays.asList( threads ) ); - if ( set.isEmpty() ) { - fFilteredThreadsByTarget.remove( target ); - } - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setTargetFilter(org.eclipse.cdt.debug.core.model.ICDebugTarget) - */ - @Override - public void setTargetFilter( ICDebugTarget target ) throws CoreException { - fFilteredThreadsByTarget.put( target, null ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setThreadFilters(org.eclipse.cdt.debug.core.model.ICThread[]) - */ - @Override - public void setThreadFilters( ICThread[] threads ) throws CoreException { - if ( threads != null && threads.length > 0 ) { - fFilteredThreadsByTarget.put( threads[0].getDebugTarget(), new HashSet( Arrays.asList( threads ) ) ); - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AbstractCValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AbstractCValue.java deleted file mode 100644 index 1147e964ece..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AbstractCValue.java +++ /dev/null @@ -1,66 +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.internal.core.model; - -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.debug.core.DebugException; - -/** - * The abstract super class for the C/C++ value types. - */ -public abstract class AbstractCValue extends CDebugElement implements ICValue { - - /** - * Parent variable. - */ - private AbstractCVariable fParent = null; - - /** - * Constructor for AbstractCValue. - */ - public AbstractCValue( AbstractCVariable parent ) { - super( (CDebugTarget)parent.getDebugTarget() ); - fParent = parent; - } - - public AbstractCVariable getParentVariable() { - return fParent; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICValue#evaluateAsExpression(org.eclipse.cdt.debug.core.model.ICStackFrame) - */ - @Override - public String evaluateAsExpression( ICStackFrame frame ) { - String valueString = ""; //$NON-NLS-1$ - AbstractCVariable parent = getParentVariable(); - if ( parent != null ) { - if ( frame != null && frame.canEvaluate() ) { - try { - valueString = frame.evaluateExpressionToString( parent.getExpressionString() ); - } - catch( DebugException e ) { - valueString = e.getMessage(); - } - } - } - return valueString; - } - - abstract protected void setChanged( boolean changed ); - - abstract public void dispose(); - - abstract protected void reset(); - - abstract protected void preserve(); -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AbstractCVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AbstractCVariable.java deleted file mode 100644 index b68d61fb821..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AbstractCVariable.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.internal.core.model; - -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.cdt.debug.core.model.IEnableDisableTarget; - -/** - * The super class for all variable types. - */ -public abstract class AbstractCVariable extends CDebugElement implements ICVariable { - - /** - * The parent object this variable is contained in. - */ - private CDebugElement fParent; - - /** - * Constructor for AbstractCVariable. - */ - public AbstractCVariable( CDebugElement parent ) { - super( (CDebugTarget)parent.getDebugTarget() ); - setParent( parent ); - } - - protected CDebugElement getParent() { - return fParent; - } - - private void setParent( CDebugElement parent ) { - fParent = parent; - } - - protected ICStackFrame getStackFrame() { - CDebugElement parent = getParent(); - if ( parent instanceof AbstractCValue ) { - AbstractCVariable pv = ((AbstractCValue)parent).getParentVariable(); - if ( pv != null ) - return pv.getStackFrame(); - } - if ( parent instanceof CStackFrame ) - return (CStackFrame)parent; - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( IEnableDisableTarget.class.equals( adapter ) ) - return this; - return super.getAdapter( adapter ); - } - - public abstract void dispose(); - - protected abstract void resetValue(); - - protected abstract void setChanged( boolean changed ); - - protected abstract void preserve(); -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java deleted file mode 100644 index c2a386120dd..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java +++ /dev/null @@ -1,82 +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.internal.core.model; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.model.IAsmInstruction; - -/** - * Adapter for ICDIInstruction. - */ -public class AsmInstruction implements IAsmInstruction { - - private ICDIInstruction fCDIInstruction; - - private IAddress fAddress; - - /** - * Constructor for AsmInstruction. - */ - public AsmInstruction( IAddressFactory factory, ICDIInstruction cdiInstruction ) { - fCDIInstruction = cdiInstruction; - fAddress = factory.createAddress( cdiInstruction.getAdress() ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress() - */ - @Override - public IAddress getAdress() { - return fAddress; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getFunctionName() - */ - @Override - public String getFunctionName() { - return fCDIInstruction.getFuntionName(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getInstructionText() - */ - @Override - public String getInstructionText() { - return fCDIInstruction.getInstruction(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getOpcode() - */ - @Override - public String getOpcode() { - return fCDIInstruction.getOpcode(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getArguments() - */ - @Override - public String getArguments() { - return fCDIInstruction.getArgs(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getOffset() - */ - @Override - public long getOffset() { - return fCDIInstruction.getOffset(); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java deleted file mode 100644 index 0065605b923..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java +++ /dev/null @@ -1,68 +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.internal.core.model; - -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.model.IAsmInstruction; -import org.eclipse.cdt.debug.core.model.IAsmSourceLine; - -/** - * Adapter for ICDIMixedInstruction. - */ -public class AsmSourceLine implements IAsmSourceLine { - - private String fText; - - private IAsmInstruction[] fInstructions = null; - - private int fLineNumber; - - /** - * Constructor for AsmSourceLine. - */ - public AsmSourceLine( IAddressFactory factory, String text, ICDIInstruction[] cdiInstructions ) { - this( factory, text, -1, cdiInstructions ); - } - - /** - * Constructor for AsmSourceLine. - */ - public AsmSourceLine( IAddressFactory factory, String text, int lineNumber, ICDIInstruction[] cdiInstructions ) { - fText = text; - fLineNumber = lineNumber; - fInstructions = new IAsmInstruction[cdiInstructions.length]; - for ( int i = 0; i < fInstructions.length; ++i ) { - fInstructions[i] = new AsmInstruction( factory, cdiInstructions[i] ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmSourceLine#getLineNumber() - */ - @Override - public int getLineNumber() { - return fLineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmSourceLine#getInstructions() - */ - @Override - public IAsmInstruction[] getInstructions() { - return fInstructions; - } - - @Override - public String toString() { - return fText; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.java deleted file mode 100644 index 6dc83cfe94b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.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.internal.core.model; - -import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.model.CDebugElementState; -import org.eclipse.core.resources.IProject; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IProcess; - -/** - * A debug target for the postmortem debugging. - * @deprecated - */ -@Deprecated -public class CCoreFileDebugTarget extends CDebugTarget { - - - /** - * @param launch - * @param project - * @param cdiTarget - * @param name - * @param debuggeeProcess - * @param file - * @param allowsTerminate - * @param allowsDisconnect - */ - public CCoreFileDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget, String name, IProcess debuggeeProcess, IBinaryExecutable file) { - super(launch, project, cdiTarget, name, debuggeeProcess, file, false, false); - setState(CDebugElementState.TERMINATED); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#isPostMortem() - */ - @Override - public boolean isPostMortem() { - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugElement.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugElement.java deleted file mode 100644 index 0b8c684dbaa..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugElement.java +++ /dev/null @@ -1,398 +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 - * Ling Wang, Nokia - Bug 179425 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import com.ibm.icu.text.MessageFormat; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.CDebugUtils; -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.core.model.CDebugElementState; -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.IModuleRetrieval; -import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IMemoryBlockRetrieval; - -/** - * The super class of all C/C++ debug model elements. - */ -abstract public class CDebugElement extends PlatformObject implements ICDebugElement, ICDebugElementStatus { - - /** - * Debug target associated with this element - */ - private CDebugTarget fDebugTarget; - - /** - * The severity code of this element's status - */ - private int fSeverity = ICDebugElementStatus.OK; - - /** - * The message of this element's status - */ - private String fMessage = null; - - /** - * The current state of this element. - */ - private CDebugElementState fState = CDebugElementState.UNDEFINED; - - /** - * The previous state of this element. - */ - private CDebugElementState fOldState = CDebugElementState.UNDEFINED; - - /** - * The current state info. - */ - private Object fCurrentStateInfo = null; - - /** - * Constructor for CDebugElement. - */ - public CDebugElement( CDebugTarget target ) { - setDebugTarget( target ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() - */ - @Override - public String getModelIdentifier() { - return CDIDebugModel.getPluginIdentifier(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() - */ - @Override - public IDebugTarget getDebugTarget() { - return fDebugTarget; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() - */ - @Override - public ILaunch getLaunch() { - return getDebugTarget().getLaunch(); - } - - protected void setDebugTarget( CDebugTarget target ) { - fDebugTarget = target; - } - - /** - * Convenience method to log errors - */ - protected void logError( Exception e ) { - DebugPlugin.log( e ); - } - - /** - * Convenience method to log errors - * - */ - protected void logError( String message ) { - DebugPlugin.logMessage( message, null ); - } - - /** - * Fires a debug event - * - * @param event The debug event to be fired to the listeners - * @see org.eclipse.debug.core.DebugEvent - */ - protected void fireEvent( DebugEvent event ) { - DebugPlugin.getDefault().fireDebugEventSet( new DebugEvent[]{ event } ); - } - - protected void fireEventSet( DebugEvent[] events ) { - DebugPlugin.getDefault().fireDebugEventSet( events ); - } - - /** - * Fires a debug event marking the creation of this element. - */ - public void fireCreationEvent() { - fireEvent( new DebugEvent( this, DebugEvent.CREATE ) ); - } - - public DebugEvent createCreateEvent() { - return new DebugEvent( this, DebugEvent.CREATE ); - } - - /** - * Fires a debug event marking the RESUME of this element with the associated detail. - * - * @param detail The int detail of the event - * @see org.eclipse.debug.core.DebugEvent - */ - public void fireResumeEvent( int detail ) { - fireEvent( new DebugEvent( this, DebugEvent.RESUME, detail ) ); - } - - public DebugEvent createResumeEvent( int detail ) { - return new DebugEvent( this, DebugEvent.RESUME, detail ); - } - - /** - * Fires a debug event marking the SUSPEND of this element with the associated detail. - * - * @param detail The int detail of the event - * @see org.eclipse.debug.core.DebugEvent - */ - public void fireSuspendEvent( int detail ) { - fireEvent( new DebugEvent( this, DebugEvent.SUSPEND, detail ) ); - } - - public DebugEvent createSuspendEvent( int detail ) { - return new DebugEvent( this, DebugEvent.SUSPEND, detail ); - } - - /** - * Fires a debug event marking the termination of this element. - */ - public void fireTerminateEvent() { - fireEvent( new DebugEvent( this, DebugEvent.TERMINATE ) ); - } - - public DebugEvent createTerminateEvent() { - return new DebugEvent( this, DebugEvent.TERMINATE ); - } - - /** - * Fires a debug event marking the CHANGE of this element with the specifed detail code. - * - * @param detail - * one of <code>STATE</code> or <code>CONTENT</code> - */ - public void fireChangeEvent( int detail ) { - fireEvent( new DebugEvent( this, DebugEvent.CHANGE, detail ) ); - } - - public DebugEvent createChangeEvent( int detail ) { - return new DebugEvent( this, DebugEvent.CHANGE, detail ); - } - - /** - * Returns the CDI session associated with this element. - * - * @return the CDI session - */ - public ICDISession getCDISession() { - final ICDITarget cdiTarget = getCDITarget(); - return cdiTarget != null ? cdiTarget.getSession() : null; - } - - /** - * Returns the underlying CDI target associated with this element. - * - * @return the underlying CDI target - */ - public ICDITarget getCDITarget() { - return getDebugTarget().getAdapter( ICDITarget.class ); - } - - /** - * Throws a new debug exception with a status code of <code>REQUEST_FAILED</code>. - * - * @param message Failure message - * @param e Exception that has occurred (<code>can be null</code>) - * @throws DebugException The exception with a status code of <code>REQUEST_FAILED</code> - */ - public static void requestFailed( String message, Exception e ) throws DebugException { - requestFailed( message, e, DebugException.REQUEST_FAILED ); - } - - /** - * Throws a new debug exception with a status code of <code>TARGET_REQUEST_FAILED</code> with the given underlying exception. - * - * @param message Failure message - * @param e underlying exception that has occurred - * @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code> - */ - public static void targetRequestFailed( String message, CDIException e ) throws DebugException { - String format = "Target request failed: {0}"; //$NON-NLS-1$ - // Append a period only when incoming message does not end with one. - if ( !message.endsWith( "." ) ) //$NON-NLS-1$ - format += "."; //$NON-NLS-1$ - - requestFailed( MessageFormat.format( format, new String[] { message } ), e, DebugException.TARGET_REQUEST_FAILED ); - } - - /** - * Throws a new debug exception with the given status code. - * - * @param message Failure message - * @param e Exception that has occurred (<code>can be null</code>) - * @param code status code - * @throws DebugException a new exception with given status code - */ - public static void requestFailed( String message, Throwable e, int code ) throws DebugException { - throwDebugException( message, code, e ); - } - - /** - * Throws a new debug exception with a status code of <code>TARGET_REQUEST_FAILED</code>. - * - * @param message Failure message - * @param e Throwable that has occurred - * @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code> - */ - public static void targetRequestFailed( String message, Throwable e ) throws DebugException { - String format = "Target request failed: {0}"; //$NON-NLS-1$ - // Append a period only when incoming message does not end with one. - if ( !message.endsWith( "." ) ) //$NON-NLS-1$ - format += "."; //$NON-NLS-1$ - - throwDebugException( MessageFormat.format( format, new String[]{ message } ), DebugException.TARGET_REQUEST_FAILED, e ); - } - - /** - * Throws a new debug exception with a status code of <code>NOT_SUPPORTED</code>. - * - * @param message Failure message - * @throws DebugException The exception with a status code of <code>NOT_SUPPORTED</code>. - */ - public static void notSupported( String message ) throws DebugException { - throwDebugException( message, DebugException.NOT_SUPPORTED, null ); - } - - /** - * Throws a debug exception with the given message, error code, and underlying exception. - */ - protected static void throwDebugException( String message, int code, Throwable exception ) throws DebugException { - throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), code, message, exception ) ); - } - - protected void infoMessage( Throwable e ) { - IStatus newStatus = new Status( IStatus.INFO, CDebugCorePlugin.getUniqueIdentifier(), ICDebugInternalConstants.STATUS_CODE_INFO, e.getMessage(), null ); - CDebugUtils.info( newStatus, getDebugTarget() ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( adapter.equals( IDebugElement.class ) ) - return this; - if ( adapter.equals( ICDebugElement.class ) ) - return this; - if ( adapter.equals( CDebugElement.class ) ) - return this; - if ( adapter.equals( ICDebugElementStatus.class ) ) - return this; - if ( adapter.equals( ICDISession.class ) ) - return getCDISession(); - if ( adapter.equals( ICDebugTarget.class ) ) - return getDebugTarget(); - if ( adapter.equals( IDebugTarget.class ) ) - return getDebugTarget(); - // See bug #100261 - if ( adapter.equals( IMemoryBlockRetrieval.class ) ) - return getDebugTarget().getAdapter( adapter ); - if ( adapter.equals( IModuleRetrieval.class ) ) - return getDebugTarget().getAdapter( adapter ); - if ( adapter.equals( ILaunch.class ) ) - return getDebugTarget().getLaunch(); - return super.getAdapter( adapter ); - } - - protected void setStatus( int severity, String message ) { - fSeverity = severity; - fMessage = message; - if ( fMessage != null ) - fMessage = fMessage.trim(); - } - - protected void resetStatus() { - fSeverity = ICDebugElementStatus.OK; - fMessage = null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugElementStatus#isOK() - */ - @Override - public boolean isOK() { - return (fSeverity == ICDebugElementStatus.OK); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugElementStatus#getSeverity() - */ - @Override - public int getSeverity() { - return fSeverity; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugElementStatus#getMessage() - */ - @Override - public String getMessage() { - return fMessage; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugElement#getState() - */ - @Override - public CDebugElementState getState() { - return fState; - } - - protected synchronized void setState( CDebugElementState state ) throws IllegalArgumentException { - fOldState = fState; - fState = state; - } - - protected synchronized void restoreState() { - fState = fOldState; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugElement#getCurrentStateInfo() - */ - @Override - public Object getCurrentStateInfo() { - return fCurrentStateInfo; - } - - protected void setCurrentStateInfo( Object currentStateInfo ) { - fCurrentStateInfo = currentStateInfo; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java deleted file mode 100644 index d8ef4fbf3ef..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ /dev/null @@ -1,2065 +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 - * Ken Ryall (Nokia) - bugs 118894, 170027, 91771 - * Wind River Systems - adapted to work with platform Modules view (bug 210558) - * Marc-Andre Laperle - Bug 382462 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.StringTokenizer; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.IBinaryParser.ISymbol; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.ICGlobalVariableManager; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; -import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit; -import org.eclipse.cdt.debug.core.cdi.ICDIEndSteppingRange; -import org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo; -import org.eclipse.cdt.debug.core.cdi.ICDIEventBreakpointHit; -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.ICDISession; -import org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration; -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; -import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryEvent; -import org.eclipse.cdt.debug.core.cdi.ICDISignalReceived; -import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointScope; -import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger; -import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIDisconnectedEvent; -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.event.ICDIExitedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIRestartedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressFactoryManagement; -import org.eclipse.cdt.debug.core.cdi.model.ICDIDisposable; -import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariableDescriptor; -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.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget2; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.model.CDebugElementState; -import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICGlobalVariable; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.debug.core.model.ICSignal; -import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport; -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.core.model.IExecFileInfo; -import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; -import org.eclipse.cdt.debug.core.model.IModuleRetrieval; -import org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup; -import org.eclipse.cdt.debug.core.model.IRegisterDescriptor; -import org.eclipse.cdt.debug.core.sourcelookup.CProjectSourceContainer; -import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; -import org.eclipse.cdt.debug.core.sourcelookup.ISourceLookupChangeListener; -import org.eclipse.cdt.debug.internal.core.CBreakpointManager; -import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager; -import org.eclipse.cdt.debug.internal.core.CMemoryBlockRetrievalExtension; -import org.eclipse.cdt.debug.internal.core.CRegisterManager; -import org.eclipse.cdt.debug.internal.core.CSettingsManager; -import org.eclipse.cdt.debug.internal.core.CSignalManager; -import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupParticipant; -import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager; -import org.eclipse.cdt.utils.Addr64Factory; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IMarkerDelta; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IExpressionListener; -import org.eclipse.debug.core.IExpressionManager; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchListener; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IExpression; -import org.eclipse.debug.core.model.IMemoryBlock; -import org.eclipse.debug.core.model.IMemoryBlockRetrieval; -import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.core.sourcelookup.ISourceContainer; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; -import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; -import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer; -import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer; -import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer; - -import com.ibm.icu.text.MessageFormat; - -/** - * Debug target for C/C++ debug model. - */ -public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEventListener, ILaunchListener, IExpressionListener, ISourceLookupChangeListener { - - /** - * Threads contained in this debug target. - * When a thread starts it is added to the list. - * When a thread ends it is removed from the list. - */ - private ArrayList<CThread> fThreads; - - /** - * Associated inferior process, or <code>null</code> if not available. - */ - private IProcess fDebuggeeProcess = null; - - /** - * The underlying CDI target. - */ - private ICDITarget fCDITarget; - - /** - * The name of this target. - */ - private String fName; - - /** - * The launch this target is contained in - */ - private ILaunch fLaunch; - - /** - * The debug configuration of this session - */ - private ICDITargetConfiguration fConfig; - - /** - * The disassembly manager for this target. - */ - private Disassembly fDisassembly; - - /** - * The new disassembly manager for this target. - */ - private DisassemblyRetrieval fDisassemblyRetrieval; - - /** - * The module manager for this target. - */ - private CModuleManager fModuleManager; - - /** - * The signal manager for this target. - */ - private CSignalManager fSignalManager; - - /** - * The register manager for this target. - */ - private CRegisterManager fRegisterManager; - - /** - * A breakpoint manager for this target. - */ - private CBreakpointManager fBreakpointManager; - - /** - * The global variable manager for this target. - */ - private CGlobalVariableManager fGlobalVariableManager; - - /** - * container for Default format information - */ - private CSettingsManager fFormatManager; - - /** - * The executable binary file associated with this target. - */ - private IBinaryObject fBinaryFile; - - /** - * The project associated with this target. - */ - private IProject fProject; - - /** - * Whether the target is little endian. - */ - private Boolean fIsLittleEndian = null; - - /** - * The target's preference set. - */ - private Preferences fPreferences = null; - - /** - * The address factory of this target. - */ - private IAddressFactory fAddressFactory; - - /** - * Support for the memory retrieval on this target. - */ - private CMemoryBlockRetrievalExtension fMemoryBlockRetrieval; - - /** - * Internal ID that uniquely identifies this CDebugTarget. - */ - private String internalD = Integer.toString(lastInternalID++); - - private static int lastInternalID = 1; - - /** - * Constructor for CDebugTarget. - */ - public CDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget, String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowsTerminate, boolean allowsDisconnect) { - super(null); - setLaunch(launch); - setDebugTarget(this); - setName(name); - setProcess(debuggeeProcess); - setProject(project); - setExecFile(file); - setCDITarget(cdiTarget); - setState(CDebugElementState.SUSPENDED); - initializePreferences(); - setConfiguration(cdiTarget.getConfiguration()); - setThreadList(new ArrayList<CThread>(5)); - createDisassembly(); - setModuleManager(new CModuleManager(this)); - setSignalManager(new CSignalManager(this)); - setRegisterManager(new CRegisterManager(this)); - setBreakpointManager(new CBreakpointManager(this)); - setGlobalVariableManager(new CGlobalVariableManager(this)); - setFormatManager(new CSettingsManager(this)); - setMemoryBlockRetrieval(new CMemoryBlockRetrievalExtension(this)); - initialize(); - DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); - DebugPlugin.getDefault().getExpressionManager().addExpressionListener(this); - getCDISession().getEventManager().addEventListener(this); - } - - protected void initialize() { - initializeSourceLookupPath(); - ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(1); - debugEvents.add(createCreateEvent()); - initializeThreads(debugEvents); - initializeBreakpoints(); - initializeRegisters(); - initializeSourceManager(); - initializeModuleManager(); - initializeMemoryBlocks(); - getLaunch().addDebugTarget(this); - fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()])); - } - - private void initializeBreakpoints() { - getBreakpointManager().initialize(); - } - - public void start(String stopSymbol, boolean resume) throws DebugException { - ICDITargetConfiguration config = getConfiguration(); - if (config.supportsBreakpoints()) { - getBreakpointManager().setInitialBreakpoints(); - - if (stopSymbol != null && stopSymbol.length() != 0) { - // See if the expression is a numeric address - try { - IAddress address = getAddressFactory().createAddress(stopSymbol); - stopAtAddress(address); - } catch (NumberFormatException nfexc) { - // OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression - stopAtSymbol(stopSymbol); - } - } - } - if (config.supportsResume() && resume) { - resume(); - } - } - - /** - * Adds all of the pre-existing threads to this debug target. - */ - protected void initializeThreads(List<DebugEvent> debugEvents) { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget == null) { - return; - } - - ICDIThread[] cdiThreads = new ICDIThread[0]; - try { - cdiThreads = cdiTarget.getThreads(); - } catch (CDIException e) { - // ignore - } - DebugEvent suspendEvent = null; - for (int i = 0; i < cdiThreads.length; ++i) { - CThread thread = createThread(cdiThreads[i]); - debugEvents.add(thread.createCreateEvent()); - try { - if (cdiThreads[i].equals(cdiTarget.getCurrentThread()) && thread.isSuspended()) { - // Use BREAKPOINT as a detail to force perspective switch - suspendEvent = thread.createSuspendEvent(DebugEvent.BREAKPOINT); - } - } catch (CDIException e) { - // ignore - } - } - if (suspendEvent != null) { - debugEvents.add(suspendEvent); - } - } - - protected void initializeRegisters() { - getRegisterManager().initialize(); - } - - protected void initializeSourceManager() { - ISourceLocator locator = getLaunch().getSourceLocator(); - if (locator instanceof IAdaptable) { - ICSourceLocator clocator = ((IAdaptable)locator).getAdapter(ICSourceLocator.class); - if (clocator instanceof IAdaptable) { - CSourceManager sm = ((IAdaptable)clocator).getAdapter(CSourceManager.class); - if (sm != null) - sm.setDebugTarget(this); - } - IResourceChangeListener listener = ((IAdaptable)locator).getAdapter(IResourceChangeListener.class); - if (listener != null) - CCorePlugin.getWorkspace().addResourceChangeListener(listener); - } - } - - protected void initializeSourceLookupPath() { - ISourceLocator locator = getLaunch().getSourceLocator(); - if (locator instanceof ISourceLookupDirector) { - ISourceLookupParticipant[] participants = ((ISourceLookupDirector)locator).getParticipants(); - for (int i = 0; i < participants.length; ++i) { - if (participants[i] instanceof CSourceLookupParticipant) { - ((CSourceLookupParticipant)participants[i]).addSourceLookupChangeListener(this); - } - } - setSourceLookupPath(((ISourceLookupDirector)locator).getSourceContainers()); - } - } - - protected void initializeModuleManager() { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget == null) { - return; - } - - ICDISharedLibrary[] slibs = new ICDISharedLibrary[0]; - try { - slibs = cdiTarget.getSharedLibraries(); - } catch (CDIException e) { - DebugPlugin.log(e); - } - ICModule[] modules = null; - if (getExecFile() != null) { - modules = new ICModule[slibs.length + 1]; - modules[0] = CModule.createExecutable(this, getExecFile().getPath()); - } else { - modules = new ICModule[slibs.length]; - } - for (int i = 0; i < slibs.length; ++i) { - modules[i + 1] = CModule.createSharedLibrary(this, slibs[i]); - } - getModuleManager().addModules(modules); - } - - protected void initializeMemoryBlocks() { - getMemoryBlockRetrieval().initialize(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugTarget#getProcess() - */ - @Override - public IProcess getProcess() { - return fDebuggeeProcess; - } - - /** - * Sets the process associated with this debug target, possibly <code>null</code>. Set on creation. - * - * @param process the system process associated with the underlying CDI target, - * or <code>null</code> if no process is associated with this debug target - * (for a core dump debugging). - */ - protected void setProcess(IProcess debuggeeProcess) { - fDebuggeeProcess = debuggeeProcess; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IDebugTarget#getThreads() - */ - @Override - public IThread[] getThreads() { - List<CThread> threads = getThreadList(); - return threads.toArray(new IThread[threads.size()]); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IDebugTarget#hasThreads() - */ - @Override - public boolean hasThreads() throws DebugException { - return getThreadList().size() > 0; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IDebugTarget#getName() - */ - @Override - public String getName() throws DebugException { - return fName; - } - - /** - * Sets the name of this debug target. - * - * @param name the name of this debug target - */ - public void setName(String name) { - fName = name; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint) - */ - @Override - public boolean supportsBreakpoint(IBreakpoint breakpoint) { - if (!getConfiguration().supportsBreakpoints()) - return false; - return (breakpoint instanceof ICBreakpoint && getBreakpointManager().supportsBreakpoint((ICBreakpoint)breakpoint)); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.ILaunchListener#launchRemoved(org.eclipse.debug.core.ILaunch) - */ - @Override - public void launchRemoved(ILaunch launch) { - if (!isAvailable()) { - return; - } - if (launch.equals(getLaunch())) { - // This target has been deregistered, but it hasn't been successfully terminated. - // Update internal state to reflect that it is disconnected - disconnected(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch) - */ - @Override - public void launchAdded(ILaunch launch) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.ILaunchListener#launchChanged(org.eclipse.debug.core.ILaunch) - */ - @Override - public void launchChanged(ILaunch launch) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#canTerminate() - */ - @Override - public boolean canTerminate() { - return supportsTerminate() && isAvailable(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#isTerminated() - */ - @Override - public boolean isTerminated() { - return (getState().equals(CDebugElementState.TERMINATED)); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#terminate() - */ - @Override - public void terminate() throws DebugException { - if (!canTerminate()) { - return; - } - final CDebugElementState newState = CDebugElementState.TERMINATING; - changeState(newState); - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - cdiTarget.terminate(); - } - } catch (CDIException e) { - if (getState() == newState) { - restoreOldState(); - } - targetRequestFailed(e.getMessage(), null); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canResume() - */ - @Override - public boolean canResume() { - return getConfiguration().supportsResume() && isSuspended(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() - */ - @Override - public boolean canSuspend() { - if (!getConfiguration().supportsSuspend()) - return false; - if (getState().equals(CDebugElementState.RESUMED)) { - // only allow suspend if no threads are currently suspended - IThread[] threads = getThreads(); - for (int i = 0; i < threads.length; i++) { - if (threads[i].isSuspended()) { - return false; - } - } - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() - */ - @Override - public boolean isSuspended() { - return (getState().equals(CDebugElementState.SUSPENDED)); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#resume() - */ - @Override - public void resume() throws DebugException { - if (!canResume()) - return; - final CDebugElementState newState = CDebugElementState.RESUMING; - changeState(newState); - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - cdiTarget.resume(false); - } - } catch (CDIException e) { - if (getState() == newState) { - restoreOldState(); - } - targetRequestFailed(e.getMessage(), null); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#suspend() - */ - @Override - public void suspend() throws DebugException { - if (!canSuspend()) - return; - final CDebugElementState newState = CDebugElementState.SUSPENDING; - changeState(newState); - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - cdiTarget.suspend(); - } - } catch (CDIException e) { - if (getState() == newState) { - restoreOldState(); - } - targetRequestFailed(e.getMessage(), null); - } - } - - protected boolean isSuspending() { - return (getState().equals(CDebugElementState.SUSPENDING)); - } - - /** - * Notifies threads that the target has been suspended. - */ - protected void suspendThreads(ICDISuspendedEvent event) { - Iterator<CThread> it = getThreadList().iterator(); - while (it.hasNext()) { - CThread thread = it.next(); - ICDIThread suspensionThread = null; - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - suspensionThread = cdiTarget.getCurrentThread(); - } - } catch (CDIException e) { - // ignore - } - thread.suspendByTarget(event.getReason(), suspensionThread); - } - } - - /** - * Refreshes the thread list. - */ - protected synchronized List<CThread> refreshThreads() { - ArrayList<CThread> newThreads = new ArrayList<CThread>(5); - ArrayList<CThread> list = new ArrayList<CThread>(5); - ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(5); - List<CThread> oldList = (List<CThread>)getThreadList().clone(); - ICDIThread[] cdiThreads = new ICDIThread[0]; - ICDIThread currentCDIThread = null; - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - cdiThreads = cdiTarget.getThreads(); - currentCDIThread = cdiTarget.getCurrentThread(); - } - } catch (CDIException e) { - } - for (int i = 0; i < cdiThreads.length; ++i) { - CThread thread = findThread(oldList, cdiThreads[i]); - if (thread == null) { - thread = new CThread(this, cdiThreads[i]); - newThreads.add(thread); - } - else { - oldList.remove(thread); - } - thread.setCurrent(cdiThreads[i].equals(currentCDIThread)); - list.add(thread); - } - Iterator<CThread> it = oldList.iterator(); - while (it.hasNext()) { - CThread thread = it.next(); - thread.terminated(); - debugEvents.add(thread.createTerminateEvent()); - } - setThreadList(list); - it = newThreads.iterator(); - while (it.hasNext()) { - debugEvents.add(it.next().createCreateEvent()); - } - if (debugEvents.size() > 0) - fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()])); - return newThreads; - } - - /** - * Notifies threads that the target has been resumed. - */ - protected synchronized void resumeThreads(List<DebugEvent> debugEvents, int detail) { - Iterator<CThread> it = getThreadList().iterator(); - while (it.hasNext()) { - it.next().resumedByTarget(detail, debugEvents); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint) - */ - @Override - public void breakpointAdded(IBreakpoint breakpoint) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) - */ - @Override - public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) - */ - @Override - public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { - } - - /** - * Returns whether this debug target supports disconnecting. - * - * @return whether this debug target supports disconnecting - */ - protected boolean supportsDisconnect() { - return getConfiguration().supportsDisconnect(); - } - - /** - * Returns whether this debug target supports termination. - * - * @return whether this debug target supports termination - */ - protected boolean supportsTerminate() { - return getConfiguration().supportsTerminate(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect() - */ - @Override - public boolean canDisconnect() { - return supportsDisconnect() && isAvailable(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDisconnect#disconnect() - */ - @Override - public void disconnect() throws DebugException { - if (isDisconnecting()) { - return; - } - final CDebugElementState newState = CDebugElementState.DISCONNECTING; - changeState(newState); - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - cdiTarget.disconnect(); - } - } catch (CDIException e) { - if (getState() == newState) { - restoreOldState(); - } - targetRequestFailed(e.getMessage(), null); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected() - */ - @Override - public boolean isDisconnected() { - return (getState().equals(CDebugElementState.DISCONNECTED)); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval() - */ - @Override - public boolean supportsStorageRetrieval() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long) - */ - @Override - public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() - */ - @Override - public ILaunch getLaunch() { - return fLaunch; - } - - /** - * Sets the launch this target is contained in - * - * @param launch the launch this target is contained in - */ - private void setLaunch(ILaunch launch) { - fLaunch = launch; - } - - /** - * Returns the list of threads contained in this debug target. - * - * @return list of threads - */ - protected ArrayList<CThread> getThreadList() { - return fThreads; - } - - /** - * Sets the list of threads contained in this debug target. Set to an empty collection on creation. Threads are added and removed as they start and end. On - * termination this collection is set to the immutable singleton empty list. - * - * @param threads empty list - */ - private void setThreadList(ArrayList<CThread> threads) { - fThreads = threads; - } - - private void setCDITarget(ICDITarget cdiTarget) { - fCDITarget = cdiTarget; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - if (adapter.equals(ICDebugElement.class)) - return this; - if (adapter.equals(CDebugElement.class)) - return this; - if (adapter.equals(IDebugTarget.class)) - return this; - if (adapter.equals(ICDebugTarget.class)) - return this; - if (adapter.equals(CDebugTarget.class)) - return this; - if (adapter.equals(ICDITarget.class)) - return fCDITarget; - if (adapter.equals(IDebuggerProcessSupport.class)) - return this; - if (adapter.equals(IExecFileInfo.class)) - return this; - if (adapter.equals(CBreakpointManager.class)) - return getBreakpointManager(); - if (adapter.equals(CSignalManager.class)) - return getSignalManager(); - if (adapter.equals(CRegisterManager.class)) - return getRegisterManager(); - if (adapter.equals(ICGlobalVariableManager.class)) - return getGlobalVariableManager(); - if (adapter.equals(ICDISession.class)) - return getCDISession(); - if (adapter.equals(IMemoryBlockRetrievalExtension.class)) - return getMemoryBlockRetrieval(); - if (adapter.equals(IMemoryBlockRetrieval.class)) - return getMemoryBlockRetrieval(); - if (adapter.equals(IModuleRetrieval.class)) - return getModuleManager(); - - // Force adapters to be loaded. Otherwise the adapter manager may not find - // the model proxy adapter for CDT debug elements. - Platform.getAdapterManager().loadAdapter(this, adapter.getName()); - - return super.getAdapter(adapter); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents(ICDIEvent[] events) { - for (int i = 0; i < events.length; i++) { - ICDIEvent event = events[i]; - ICDIObject source = event.getSource(); - final ICDITarget cdiTarget = getCDITarget(); - if (source == null && event instanceof ICDIDestroyedEvent) { - handleTerminatedEvent((ICDIDestroyedEvent)event); - } - else if (source != null && cdiTarget != null && source.getTarget().equals(cdiTarget)) { - if (event instanceof ICDICreatedEvent) { - if (source instanceof ICDIThread) { - handleThreadCreatedEvent((ICDICreatedEvent)event); - } - if (source instanceof ICDISharedLibrary) { - getModuleManager().sharedLibraryLoaded((ICDISharedLibrary)source); - } - } - else if (event instanceof ICDISuspendedEvent) { - if (source instanceof ICDITarget) { - handleSuspendedEvent((ICDISuspendedEvent)event); - } - } - else if (event instanceof ICDIResumedEvent) { - if (source instanceof ICDITarget) { - handleResumedEvent((ICDIResumedEvent)event); - } - } - else if (event instanceof ICDIExitedEvent) { - if (source instanceof ICDITarget) { - handleExitedEvent((ICDIExitedEvent)event); - } - } - else if (event instanceof ICDIDestroyedEvent) { - if (source instanceof ICDIThread) { - handleThreadTerminatedEvent((ICDIDestroyedEvent)event); - } - if (source instanceof ICDISharedLibrary) { - getModuleManager().sharedLibraryUnloaded((ICDISharedLibrary)source); - } - } - else if (event instanceof ICDIDisconnectedEvent) { - if (source instanceof ICDITarget) { - handleDisconnectedEvent((ICDIDisconnectedEvent)event); - } - } - else if (event instanceof ICDIChangedEvent) { - if (source instanceof ICDITarget) { - handleChangedEvent((ICDIChangedEvent)event); - } - if (source instanceof ICDISharedLibrary) { - handleSymbolsLoaded((ICDISharedLibrary)source); - } - if (source instanceof ICDISignal) { - getSignalManager().signalChanged((ICDISignal)source); - } - } - else if (event instanceof ICDIRestartedEvent) { - if (source instanceof ICDITarget) { - handleRestartedEvent((ICDIRestartedEvent)event); - } - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRestart#canRestart() - */ - @Override - public boolean canRestart() { - return getConfiguration().supportsRestart() && isSuspended(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRestart#restart() - */ - @Override - public void restart() throws DebugException { - if (!canRestart()) { - return; - } - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget == null) { - return; - } - - try { - ILaunchConfiguration launchConfig = getLaunch().getLaunchConfiguration(); - if (launchConfig.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT)) { - String mainSymbol = launchConfig.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); - ICDILocation location = null; - // See if the expression is a numeric address - try { - IAddress address = getAddressFactory().createAddress(mainSymbol); - location = cdiTarget.createAddressLocation(address.getValue()); - } catch (NumberFormatException nfexc) { - // OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression - location = cdiTarget.createFunctionLocation("", mainSymbol); //$NON-NLS-1$ - } - - setInternalTemporaryBreakpoint(location); - } - } catch (CoreException e) { - requestFailed(e.getMessage(), e); - } - - final CDebugElementState newState = CDebugElementState.RESTARTING; - changeState(newState); - try { - cdiTarget.restart(); - } catch (CDIException e) { - if (getState() == newState) { - restoreOldState(); - } - targetRequestFailed(e.getMessage(), e); - } - } - - /** - * Returns whether this target is available to handle client requests. - * - * @return whether this target is available to handle client requests - */ - public boolean isAvailable() { - return !(isTerminated() || isTerminating() || isDisconnected() || isDisconnecting()); - } - - /** - * Returns whether this target is in the process of terminating. - * - * @return whether this target is terminating - */ - protected boolean isTerminating() { - return (getState().equals(CDebugElementState.TERMINATING)); - } - - /** - * Updates the state of this target to be terminated, if not already terminated. - */ - protected void terminated() { - if (!isTerminated()) { - if (!isDisconnected()) { - setState(CDebugElementState.TERMINATED); - } - cleanup(); - fireTerminateEvent(); - } - } - - /** - * Returns whether this target is in the process of terminating. - * - * @return whether this target is terminating - */ - protected boolean isDisconnecting() { - return (getState().equals(CDebugElementState.DISCONNECTING)); - } - - /** - * Updates the state of this target for disconnection. - */ - protected void disconnected() { - if (!isDisconnected()) { - setState(CDebugElementState.DISCONNECTED); - cleanup(); - fireTerminateEvent(); - } - } - - /** - * Cleans up the internal state of this debug target as a result of a session ending. - */ - protected void cleanup() { - resetStatus(); - removeAllThreads(); - getCDISession().getEventManager().removeEventListener(this); - DebugPlugin.getDefault().getExpressionManager().removeExpressionListener(this); - DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); - saveFormats(); - saveGlobalVariables(); - disposeGlobalVariableManager(); - disposeModuleManager(); - disposeSignalManager(); - saveRegisterGroups(); - disposeRegisterManager(); - saveMemoryBlocks(); - disposeMemoryBlockRetrieval(); - disposeDisassembly(); - disposeSourceManager(); - disposeSourceLookupPath(); - disposeBreakpointManager(); - removeAllExpressions(); - disposePreferences(); - - ICDITarget cdiTarget = getCDITarget(); - // TODO: apparently we're not really done with the ICDITarget. The - // arrival of a terminate event from gdb requires access to this (see - // SessionManager.handleDebugEvent()). Reported by Mikhail. Need to - // revisit this. - // setCDITarget(null); - if (cdiTarget instanceof ICDIDisposable) { - ((ICDIDisposable)cdiTarget).dispose(); - } - } - - /** - * Removes all threads from this target's collection of threads, firing a terminate event for each. - */ - protected void removeAllThreads() { - List<CThread> threads = getThreadList(); - setThreadList(new ArrayList<CThread>(0)); - ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(threads.size()); - Iterator<CThread> it = threads.iterator(); - while (it.hasNext()) { - CThread thread = it.next(); - thread.terminated(); - debugEvents.add(thread.createTerminateEvent()); - } - fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()])); - } - - /** - * Removes all expressions from this target. - */ - protected void removeAllExpressions() { - IExpressionManager em = DebugPlugin.getDefault().getExpressionManager(); - IExpression[] expressions = em.getExpressions(); - for (int i = 0; i < expressions.length; ++i) { - if (expressions[i] instanceof CExpression && expressions[i].getDebugTarget().equals(this)) { - em.removeExpression(expressions[i]); - } - } - } - - /** - * Creates, adds and returns a thread for the given underlying CDI thread. A creation event is fired for the thread. Returns <code>null</code> if during - * the creation of the thread this target is set to the disconnected state. - * - * @param thread the underlying CDI thread - * @return model thread - */ - protected CThread createThread(ICDIThread cdiThread) { - CThread thread = new CThread(this, cdiThread); - getThreadList().add(thread); - return thread; - } - - private void handleSuspendedEvent(ICDISuspendedEvent event) { - setState(CDebugElementState.SUSPENDED); - ICDISessionObject reason = event.getReason(); - setCurrentStateInfo(reason); - // Reset the registers that have errors. - getRegisterManager().targetSuspended(); - getBreakpointManager().skipBreakpoints(false); - List<CThread> newThreads = refreshThreads(); - if (event.getSource() instanceof ICDITarget) { - if (!(this.getConfiguration() instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)this.getConfiguration()).supportsThreadControl()) - suspendThreads(event); - } else if (event.getSource() instanceof ICDIThread) { - // We need this for debuggers that don't have notifications - // for newly created threads. - CThread thread = findThread((ICDIThread)event.getSource()); - if (thread != null && newThreads.contains(thread)) { - ICDIEvent[] evts = new ICDIEvent[]{ event }; - thread.handleDebugEvents(evts); - } - } - if (reason instanceof ICDIEndSteppingRange) { - handleEndSteppingRange((ICDIEndSteppingRange)reason); - } - else if (reason instanceof ICDIBreakpointHit) { - handleBreakpointHit((ICDIBreakpointHit)reason); - } - else if (reason instanceof ICDISignalReceived) { - handleSuspendedBySignal((ICDISignalReceived)reason); - } - else if (reason instanceof ICDIWatchpointTrigger) { - handleWatchpointTrigger((ICDIWatchpointTrigger)reason); - } - else if (reason instanceof ICDIWatchpointScope) { - handleWatchpointScope((ICDIWatchpointScope)reason); - } - else if (reason instanceof ICDIErrorInfo) { - handleErrorInfo((ICDIErrorInfo)reason); - } - else if (reason instanceof ICDISharedLibraryEvent) { - handleSuspendedBySolibEvent((ICDISharedLibraryEvent)reason); - } - else if (reason instanceof ICDIEventBreakpointHit) { - handleEventBreakpointHit((ICDIEventBreakpointHit)reason); - } - else { // reason is not specified - fireSuspendEvent(DebugEvent.UNSPECIFIED); - } - } - - private void handleResumedEvent(ICDIResumedEvent event) { - setState(CDebugElementState.RESUMED); - setCurrentStateInfo(null); - resetStatus(); - ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(10); - int detail = DebugEvent.UNSPECIFIED; - switch(event.getType()) { - case ICDIResumedEvent.CONTINUE: - detail = DebugEvent.CLIENT_REQUEST; - break; - case ICDIResumedEvent.STEP_INTO: - case ICDIResumedEvent.STEP_INTO_INSTRUCTION: - detail = DebugEvent.STEP_INTO; - break; - case ICDIResumedEvent.STEP_OVER: - case ICDIResumedEvent.STEP_OVER_INSTRUCTION: - detail = DebugEvent.STEP_OVER; - break; - case ICDIResumedEvent.STEP_RETURN: - detail = DebugEvent.STEP_RETURN; - break; - } - debugEvents.add(createResumeEvent(detail)); - - if (!(this.getConfiguration() instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)this.getConfiguration()).supportsThreadControl()) - resumeThreads(debugEvents, detail); - - fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()])); - } - - private void handleEndSteppingRange(ICDIEndSteppingRange endSteppingRange) { - fireSuspendEvent(DebugEvent.UNSPECIFIED); - } - - private void handleBreakpointHit(ICDIBreakpointHit breakpointHit) { - fireSuspendEvent(DebugEvent.BREAKPOINT); - } - - private void handleEventBreakpointHit(ICDIEventBreakpointHit breakpointHit) { - fireSuspendEvent(DebugEvent.BREAKPOINT); - } - - private void handleWatchpointTrigger(ICDIWatchpointTrigger wt) { - fireSuspendEvent(DebugEvent.BREAKPOINT); - } - - private void handleWatchpointScope(ICDIWatchpointScope ws) { - getBreakpointManager().watchpointOutOfScope(ws.getWatchpoint()); - fireSuspendEvent(DebugEvent.BREAKPOINT); - } - - private void handleSuspendedBySignal(ICDISignalReceived signal) { - fireSuspendEvent(DebugEvent.CLIENT_REQUEST); - } - - private void handleErrorInfo(ICDIErrorInfo info) { - setStatus(ICDebugElementStatus.ERROR, (info != null) ? info.getMessage() : null); - if (info != null) { - MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, CoreModelMessages.getString("CDebugTarget.1"), //$NON-NLS-1$ - null); - StringTokenizer st = new StringTokenizer(info.getDetailMessage(), "\n\r"); //$NON-NLS-1$ - while (st.hasMoreTokens()) { - String token = st.nextToken(); - if (token.length() > 200) { - token = token.substring(0, 200); - } - status.add(new Status(IStatus.ERROR, status.getPlugin(), ICDebugInternalConstants.STATUS_CODE_ERROR, token, null)); - } - CDebugUtils.error(status, this); - } - fireSuspendEvent(DebugEvent.UNSPECIFIED); - } - - private void handleSuspendedBySolibEvent(ICDISharedLibraryEvent solibEvent) { - fireSuspendEvent(DebugEvent.UNSPECIFIED); - } - - private void handleExitedEvent(ICDIExitedEvent event) { - removeAllThreads(); - setState(CDebugElementState.EXITED); - setCurrentStateInfo(event.getReason()); - fireChangeEvent(DebugEvent.CONTENT); - ICDISessionConfiguration sessionConfig = getCDISession().getConfiguration(); - if (sessionConfig != null && sessionConfig.terminateSessionOnExit()) - terminated(); - } - - private void handleTerminatedEvent(ICDIDestroyedEvent event) { - terminated(); - } - - private void handleDisconnectedEvent(ICDIDisconnectedEvent event) { - disconnected(); - } - - private void handleChangedEvent(ICDIChangedEvent event) { - } - - private void handleRestartedEvent(ICDIRestartedEvent event) { - } - - private void handleThreadCreatedEvent(ICDICreatedEvent event) { - ICDIThread cdiThread = (ICDIThread)event.getSource(); - CThread thread = findThread(cdiThread); - if (thread == null) { - thread = createThread(cdiThread); - thread.fireCreationEvent(); - } - } - - private void handleThreadTerminatedEvent(ICDIDestroyedEvent event) { - ICDIThread cdiThread = (ICDIThread)event.getSource(); - List<CThread> threads = getThreadList(); - List<CThread> threadsToRemove = new ArrayList<CThread>(1); - for (int i = 0; i < threads.size(); i++) { - CThread cthread = threads.get(i); - // It's possible CThread has handled the thread-terminated event - // before us (by appearing first in the EventManager) - // and has disassociated itself from the ICDIThread. - // So handle any disassociated CThreads we find. Chances are - // there's only one and it's the one we got the terminated event - // for. See bugzilla 254888. - ICDIThread cdithread = cthread.getCDIThread(); - if (cdithread == null || cdithread.equals(cdiThread)) { - threadsToRemove.add(cthread); - } - } - for (CThread cthread : threadsToRemove) { - threads.remove(cthread); - cthread.terminated(); - cthread.fireTerminateEvent(); - } - } - - /** - * Finds and returns the model thread for the associated CDI thread, or <code>null</code> if not found. - * - * @param the underlying CDI thread - * @return the associated model thread - */ - public CThread findThread(ICDIThread cdiThread) { - return findThread(getThreadList(), cdiThread); - } - - public CThread findThread(List<CThread> threads, ICDIThread cdiThread) { - for (int i = 0; i < threads.size(); i++) { - CThread t = threads.get(i); - ICDIThread thisCdiThread = t.getCDIThread(); - if (thisCdiThread != null && thisCdiThread.equals(cdiThread)) - return t; - } - return null; - } - - /** - * Returns the debug configuration of this target. - * - * @return the debug configuration of this target - */ - protected ICDITargetConfiguration getConfiguration() { - return fConfig; - } - - /** - * Sets the debug configuration of this target. - * - * @param config the debug configuration to set - */ - private void setConfiguration(ICDITargetConfiguration config) { - fConfig = config; - } - - protected boolean supportsExpressionEvaluation() { - return getConfiguration().supportsExpressionEvaluation(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IExpressionListener#expressionAdded(org.eclipse.debug.core.model.IExpression) - */ - @Override - public void expressionAdded(IExpression expression) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IExpressionListener#expressionChanged(org.eclipse.debug.core.model.IExpression) - */ - @Override - public void expressionChanged(IExpression expression) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IExpressionListener#expressionRemoved(org.eclipse.debug.core.model.IExpression) - */ - @Override - public void expressionRemoved(IExpression expression) { - if (expression instanceof CExpression && expression.getDebugTarget().equals(this)) { - ((CExpression)expression).dispose(); - } - } - - public void setInternalTemporaryBreakpoint(ICDILocation location) throws DebugException { - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget == null) { - return; - } - if (location instanceof ICDIFunctionLocation) { - cdiTarget.setFunctionBreakpoint(ICBreakpointType.TEMPORARY, (ICDIFunctionLocation)location, null, false); - } else if (location instanceof ICDILineLocation) { - cdiTarget.setLineBreakpoint(ICBreakpointType.TEMPORARY, (ICDILineLocation)location, null, false); - } else if (location instanceof ICDIAddressLocation) { - cdiTarget.setAddressBreakpoint(ICBreakpointType.TEMPORARY, (ICDIAddressLocation)location, null, false); - } else { - // ??? - targetRequestFailed("not_a_location", null); //$NON-NLS-1$ - } - } catch (CDIException e) { - targetRequestFailed(e.getMessage(), null); - } - } - - protected IThread getCurrentThread() { - IThread[] threads = getThreads(); - for (int i = 0; i < threads.length; ++i) { - if (((CThread)threads[i]).isCurrent()) - return threads[i]; - } - return null; - } - - protected ISourceLocator getSourceLocator() { - return getLaunch().getSourceLocator(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IExecFileInfo#isLittleEndian() - */ - @Override - public boolean isLittleEndian() { - if (fIsLittleEndian == null) { - fIsLittleEndian = Boolean.TRUE; - IBinaryObject file; - file = getBinaryFile(); - if (file != null) { - fIsLittleEndian = Boolean.valueOf(file.isLittleEndian()); - } - } - return fIsLittleEndian.booleanValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getExecFile() - */ - @Override - public IBinaryObject getExecFile() { - return getBinaryFile(); - } - - public IBinaryObject getBinaryFile() { - return fBinaryFile; - } - - private void setExecFile(IBinaryObject file) { - fBinaryFile = file; - } - - private void setProject(IProject project) { - fProject = project; - } - - public IProject getProject() { - return fProject; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getGlobals() - */ - @Override - public IGlobalVariableDescriptor[] getGlobals() throws DebugException { - ICDITarget cdiTarget = getCDITarget(); - // If the backend can give us the globals... - boolean hasCDIGlobals = false; - ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>(); - if (cdiTarget instanceof ICDITarget2) { - ICDIGlobalVariableDescriptor[] cdiGlobals = ((ICDITarget2) cdiTarget).getGlobalVariables(); - hasCDIGlobals = cdiGlobals != null; - if (hasCDIGlobals) { - for (int i = 0; i < cdiGlobals.length; i++) { - list.add(CVariableFactory.createGlobalVariableDescriptor(cdiGlobals[i].getName(), null)); - } - } - } - // otherwise ask the binary - if (!hasCDIGlobals) { - IBinaryObject file = getBinaryFile(); - if (file != null) { - list.addAll(getCFileGlobals(file)); - } - } - return list.toArray(new IGlobalVariableDescriptor[list.size()]); - } - - private List<IGlobalVariableDescriptor> getCFileGlobals(IBinaryObject file) { - ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>(); - ISymbol[] symbols = file.getSymbols(); - for (int i = 0; i < symbols.length; ++i) { - if (symbols[i].getType() == ISymbol.VARIABLE) { - list.add(CVariableFactory.createGlobalVariableDescriptor(symbols[i])); - } - } - return list; - } - - protected void setModuleManager(CModuleManager mm) { - fModuleManager = mm; - } - - protected CModuleManager getModuleManager() { - return fModuleManager; - } - - protected void disposeModuleManager() { - fModuleManager.dispose(); - fModuleManager = null; - } - - protected void setSignalManager(CSignalManager sm) { - fSignalManager = sm; - } - - protected CSignalManager getSignalManager() { - return fSignalManager; - } - - protected void disposeSignalManager() { - fSignalManager.dispose(); - } - - protected void saveRegisterGroups() { - fRegisterManager.save(); - } - - protected void disposeRegisterManager() { - fRegisterManager.dispose(); - } - - protected void saveGlobalVariables() { - fGlobalVariableManager.save(); - } - - protected void saveFormats() { - fFormatManager.save(); - } - - protected void disposeGlobalVariableManager() { - fGlobalVariableManager.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal() - */ - @Override - public boolean canResumeWithoutSignal() { - // Check if the configuration supports this!!! - return (canResume() && getCurrentStateInfo() instanceof ICDISignalReceived); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal() - */ - @Override - public void resumeWithoutSignal() throws DebugException { - if (!canResume()) - return; - final CDebugElementState newState = CDebugElementState.RESUMING; - changeState(newState); - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - cdiTarget.resume(false); - } - } catch (CDIException e) { - if (getState() == newState) { - restoreOldState(); - } - targetRequestFailed(e.getMessage(), e); - } - } - - public CRegisterManager getRegisterManager() { - // Workaround for bug #309212. gdb 7.0 returns "No registers" error - // at the beginning of the session. - fRegisterManager.initialize(); - return fRegisterManager; - } - - protected void setRegisterManager(CRegisterManager registerManager) { - fRegisterManager = registerManager; - } - - public IRegisterGroup[] getRegisterGroups(CStackFrame frame) throws DebugException { - return getRegisterManager().getRegisterGroups(frame); - } - - protected void disposeSourceManager() { - ISourceLocator locator = getSourceLocator(); - if (locator instanceof IAdaptable) { - IResourceChangeListener listener = ((IAdaptable)locator).getAdapter(IResourceChangeListener.class); - if (listener != null) - CCorePlugin.getWorkspace().removeResourceChangeListener(listener); - } - } - - protected void disposeSourceLookupPath() { - ISourceLocator locator = getLaunch().getSourceLocator(); - if (locator instanceof ISourceLookupDirector) { - ISourceLookupParticipant[] participants = ((ISourceLookupDirector)locator).getParticipants(); - for (int i = 0; i < participants.length; ++i) { - if (participants[i] instanceof CSourceLookupParticipant) { - ((CSourceLookupParticipant)participants[i]).removeSourceLookupChangeListener(this); - } - } - } - } - - protected void saveMemoryBlocks() { - getMemoryBlockRetrieval().save(); - } - - protected void disposeMemoryBlockRetrieval() { - getMemoryBlockRetrieval().dispose(); - } - - protected CBreakpointManager getBreakpointManager() { - return fBreakpointManager; - } - - protected void setBreakpointManager(CBreakpointManager manager) { - fBreakpointManager = manager; - } - - protected void disposeBreakpointManager() { - if (getBreakpointManager() != null) - getBreakpointManager().dispose(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - String result = ""; //$NON-NLS-1$ - try { - result = getName(); - } catch (DebugException e) { - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#getDisassembly() - */ - @Override - public IDisassembly getDisassembly() throws DebugException { - return fDisassembly; - } - - public DisassemblyRetrieval getDisassemblyRetrieval() { - return fDisassemblyRetrieval; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#getSignals() - */ - @Override - public ICSignal[] getSignals() throws DebugException { - CSignalManager sm = getSignalManager(); - if (sm != null) { - return sm.getSignals(); - } - return new ICSignal[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#hasSignals() - */ - @Override - public boolean hasSignals() throws DebugException { - CSignalManager sm = getSignalManager(); - if (sm != null) { - return (sm.getSignals().length > 0); - } - return false; - } - - private void createDisassembly() { - this.fDisassembly = new Disassembly(this); - this.fDisassemblyRetrieval = new DisassemblyRetrieval(this); - } - - private void disposeDisassembly() { - if (fDisassembly != null) - fDisassembly.dispose(); - fDisassembly = null; - if (fDisassemblyRetrieval != null) - fDisassemblyRetrieval.dispose(); - fDisassemblyRetrieval = null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint) - */ - @Override - public IAddress getBreakpointAddress(ICLineBreakpoint breakpoint) throws DebugException { - return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress(breakpoint) : getAddressFactory().getZero(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#enableInstructionStepping(boolean) - */ - @Override - public void enableInstructionStepping(boolean enabled) { - fPreferences.setValue(PREF_INSTRUCTION_STEPPING_MODE, enabled); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#isInstructionSteppingEnabled() - */ - @Override - public boolean isInstructionSteppingEnabled() { - return fPreferences.getBoolean(PREF_INSTRUCTION_STEPPING_MODE); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#supportsInstructionStepping() - */ - @Override - public boolean supportsInstructionStepping() { - return getConfiguration().supportsInstructionStepping(); - } - - private void initializePreferences() { - fPreferences = new Preferences(); - fPreferences.setDefault(PREF_INSTRUCTION_STEPPING_MODE, CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean(ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON)); - } - - private void disposePreferences() { - if (fPreferences != null) { - // persist current instruction stepping mode - CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON, fPreferences.getBoolean(PREF_INSTRUCTION_STEPPING_MODE)); - CDebugCorePlugin.getDefault().savePluginPreferences(); - } - fPreferences = null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ITargetProperties#addPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener) - */ - @Override - public void addPropertyChangeListener(IPropertyChangeListener listener) { - if (fPreferences != null) - fPreferences.addPropertyChangeListener(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ITargetProperties#removePropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener) - */ - @Override - public void removePropertyChangeListener(IPropertyChangeListener listener) { - if (fPreferences != null) - fPreferences.removePropertyChangeListener(listener); - } - - protected CGlobalVariableManager getGlobalVariableManager() { - return fGlobalVariableManager; - } - - private void setGlobalVariableManager(CGlobalVariableManager globalVariableManager) { - fGlobalVariableManager = globalVariableManager; - } - - protected CSettingsManager getFormatManager() { - return fFormatManager; - } - - private void setFormatManager(CSettingsManager formatManager) { - fFormatManager = formatManager; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#isPostMortem() - */ - @Override - public boolean isPostMortem() { - return false; - } - - public IAddressFactory getAddressFactory() { - if (fAddressFactory == null) { - // Ask CDI plug-in for the default AddressFactory. - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget instanceof ICDIAddressFactoryManagement) { - fAddressFactory = ((ICDIAddressFactoryManagement) cdiTarget).getAddressFactory(); - } - // And if that doesn't work, use the one from the file. - if (fAddressFactory == null) { - if (getExecFile() != null && getProject() != null) { - IBinaryObject file = getBinaryFile(); - if (file != null) { - fAddressFactory = file.getAddressFactory(); - } - } - } - - // As a last resort, fallback to 64 bit address factory - if (fAddressFactory == null) { - fAddressFactory = new Addr64Factory(); - } - } - return fAddressFactory; - } - - private CMemoryBlockRetrievalExtension getMemoryBlockRetrieval() { - return fMemoryBlockRetrieval; - } - - private void setMemoryBlockRetrieval(CMemoryBlockRetrievalExtension memoryBlockRetrieval) { - fMemoryBlockRetrieval = memoryBlockRetrieval; - } - - private void changeState(CDebugElementState state) { - setState(state); - Iterator<CThread> it = getThreadList().iterator(); - while (it.hasNext()) { - it.next().setState(state); - } - } - - protected void restoreOldState() { - restoreState(); - Iterator<CThread> it = getThreadList().iterator(); - while (it.hasNext()) { - it.next().restoreState(); - } - } - - private void handleSymbolsLoaded(ICDISharedLibrary library) { - getModuleManager().symbolsLoaded(library); - } - - public ICGlobalVariable createGlobalVariable(IGlobalVariableDescriptor info) throws DebugException { - ICDIVariableDescriptor vo = null; - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - vo = cdiTarget.getGlobalVariableDescriptors(info.getPath().lastSegment(), null, info.getName()); - } - } catch (CDIException e) { - throw new DebugException(new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null)); - } - return CVariableFactory.createGlobalVariable(this, info, vo); - } - - @Override - public void sourceContainersChanged(ISourceLookupDirector director) { - setSourceLookupPath(director.getSourceContainers()); - } - - private void setSourceLookupPath(ISourceContainer[] containers) { - // LinkedHashSet allows quick lookup and deterministic ordering. We need - // the former to efficiently prevent infinite recursion - LinkedHashSet<String> list = new LinkedHashSet<String>(containers.length); - - getSourceLookupPath(list, containers); - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - cdiTarget.setSourcePaths(list.toArray(new String[list.size()])); - } - } catch (CDIException e) { - CDebugCorePlugin.log(e); - } - } - - private void getSourceLookupPath(LinkedHashSet<String> list, ISourceContainer[] containers) { - for (ISourceContainer container : containers) { - String pathToAdd = null; - - if (container instanceof CProjectSourceContainer) { - IProject project = ((CProjectSourceContainer) container).getProject(); - if (project != null && project.exists()) { - IPath location = project.getLocation(); - if (location != null) { - pathToAdd = location.toPortableString(); - } - } - } else if (container instanceof ProjectSourceContainer) { // For backward compatibility - IProject project = ((ProjectSourceContainer) container).getProject(); - if (project != null && project.exists()) { - IPath location = project.getLocation(); - if (location != null) { - pathToAdd = location.toPortableString(); - } - } - } else if (container instanceof FolderSourceContainer) { - IContainer folderContainer = ((FolderSourceContainer) container).getContainer(); - if (folderContainer != null && folderContainer.exists()) { - IPath location = folderContainer.getLocation(); - if (location != null) { - pathToAdd = location.toPortableString(); - } - } - } if (container instanceof DirectorySourceContainer) { - File dir = ((DirectorySourceContainer) container).getDirectory(); - if (dir != null && dir.exists()) { - IPath path = new Path(dir.getAbsolutePath()); - pathToAdd = path.toPortableString(); - } - } - - if (pathToAdd != null) { - // 291912. Avoid infinite recursion - if (list.contains(pathToAdd)) { - continue; - } - - list.add(pathToAdd); - } - - if (container.isComposite()) { - try { - getSourceLookupPath(list, container.getSourceContainers()); - } catch (CoreException e) { - CDebugCorePlugin.log(e.getStatus()); - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#getRegisterDescriptors() - */ - @Override - public IRegisterDescriptor[] getRegisterDescriptors() throws DebugException { - return getRegisterManager().getAllRegisterDescriptors(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#addUserDefinedRegisterGroup(java.lang.String, org.eclipse.cdt.debug.core.model.IRegisterDescriptor[]) - */ - @Override - public void addRegisterGroup(String name, IRegisterDescriptor[] descriptors) { - getRegisterManager().addRegisterGroup(name, descriptors); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#removeRegisterGroups(org.eclipse.debug.core.model.IRegisterGroup[]) - */ - @Override - public void removeRegisterGroups(IRegisterGroup[] groups) { - getRegisterManager().removeRegisterGroups(groups); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#modifyRegisterGroup(org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup, org.eclipse.cdt.debug.core.model.IRegisterDescriptor[]) - */ - @Override - public void modifyRegisterGroup(IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors) { - getRegisterManager().modifyRegisterGroup(group, descriptors); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICDebugTarget#restoreDefaultRegisterGroups() - */ - @Override - public void restoreDefaultRegisterGroups() { - getRegisterManager().restoreDefaults(); - } - - protected void skipBreakpoints(boolean enabled) { - getBreakpointManager().skipBreakpoints(enabled); - } - - /** - * 'stopExpression' is used solely for the error message if the request - * fails. Where to stop is dictated entirely by 'location' - * @param symbol - */ - private void stopAtLocation(ICDILocation location, String stopExpression) throws DebugException { - try { - setInternalTemporaryBreakpoint(location); - } catch (CoreException e) { - final ICDITarget cdiTarget = getCDITarget(); - boolean isTerminated = cdiTarget != null && cdiTarget.isTerminated(); - if (isTerminated) { - String message = MessageFormat.format(CoreModelMessages.getString("CDebugTarget.0"), new String[]{ stopExpression }); //$NON-NLS-1$ - MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), IStatus.OK, message, null); - status.add(e.getStatus()); - throw new DebugException(status); - } - String message = MessageFormat.format(CoreModelMessages.getString("CDebugTarget.2"), new String[]{ stopExpression, e.getStatus().getMessage() }); //$NON-NLS-1$ - IStatus newStatus = new Status(IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null); - if (!CDebugUtils.question(newStatus, this)) { - throw new DebugException(new Status(IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null)); - } - } - } - - protected void stopAtSymbol(String stopSymbol) throws DebugException { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - ICDILocation location = cdiTarget.createFunctionLocation("", stopSymbol); //$NON-NLS-1$ - stopAtLocation(location, stopSymbol); - } - } - - protected void stopAtAddress(IAddress address) throws DebugException { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - ICDIAddressLocation location = cdiTarget.createAddressLocation(address.getValue()); - stopAtLocation(location, address.toHexAddressString()); - } - } - - protected void stopInMain() throws DebugException { - String mainSymbol = ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT; - try { - final ICDITarget cdiTarget = getCDITarget(); - if (cdiTarget != null) { - mainSymbol = getLaunch().getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); - ICDILocation location = cdiTarget.createFunctionLocation("", mainSymbol); //$NON-NLS-1$ - setInternalTemporaryBreakpoint(location); - } - } catch (CoreException e) { - String message = MessageFormat.format(CoreModelMessages.getString("CDebugTarget.2"), new String[]{ mainSymbol, e.getStatus().getMessage() }); //$NON-NLS-1$ - IStatus newStatus = new Status(IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null); - if (!CDebugUtils.question(newStatus, this)) { - terminate(); - throw new DebugException(new Status(IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null)); - } - } - } - - @Override - public boolean hasModules() throws DebugException { - CModuleManager mm = getModuleManager(); - if (mm != null) - return mm.hasModules(); - return false; - } - - @Override - public ICModule[] getModules() throws DebugException { - CModuleManager mm = getModuleManager(); - if (mm != null) - return mm.getModules(); - return new ICModule[0]; - } - - @Override - public void loadSymbolsForAllModules() throws DebugException { - CModuleManager mm = getModuleManager(); - if (mm != null) - mm.loadSymbolsForAllModules(); - } - - public String getInternalID() { - return internalD; - } -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDummyStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDummyStackFrame.java deleted file mode 100644 index 02d4c2e4c2f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDummyStackFrame.java +++ /dev/null @@ -1,296 +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.internal.core.model; - -import org.eclipse.cdt.debug.core.model.IDummyStackFrame; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.core.model.IVariable; - -/** - * Implementation of the dummy stack frame. - */ -public class CDummyStackFrame extends CDebugElement implements IStackFrame, IDummyStackFrame { - - /** - * Containing thread. - */ - private CThread fThread; - - /** - * Constructor for CDummyStackFrame. - * - * @param target - */ - public CDummyStackFrame( CThread thread ) { - super( (CDebugTarget)thread.getDebugTarget() ); - setThread( thread ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#getThread() - */ - @Override - public IThread getThread() { - return fThread; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#getVariables() - */ - @Override - public IVariable[] getVariables() throws DebugException { - return new IVariable[0]; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#hasVariables() - */ - @Override - public boolean hasVariables() throws DebugException { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() - */ - @Override - public int getLineNumber() throws DebugException { - return 0; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#getCharStart() - */ - @Override - public int getCharStart() throws DebugException { - return 0; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() - */ - @Override - public int getCharEnd() throws DebugException { - return 0; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#getName() - */ - @Override - public String getName() throws DebugException { - return "..."; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() - */ - @Override - public IRegisterGroup[] getRegisterGroups() throws DebugException { - return new IRegisterGroup[0]; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() - */ - @Override - public boolean hasRegisterGroups() throws DebugException { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStep#canStepInto() - */ - @Override - public boolean canStepInto() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStep#canStepOver() - */ - @Override - public boolean canStepOver() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStep#canStepReturn() - */ - @Override - public boolean canStepReturn() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStep#isStepping() - */ - @Override - public boolean isStepping() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStep#stepInto() - */ - @Override - public void stepInto() throws DebugException { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStep#stepOver() - */ - @Override - public void stepOver() throws DebugException { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IStep#stepReturn() - */ - @Override - public void stepReturn() throws DebugException { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ISuspendResume#canResume() - */ - @Override - public boolean canResume() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() - */ - @Override - public boolean canSuspend() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() - */ - @Override - public boolean isSuspended() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ISuspendResume#resume() - */ - @Override - public void resume() throws DebugException { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ISuspendResume#suspend() - */ - @Override - public void suspend() throws DebugException { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ITerminate#canTerminate() - */ - @Override - public boolean canTerminate() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ITerminate#isTerminated() - */ - @Override - public boolean isTerminated() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.ITerminate#terminate() - */ - @Override - public void terminate() throws DebugException { - } - - /** - * Sets the containing thread. - * - * @param thread the containing thread - */ - protected void setThread( CThread thread ) { - fThread = thread; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( adapter.equals( IDummyStackFrame.class ) ) - return this; - if ( adapter.equals( IStackFrame.class ) ) - return this; - return super.getAdapter( adapter ); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java deleted file mode 100644 index 0caca05201e..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java +++ /dev/null @@ -1,264 +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 - * Ling Wang (Nokia) - 126262 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -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.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; -import org.eclipse.cdt.debug.core.model.CVariableFormat; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IExpression; -import org.eclipse.debug.core.model.IValue; - -/** - * Represents an expression in the CDI model. - */ -public class CExpression extends CLocalVariable implements IExpression { - - private String fText; - - private ICDIExpression fCDIExpression; - - private CStackFrame fStackFrame; - - private IValue fValue = CValueFactory.NULL_VALUE; - - private ICType fType; - - /** - * Constructor for CExpression. - */ - public CExpression( CStackFrame frame, ICDIExpression cdiExpression, ICDIVariableDescriptor varObject ) { - super( frame, varObject ); - setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) ); - fText = cdiExpression.getExpressionText(); - fCDIExpression = cdiExpression; - fStackFrame = frame; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IExpression#getExpressionText() - */ - @Override - public String getExpressionText() { - return fText; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - for( int i = 0; i < events.length; i++ ) { - ICDIEvent event = events[i]; - ICDIObject source = event.getSource(); - - if ( event instanceof ICDIResumedEvent ) { - if ( source != null ) { - ICDITarget cdiTarget = source.getTarget(); - if ( getCDITarget().equals( cdiTarget ) ) { - setChanged( false ); - resetValue(); - } - } - } - - if ( event instanceof ICDIChangedEvent ) { - // If a variable is changed (by user or program), - // we should re-evaluate expressions. - // Though it's better we check if the changed variable - // is part of the expression, the effort required is not - // worth the gain. - // This is partial fix to bug 126262. It makes CDT behavior - // in line with JDT. - // The remaining problem (with both CDT & JDT) is: - // Due to platform bug, the change will not show up in - // Expression View until the view is redrawn (e.g. after stepping, - // or when the view is uncovered from background). In other words, - // if the Expression View is at the front (not covered) when the - // variable is changed, the change won't be reflected in the view. - if ( source instanceof ICDIVariable) { - setChanged( false ); - resetValue(); - } - } - } - super.handleDebugEvents( events ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICVariable#isEnabled() - */ - @Override - public boolean isEnabled() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICVariable#canEnableDisable() - */ - @Override - public boolean canEnableDisable() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.CVariable#isBookkeepingEnabled() - */ - @Override - protected boolean isBookkeepingEnabled() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IExpression#getValue() - */ - @Override - public IValue getValue() { - CStackFrame frame = (CStackFrame)getStackFrame(); - try { - return getValue( frame ); - } - catch( DebugException e ) { - } - return null; - } - - protected synchronized IValue getValue( CStackFrame context ) throws DebugException { - if ( fValue.equals( CValueFactory.NULL_VALUE ) ) { - if ( context.isSuspended() ) { - try { - ICDIValue value = fCDIExpression.getValue( context.getCDIStackFrame() ); - if ( value != null ) { - if ( value instanceof ICDIArrayValue ) { - ICType type = null; - try { - type = new CType( value.getType() ); - } - catch( CDIException e ) { - // ignore and use default type - } - if ( type != null && type.isArray() ) { - int[] dims = type.getArrayDimensions(); - if ( dims.length > 0 && dims[0] > 0 ) - fValue = CValueFactory.createIndexedValue( this, (ICDIArrayValue)value, 0, dims[0] ); - } - } - else { - fValue = CValueFactory.createValue( this, value ); - } - } - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - } - return fValue; - } - - @Override - protected ICStackFrame getStackFrame() { - return fStackFrame; - } - - @Override - protected void resetValue() { - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).reset(); - - // We can't just reset the value and toss the reference we've been - // holding. Those things have a dispose() method and that needs to be - // called when there is no further use for it (so debugger-engine - // objects tied to the value can be freed). We return the AbstractCValue - // as an IValue to the platform, which means the platform certainly - // isn't going to dispose of it (there is no IValue.dispose method). - // Notice that we call AbstractCValue.dispose in our dispose method - // above. So, naturally, we need to do the same here. But then what is - // the purpose of calling AbstractCValue.reset() if we just dispose of - // the object, anyway? This whole thing seems a bit screwy. We should - // either be holding on to the AbstractCValue and resetting it, or just - // discarding it. The reset above doesn't hurt, but it sure seems - // pointless. - ((AbstractCValue) fValue).dispose(); - } - fValue = CValueFactory.NULL_VALUE; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#getExpressionString() - */ - @Override - public String getExpressionString() throws DebugException { - return getExpressionText(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#dispose() - */ - @Override - public void dispose() { - if ( fCDIExpression != null ) { - try { - fCDIExpression.dispose(); - fCDIExpression = null; - } - catch( CDIException e ) { - } - } - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).dispose(); - fValue = CValueFactory.NULL_VALUE; - } - internalDispose( true ); - setDisposed( true ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICVariable#getType() - */ - @Override - public ICType getType() throws DebugException { - if ( isDisposed() ) - return null; - if ( fType == null ) { - synchronized( this ) { - if ( fType == null ) { - fType = ((ICValue)fValue).getType(); - } - } - } - return fType; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() - */ - @Override - public String getReferenceTypeName() throws DebugException { - ICType type = getType(); - return ( type != null ) ? type.getName() : ""; //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFloatingPointValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFloatingPointValue.java deleted file mode 100644 index 83ffacbf0d8..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFloatingPointValue.java +++ /dev/null @@ -1,44 +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.internal.core.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.type.ICDIDoubleValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatValue; - -/** - * Represents a value of a float or double variable type. - */ -public class CFloatingPointValue extends CValue { - - private Number fFloatingPointValue; - - /** - * Constructor for CFloatingPointValue. - */ - public CFloatingPointValue( CVariable parent, ICDIValue cdiValue ) { - super( parent, cdiValue ); - } - - public Number getFloatingPointValue() throws CDIException { - if ( fFloatingPointValue == null ) { - ICDIValue cdiValue = getUnderlyingValue(); - if ( cdiValue instanceof ICDIDoubleValue ) { - fFloatingPointValue = new Double( ((ICDIDoubleValue)cdiValue).doubleValue() ); - } - else if ( cdiValue instanceof ICDIFloatValue ) { - fFloatingPointValue = new Float( ((ICDIFloatValue)cdiValue).floatValue() ); - } - } - return fFloatingPointValue; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalValue.java deleted file mode 100644 index 230c8f0c1fe..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalValue.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.internal.core.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.debug.core.DebugException; - -public class CGlobalValue extends CValue -{ - private Boolean fHasChildren = null; - - - /** - * Constructor for CGlobalValue. - * @param parent - * @param cdiValue - */ - public CGlobalValue( CVariable parent, ICDIValue cdiValue ) - { - super( parent, cdiValue ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#hasVariables() - */ - @Override - public boolean hasVariables() throws DebugException - { - if ( fHasChildren == null ) - { - fHasChildren = Boolean.valueOf( super.hasVariables() ); - } - return fHasChildren.booleanValue(); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java deleted file mode 100644 index 9be52411c45..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java +++ /dev/null @@ -1,413 +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.internal.core.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2; -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.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.core.model.ICGlobalVariable; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; -import org.eclipse.debug.core.DebugException; - -/** - * Represents a global variable. - */ -public class CGlobalVariable extends CVariable implements ICGlobalVariable { - - private class InternalVariable implements IInternalVariable { - - /** - * The enclosing <code>CVariable</code> instance. - */ - private CVariable fVariable; - - /** - * The CDI variable object this variable is based on. - */ - private ICDIVariableDescriptor fCDIVariableObject; - - /** - * The underlying CDI variable. - */ - private ICDIVariable fCDIVariable; - - /** - * The type of this variable. - */ - private CType fType; - - /** - * The expression used to eveluate the value of this variable. - */ - private String fQualifiedName; - - /** - * The cache of the current value. - */ - private ICValue fValue = CValueFactory.NULL_VALUE; - - /** - * The change flag. - */ - private boolean fChanged = false; - - /** - * Constructor for InternalVariable. - */ - InternalVariable( CVariable var, ICDIVariableDescriptor varObject ) { - setVariable( var ); - setCDIVariableObject( varObject ); - setCDIVariable( (varObject instanceof ICDIVariable) ? (ICDIVariable)varObject : null ); - } - - @Override - public IInternalVariable createShadow( int start, int length ) throws DebugException { - IInternalVariable iv = null; - try { - iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsArray( start, length ) ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - return iv; - } - - @Override - public IInternalVariable createShadow( String type ) throws DebugException { - IInternalVariable iv = null; - try { - iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsType( type ) ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - return iv; - } - - private synchronized ICDIVariable getCDIVariable() throws DebugException { - if ( fCDIVariable == null ) { - try { - fCDIVariable = getCDITarget().createGlobalVariable( (ICDIGlobalVariableDescriptor)getCDIVariableObject() ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - return fCDIVariable; - } - - private void setCDIVariable( ICDIVariable variable ) { - fCDIVariable = variable; - } - - private ICDIVariableDescriptor getCDIVariableObject() { - if ( fCDIVariable != null ) { - return fCDIVariable; - } - return fCDIVariableObject; - } - - private void setCDIVariableObject( ICDIVariableDescriptor variableObject ) { - fCDIVariableObject = variableObject; - } - - @Override - public String getQualifiedName() throws DebugException { - if ( fQualifiedName == null ) { - try { - fQualifiedName = (fCDIVariableObject != null) ? fCDIVariableObject.getQualifiedName() : null; - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - return fQualifiedName; - } - - @Override - public CType getType() throws DebugException { - if ( fType == null ) { - ICDIVariableDescriptor varObject = getCDIVariableObject(); - if ( varObject != null ) { - synchronized( this ) { - if ( fType == null ) { - try { - fType = new CType( varObject.getType() ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - } - } - } - return fType; - } - - private synchronized void invalidate( boolean destroy ) { - try { - if ( destroy && fCDIVariable != null ) - fCDIVariable.dispose(); - } - catch( CDIException e ) { - logError( e.getMessage() ); - } - invalidateValue(); - setCDIVariable( null ); - if ( fType != null ) - fType.dispose(); - fType = null; - } - - @Override - public void dispose( boolean destroy ) { - invalidate( destroy ); - } - - @Override - public boolean isSameVariable( ICDIVariable cdiVar ) { - return ( fCDIVariable != null ) ? fCDIVariable.equals( cdiVar ) : false; - } - - @Override - public int sizeof() { - if ( getCDIVariableObject() != null ) { - try { - return getCDIVariableObject().sizeof(); - } - catch( CDIException e ) { - } - } - return 0; - } - - @Override - public boolean isArgument() { - return ( getCDIVariableObject() instanceof ICDIArgumentDescriptor ); - } - - @Override - public void setValue( String expression ) throws DebugException { - ICDIVariable cdiVariable = null; - try { - cdiVariable = getCDIVariable(); - if ( cdiVariable != null ) - cdiVariable.setValue( expression ); - else - requestFailed( CoreModelMessages.getString( "CModificationVariable.0" ), null ); //$NON-NLS-1$ - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - - @Override - public synchronized ICValue getValue() throws DebugException { - if ( fValue.equals( CValueFactory.NULL_VALUE ) ) { - ICDIVariable var = getCDIVariable(); - if ( var != null ) { - try { - ICDIValue cdiValue = var.getValue(); - if ( cdiValue != null ) { - ICDIType cdiType = cdiValue.getType(); - if ( cdiValue instanceof ICDIArrayValue && cdiType != null ) { - ICType type = new CType( cdiType ); - if ( type.isArray() ) { - int[] dims = type.getArrayDimensions(); - if ( dims.length > 0 && dims[0] > 0 ) - fValue = CValueFactory.createIndexedValue( getVariable(), (ICDIArrayValue)cdiValue, 0, dims[0] ); - } - } - else { - fValue = CValueFactory.createValue( getVariable(), cdiValue ); - } - } - if (getCDITarget().getConfiguration() instanceof ICDITargetConfiguration2 && - ((ICDITargetConfiguration2)getCDITarget().getConfiguration()).supportsRuntimeTypeIdentification()) - fType = null; // When the debugger supports RTTI getting a new value may also mean a new type. - } - catch( CDIException e ) { - requestFailed( e.getMessage(), e ); - } - } - } - return fValue; - } - - @Override - public void invalidateValue() { - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).dispose(); - fValue = CValueFactory.NULL_VALUE; - } - } - - @Override - public boolean isChanged() { - return fChanged; - } - - @Override - public synchronized void setChanged( boolean changed ) { - if ( changed ) { - invalidateValue(); - } - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).setChanged( changed ); - } - fChanged = changed; - } - - @Override - public synchronized void preserve() { - setChanged( false ); - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).preserve(); - } - } - - CVariable getVariable() { - return fVariable; - } - - private void setVariable( CVariable variable ) { - fVariable = variable; - } - - @Override - public void resetValue() { - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).reset(); - } - } - - @Override - public boolean isEditable() throws DebugException { - ICDIVariable var = getCDIVariable(); - if ( var != null ) { - try { - return var.isEditable(); - } - catch( CDIException e ) { - } - } - return false; - } - - /** - * Compares the underlying variable objects. - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals( Object obj ) { - if ( obj instanceof InternalVariable ) { - return getCDIVariableObject().equals( ((InternalVariable)obj).getCDIVariableObject() ); - } - return false; - } - - @Override - public boolean isSameDescriptor( ICDIVariableDescriptor desc ) { - return getCDIVariableObject().equals( desc ); - } - - @Override - public ICDIObject getCdiObject() { - return fCDIVariable; - } - } - - /** - * Will be null for a child of a global (array member, struct field, etc) - */ - private IGlobalVariableDescriptor fDescriptor; - - /** - * Constructor for CGlobalVariable. - */ - protected CGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableDescriptor cdiVariableObject ) { - super( parent, cdiVariableObject ); - fDescriptor = descriptor; - } - - /** - * Constructor for CGlobalVariable. - */ - protected CGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableDescriptor cdiVariableObject, String message ) { - super( parent, cdiVariableObject, message ); - fDescriptor = descriptor; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICVariable#canEnableDisable() - */ - @Override - public boolean canEnableDisable() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - for( int i = 0; i < events.length; i++ ) { - ICDIEvent event = events[i]; - if ( event instanceof ICDIResumedEvent ) { - ICDIObject source = event.getSource(); - if ( source != null ) { - ICDITarget cdiTarget = source.getTarget(); - if ( getCDITarget().equals( cdiTarget ) ) { - setChanged( false ); - } - } - } - } - super.handleDebugEvents( events ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICGlobalVariable#getDescriptor() - */ - @Override - public IGlobalVariableDescriptor getDescriptor() { - return fDescriptor; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#dispose() - */ - @Override - public void dispose() { - internalDispose( true ); - setDisposed( true ); - } - - @Override - protected void createOriginal( ICDIVariableDescriptor vo ) { - if ( vo != null ) { - setName( vo.getName() ); - setOriginal( new InternalVariable( this, vo ) ); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java deleted file mode 100644 index f04ae203fb1..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java +++ /dev/null @@ -1,315 +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 - * Mathias Kunter - Support for octal number format (bug 370462) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.math.BigInteger; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; -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.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.core.model.CVariableFormat; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.utils.Addr32; -import org.eclipse.cdt.utils.Addr64; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IIndexedValue; -import org.eclipse.debug.core.model.IVariable; - -/** - * A value containing an array of variables. - */ -public class CIndexedValue extends AbstractCValue implements IIndexedValue { - - /** - * The underlying CDI value. - */ - private ICDIArrayValue fCDIValue; - - /** - * Child variables. Only the variables from loaded partitions will be held. - * Use map instead of a java array to scale for large number of children. - */ - private Map<Integer, IVariable> fVariables; - - /** - * The index of the first variable contained in this value. - */ - private int fOffset; - - /** - * The number of entries in this indexed collection. - */ - private int fSize; - - /** - * The type of this value. - */ - private ICType fType; - - /** - * Constructor for CIndexedValue. - */ - public CIndexedValue( AbstractCVariable parent, ICDIArrayValue cdiValue, int offset, int size ) { - super( parent ); - fVariables = new HashMap<Integer, IVariable>(getPreferredPartitionSize()); - fCDIValue = cdiValue; - fOffset = offset; - fSize = size; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#setChanged(boolean) - */ - @Override - protected void setChanged( boolean changed ) { - for (IVariable var : fVariables.values()) { - ((AbstractCVariable)var).setChanged( changed ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#dispose() - */ - @Override - public void dispose() { - for (IVariable var : fVariables.values()) { - ((AbstractCVariable)var).dispose(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#reset() - */ - @Override - protected void reset() { - for (IVariable var : fVariables.values()) { - ((AbstractCVariable)var).resetValue(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#preserve() - */ - @Override - protected void preserve() { - resetStatus(); - for (IVariable var : fVariables.values()) { - ((AbstractCVariable)var).preserve(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICValue#getType() - */ - @Override - public ICType getType() throws DebugException { - if ( fType == null ) { - synchronized( this ) { - if ( fType == null ) { - try { - ICDIType cdiType = getCDIValue().getType(); - if ( cdiType != null ) - fType = new CType( cdiType ); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - } - } - return fType; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() - */ - @Override - public String getReferenceTypeName() throws DebugException { - ICType type = getType(); - return ( type != null ) ? type.getName() : ""; //$NON-NLS-1$ - } - - /** - * Please note that this function returns the address of the array, not the - * contents of the array, as long as the underlying ICDIArrayValue is an - * instance of ICDIPointerValue. Otherwise, it returns an empty string. - * - * @see org.eclipse.debug.core.model.IValue#getValueString() - */ - @Override - public String getValueString() throws DebugException { - if ( fCDIValue instanceof ICDIPointerValue ) { - try { - IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); - BigInteger pv = ((ICDIPointerValue)fCDIValue).pointerValue(); - if ( pv == null ) - return ""; //$NON-NLS-1$ - IAddress address = factory.createAddress( pv ); - if ( address == null ) - return ""; //$NON-NLS-1$ - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) - return address.toHexAddressString(); - else if ( CVariableFormat.DECIMAL.equals( format ) ) - return address.toString(); - else if ( CVariableFormat.OCTAL.equals( format ) ) { - // Using the instanceof operator here to avoid API change - // Add IAddress.toOctalAddressString() in a future CDT release - if (address instanceof Addr32) { - return ((Addr32)address).toOctalAddressString(); - } else if (address instanceof Addr64) { - return ((Addr64)address).toOctalAddressString(); - } else { - // Fall back to hexadecimal address format - return address.toHexAddressString(); - } - } else if ( CVariableFormat.BINARY.equals( format ) ) - return address.toBinaryAddressString(); - return null; - } catch (CDIException e) { - requestFailed( e.getMessage(), null ); - } - } - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#isAllocated() - */ - @Override - public boolean isAllocated() throws DebugException { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getVariables() - */ - @Override - public IVariable[] getVariables() throws DebugException { - return getVariables0( getInitialOffset(), getSize() ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#hasVariables() - */ - @Override - public boolean hasVariables() throws DebugException { - return getSize() > 0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IIndexedValue#getVariable(int) - */ - @Override - public IVariable getVariable( int offset ) throws DebugException { - if ( offset >= getSize() ) { - requestFailed( CoreModelMessages.getString( "CIndexedValue.0" ), null ); //$NON-NLS-1$ - } - return getVariables0( offset, 1 )[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IIndexedValue#getVariables(int, int) - */ - @Override - public IVariable[] getVariables( int offset, int length ) throws DebugException { - if ( offset >= getSize() ) { - requestFailed( CoreModelMessages.getString( "CIndexedValue.1" ), null ); //$NON-NLS-1$ - } - if ( (offset + length - 1) >= getSize() ) { - requestFailed( CoreModelMessages.getString( "CIndexedValue.2" ), null ); //$NON-NLS-1$ - } - return getVariables0( offset, length ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IIndexedValue#getSize() - */ - @Override - public int getSize() throws DebugException { - return getSize0(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IIndexedValue#getInitialOffset() - */ - @Override - public int getInitialOffset() { - return fOffset; - } - - protected ICDIArrayValue getCDIValue() { - return fCDIValue; - } - - private int getPartitionSize( int index ) { - int psize = getPreferredPartitionSize(); - int size = getSize0(); - int pcount = size/psize + 1; - if ( pcount - 1 < index ) - return 0; - return ( pcount - 1 == index ) ? size % psize : psize; - } - - private int getPartitionIndex( int offset ) { - return offset / getPreferredPartitionSize(); - } - - private int getPreferredPartitionSize() { - return 100; - } - - private IVariable[] getVariables0( int offset, int length ) throws DebugException { - IVariable[] result = new IVariable[length]; - int firstIndex = getPartitionIndex( offset ); - int lastIndex = getPartitionIndex( offset + Math.max( length - 1, 0 ) ); - for ( int i = firstIndex; i <= lastIndex; ++i ) { - synchronized( this ) { - if ( !isPartitionLoaded( i ) ) { - loadPartition( i ); - } - } - } - for (int i = 0; i < length; i++) { - result[i] = fVariables.get( offset + i ); - } - return result; - } - - private boolean isPartitionLoaded( int index ) { - return fVariables.containsKey(index * getPreferredPartitionSize()); - } - - private void loadPartition( int index ) throws DebugException { - int prefSize = getPreferredPartitionSize(); - int psize = getPartitionSize( index ); - ICDIVariable[] cdiVars = new ICDIVariable[0]; - try { - cdiVars = getCDIValue().getVariables( index * prefSize, psize ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - for( int i = 0; i < cdiVars.length; ++i ) - fVariables.put(i + index * prefSize, CVariableFactory.createLocalVariable( this, cdiVars[i] )); - } - - private int getSize0() { - return fSize; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CLocalVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CLocalVariable.java deleted file mode 100644 index cfb67a2978f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CLocalVariable.java +++ /dev/null @@ -1,353 +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.internal.core.model; - -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.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2; -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.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.debug.core.DebugException; - - -public class CLocalVariable extends CVariable { - - private class InternalVariable implements IInternalVariable { - - /** - * The enclosing <code>CVariable</code> instance. - */ - private CVariable fVariable; - - /** - * The CDI variable object this variable is based on. - */ - private ICDIVariableDescriptor fCDIVariableObject; - - /** - * The underlying CDI variable. - */ - private ICDIVariable fCDIVariable; - - /** - * The type of this variable. - */ - private CType fType; - - /** - * The expression used to eveluate the value of this variable. - */ - private String fQualifiedName; - - /** - * The cache of the current value. - */ - private ICValue fValue = CValueFactory.NULL_VALUE; - - /** - * The change flag. - */ - private boolean fChanged = false; - - /** - * Constructor for InternalVariable. - */ - InternalVariable( CVariable var, ICDIVariableDescriptor varObject ) { - setVariable( var ); - setCDIVariableObject( varObject ); - setCDIVariable( (varObject instanceof ICDIVariable) ? (ICDIVariable)varObject : null ); - } - - @Override - public IInternalVariable createShadow( int start, int length ) throws DebugException { - IInternalVariable iv = null; - try { - iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsArray( start, length ) ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - return iv; - } - - @Override - public IInternalVariable createShadow( String type ) throws DebugException { - IInternalVariable iv = null; - try { - iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsType( type ) ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - return iv; - } - - private synchronized ICDIVariable getCDIVariable() throws DebugException { - if ( fCDIVariable == null ) { - try { - fCDIVariable = ((CStackFrame)getStackFrame()).getCDIStackFrame().createLocalVariable( (ICDILocalVariableDescriptor)getCDIVariableObject() ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - return fCDIVariable; - } - - private void setCDIVariable( ICDIVariable variable ) { - fCDIVariable = variable; - } - - private ICDIVariableDescriptor getCDIVariableObject() { - if ( fCDIVariable != null ) { - return fCDIVariable; - } - return fCDIVariableObject; - } - - private void setCDIVariableObject( ICDIVariableDescriptor variableObject ) { - fCDIVariableObject = variableObject; - } - - @Override - public String getQualifiedName() throws DebugException { - if ( fQualifiedName == null ) { - try { - fQualifiedName = (fCDIVariableObject != null) ? fCDIVariableObject.getQualifiedName() : null; - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - return fQualifiedName; - } - - @Override - public CType getType() throws DebugException { - if ( fType == null ) { - ICDIVariableDescriptor varObject = getCDIVariableObject(); - if ( varObject != null ) { - synchronized( this ) { - if ( fType == null ) { - try { - fType = new CType( varObject.getType() ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - } - } - } - return fType; - } - - private synchronized void invalidate( boolean destroy ) { - try { - if ( destroy && fCDIVariable != null ) - fCDIVariable.dispose(); - } - catch( CDIException e ) { - logError( e.getMessage() ); - } - invalidateValue(); - setCDIVariable( null ); - if ( fType != null ) - fType.dispose(); - fType = null; - } - - @Override - public void dispose( boolean destroy ) { - invalidate( destroy ); - } - - @Override - public boolean isSameVariable( ICDIVariable cdiVar ) { - return ( fCDIVariable != null ) ? fCDIVariable.equals( cdiVar ) : false; - } - - @Override - public int sizeof() { - if ( getCDIVariableObject() != null ) { - try { - return getCDIVariableObject().sizeof(); - } - catch( CDIException e ) { - } - } - return 0; - } - - @Override - public boolean isArgument() { - return ( getCDIVariableObject() instanceof ICDIArgumentDescriptor ); - } - - @Override - public void setValue( String expression ) throws DebugException { - ICDIVariable cdiVariable = null; - try { - cdiVariable = getCDIVariable(); - if ( cdiVariable != null ) - cdiVariable.setValue( expression ); - else - requestFailed( CoreModelMessages.getString( "CModificationVariable.0" ), null ); //$NON-NLS-1$ - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - - @Override - public synchronized ICValue getValue() throws DebugException { - if ( fValue.equals( CValueFactory.NULL_VALUE ) ) { - ICDIVariable var = getCDIVariable(); - if ( var != null ) { - try { - ICDIValue cdiValue = var.getValue(); - if ( cdiValue != null ) { - ICDIType cdiType = cdiValue.getType(); - if ( cdiValue instanceof ICDIArrayValue && cdiType != null ) { - ICType type = new CType( cdiType ); - if ( type.isArray() ) { - int[] dims = type.getArrayDimensions(); - if ( dims.length > 0 && dims[0] > 0 ) - fValue = CValueFactory.createIndexedValue( getVariable(), (ICDIArrayValue)cdiValue, 0, dims[0] ); - } - } - else { - fValue = CValueFactory.createValue( getVariable(), cdiValue ); - } - } - if (getCDITarget().getConfiguration() instanceof ICDITargetConfiguration2 && - ((ICDITargetConfiguration2)getCDITarget().getConfiguration()).supportsRuntimeTypeIdentification()) - fType = null; // When the debugger supports RTTI getting a new value may also mean a new type. - } - catch( CDIException e ) { - requestFailed( e.getMessage(), e ); - } - } - } - return fValue; - } - - @Override - public void invalidateValue() { - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).dispose(); - fValue = CValueFactory.NULL_VALUE; - } - } - - @Override - public boolean isChanged() { - return fChanged; - } - - @Override - public synchronized void setChanged( boolean changed ) { - if ( changed ) { - invalidateValue(); - } - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).setChanged( changed ); - } - fChanged = changed; - } - - @Override - public synchronized void preserve() { - setChanged( false ); - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).preserve(); - } - } - - CVariable getVariable() { - return fVariable; - } - - private void setVariable( CVariable variable ) { - fVariable = variable; - } - - @Override - public void resetValue() { - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).reset(); - } - } - - @Override - public boolean isEditable() throws DebugException { - ICDIVariable var = getCDIVariable(); - if ( var != null ) { - try { - return var.isEditable(); - } - catch( CDIException e ) { - } - } - return false; - } - - /** - * Compares the underlying variable objects. - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals( Object obj ) { - if ( obj instanceof InternalVariable ) { - return getCDIVariableObject().equals( ((InternalVariable)obj).getCDIVariableObject() ); - } - return false; - } - - @Override - public boolean isSameDescriptor( ICDIVariableDescriptor desc ) { - return getCDIVariableObject().equals( desc ); - } - @Override - public ICDIObject getCdiObject() { - return fCDIVariable; - } - } - - /** - * Constructor for CLocalVariable. - */ - public CLocalVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject, String errorMessage ) { - super( parent, cdiVariableObject, errorMessage ); - } - - /** - * Constructor for CLocalVariable. - */ - public CLocalVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject ) { - super( parent, cdiVariableObject ); - } - - @Override - protected void createOriginal( ICDIVariableDescriptor vo ) { - if ( vo != null ) { - setName( vo.getName() ); - setOriginal( new InternalVariable( this, vo ) ); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CMemoryBlockExtension.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CMemoryBlockExtension.java deleted file mode 100644 index 9f4fb6d0697..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CMemoryBlockExtension.java +++ /dev/null @@ -1,604 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.math.BigInteger; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -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.event.ICDIMemoryChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIRestartedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement2; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceEncoder; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.model.IExecFileInfo; -import org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlock; -import org.eclipse.cdt.debug.internal.core.CMemoryBlockRetrievalExtension; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IMemoryBlockRetrieval; -import org.eclipse.debug.core.model.MemoryByte; - -/** - * Represents a memory block in the CDI model. - */ -public class CMemoryBlockExtension extends CDebugElement implements IMemorySpaceAwareMemoryBlock, ICDIEventListener { - - /** - * The address expression this memory block is based on. - */ - private String fExpression; - - /** - * The base address of this memory block. - */ - private BigInteger fBaseAddress; - - /** - * The memory space identifier; will be null for backends that - * don't require memory space support - */ - private String fMemorySpaceID; - - /** - * The underlying CDI memory block. - */ - private ICDIMemoryBlock fCDIBlock; - - /** - * The memory bytes values. - */ - private MemoryByte[] fBytes = null; - - private Set<BigInteger> fChanges = new HashSet<BigInteger>(); - - /** - * is fWordSize available? - */ - private boolean fHaveWordSize; - - /** - * The number of bytes per address. - */ - private int fWordSize; - - - /** - * Constructor - */ - public CMemoryBlockExtension( CDebugTarget target, String expression, BigInteger baseAddress ) { - this(target, expression, baseAddress, null); - } - - /** - * Constructor that takes a memory space identifier - */ - @SuppressWarnings("deprecation") - public CMemoryBlockExtension( CDebugTarget target, String expression, BigInteger baseAddress, String memorySpaceID ) { - super( target ); - - fBaseAddress = baseAddress; - fMemorySpaceID = memorySpaceID; - - if (memorySpaceID == null) { - fExpression = expression; - } - else { - assert memorySpaceID.length() > 0; - ICDITarget cdiTarget = target.getCDITarget(); - if (cdiTarget instanceof ICDIMemorySpaceEncoder) { - // new interface - fExpression = ((ICDIMemorySpaceEncoder)cdiTarget).encodeAddress(expression, memorySpaceID); - } - else if (cdiTarget instanceof ICDIMemorySpaceManagement) { - // old interface - fExpression = ((ICDIMemorySpaceManagement)target.getCDITarget()).addressToString(baseAddress, memorySpaceID); - } - - if (fExpression == null) { - // If the backend supports memory spaces, it should implement ICDIMemorySpaceManagement - // Even if it does, it may choose to use our built-in encoding/decoding - fExpression = CMemoryBlockRetrievalExtension.encodeAddressDefault(expression, memorySpaceID); - } - } - - } - - /** - * Constructor that takes the addressable size - */ - public CMemoryBlockExtension( CDebugTarget target, String expression, BigInteger baseAddress, int wordSize ) { - this( target, expression, baseAddress, wordSize, null ); - } - - /** - * Constructor that takes the addressable size and a memory space identifier - */ - public CMemoryBlockExtension( CDebugTarget target, String expression, BigInteger baseAddress, int wordSize, String memorySpaceID ) { - super( target ); - fExpression = expression; - fBaseAddress = baseAddress; - fWordSize= wordSize; - fHaveWordSize= true; - fMemorySpaceID = memorySpaceID; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getExpression() - */ - @Override - public String getExpression() { - return fExpression; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getBigBaseAddress() - */ - @Override - public BigInteger getBigBaseAddress() { - return fBaseAddress; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getAddressSize() - */ - @Override - public int getAddressSize() { - return ((CDebugTarget)getDebugTarget()).getAddressFactory().createAddress( getBigBaseAddress() ).getSize(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getAddressableSize() - */ - @Override - public int getAddressableSize() throws DebugException { - if (!fHaveWordSize) { - synchronized (this) { - if (!fHaveWordSize) { - ICDIMemoryBlock block= getCDIBlock(); - if (block == null) { - try { - // create a CDI block of an arbitrary size so we can call into - // the backend to determine the memory's addressable size - setCDIBlock( block= createCDIBlock( fBaseAddress, 100 )); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - if (block != null) { - fWordSize= block.getWordSize(); - fHaveWordSize= true; - } - } - } - } - return fWordSize; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#supportBaseAddressModification() - */ - @Override - public boolean supportBaseAddressModification() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#setBaseAddress(java.math.BigInteger) - */ - @Override - public void setBaseAddress( BigInteger address ) throws DebugException { - BigInteger current = fBaseAddress; - if (current == address || (current != null && current.equals(address))) { - return; // optimization - } - fBaseAddress = address; - fireChangeEvent(DebugEvent.STATE); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getBytesFromOffset(java.math.BigInteger, long) - */ - @Override - public MemoryByte[] getBytesFromOffset( BigInteger unitOffset, long addressableUnits ) throws DebugException { - return getBytesFromAddress(unitOffset.add(getBigBaseAddress()) , addressableUnits); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getBytesFromAddress(java.math.BigInteger, long) - */ - @Override - public MemoryByte[] getBytesFromAddress( BigInteger address, long length ) throws DebugException { - ICDIMemoryBlock cdiBlock = getCDIBlock(); - if ( fBytes == null || cdiBlock == null || - cdiBlock.getStartAddress().compareTo( address ) > 0 || - cdiBlock.getStartAddress().add( BigInteger.valueOf( cdiBlock.getLength()/cdiBlock.getWordSize() ) ).compareTo( address.add( BigInteger.valueOf( length ) ) ) < 0 ) { - synchronized( this ) { - byte[] bytes = null; - try { - cdiBlock = getCDIBlock(); - if ( cdiBlock == null || - cdiBlock.getStartAddress().compareTo( address ) > 0 || - cdiBlock.getStartAddress().add( BigInteger.valueOf( cdiBlock.getLength()/cdiBlock.getWordSize() ) ).compareTo( address.add( BigInteger.valueOf( length ) ) ) < 0 ) { - if ( cdiBlock != null ) { - disposeCDIBlock(); - fBytes = null; - } - setCDIBlock( cdiBlock = createCDIBlock( address, length ) ); - } - bytes = getCDIBlock().getBytes(); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - if (bytes != null) { - fBytes = new MemoryByte[bytes.length]; - for ( int i = 0; i < bytes.length; ++i ) { - fBytes[i] = createMemoryByte( bytes[i], getCDIBlock().getFlags( i ), hasChanged( getRealBlockAddress().add( BigInteger.valueOf( i ) ) ) ); - } - } - } - } - MemoryByte[] result = new MemoryByte[0]; - if ( fBytes != null && cdiBlock != null ) { - int offset = address.subtract( getRealBlockAddress() ).intValue(); - int offsetInBytes = offset * cdiBlock.getWordSize(); - long lengthInBytes = length * cdiBlock.getWordSize(); - if ( offset >= 0 ) { - int size = ( fBytes.length - offsetInBytes >= lengthInBytes ) ? (int)lengthInBytes : fBytes.length - offsetInBytes; - if ( size > 0 ) { - result = new MemoryByte[size]; - System.arraycopy( fBytes, offsetInBytes, result, 0, size ); - } - } - } - return result; - } - - private boolean isBigEndian() { - IExecFileInfo info = getDebugTarget().getAdapter( IExecFileInfo.class ); - if ( info != null ) { - return !info.isLittleEndian(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getMemoryBlockRetrieval() - */ - @Override - public IMemoryBlockRetrieval getMemoryBlockRetrieval() { - return getDebugTarget().getAdapter( IMemoryBlockRetrieval.class ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - for( int i = 0; i < events.length; i++ ) { - ICDIEvent event = events[i]; - ICDIObject source = event.getSource(); - if ( source == null ) - continue; - if ( source.getTarget().equals( getCDITarget() ) ) { - if ( event instanceof ICDIResumedEvent || event instanceof ICDIRestartedEvent ) { - resetChanges(); - } - else if ( event instanceof ICDIMemoryChangedEvent ) { - if ( source instanceof ICDIMemoryBlock && source.equals( getCDIBlock() ) ) { - handleChangedEvent( (ICDIMemoryChangedEvent)event ); - } - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress() - */ - @Override - public long getStartAddress() { - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlock#getLength() - */ - @Override - public long getLength() { - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlock#getBytes() - */ - @Override - public byte[] getBytes() throws DebugException { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlock#supportsValueModification() - */ - @Override - public boolean supportsValueModification() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlock#setValue(long, byte[]) - */ - @Override - public void setValue( long offset, byte[] bytes ) throws DebugException { - setValue( BigInteger.valueOf( offset ), bytes ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#setValue(java.math.BigInteger, byte[]) - */ - @Override - public void setValue( BigInteger offset, byte[] bytes ) throws DebugException { - ICDIMemoryBlock block = getCDIBlock(); - if ( block != null ) { - BigInteger base = getBigBaseAddress(); - BigInteger real = getRealBlockAddress(); - long realOffset = base.add( offset ).subtract( real ).longValue(); - try { - block.setValue( realOffset, bytes ); - } - catch( CDIException e ) { - targetRequestFailed( e.getDetailMessage(), null ); - } - } - } - - private ICDIMemoryBlock createCDIBlock( BigInteger address, long length) throws CDIException { - ICDIMemoryBlock block = null; - CDebugTarget target = (CDebugTarget)getDebugTarget(); - ICDITarget cdiTarget = target.getCDITarget(); - if ((fMemorySpaceID != null) && (cdiTarget instanceof ICDIMemoryBlockManagement2)) { - block = ((ICDIMemoryBlockManagement2)cdiTarget).createMemoryBlock(address, fMemorySpaceID, (int)length); - } else { - // Note that CDI clients should ignore the word size - // parameter. It has been deprecated in 4.0. We continue to - // pass in 1 as has always been the case to maintain backwards - // compatibility. - block = cdiTarget.createMemoryBlock( address.toString(), (int)length, 1); - } - block.setFrozen( false ); - getCDISession().getEventManager().addEventListener( this ); - return block; - } - - private void disposeCDIBlock() { - ICDIMemoryBlock block = getCDIBlock(); - if ( block != null ) { - try { - ((CDebugTarget)getDebugTarget()).getCDITarget().removeBlocks( new ICDIMemoryBlock[]{ block }); - } - catch( CDIException e ) { - DebugPlugin.log( e ); - } - setCDIBlock( null ); - getCDISession().getEventManager().removeEventListener( this ); - } - } - - private ICDIMemoryBlock getCDIBlock() { - return fCDIBlock; - } - - private void setCDIBlock( ICDIMemoryBlock cdiBlock ) { - fCDIBlock = cdiBlock; - } - - private BigInteger getRealBlockAddress() { - ICDIMemoryBlock block = getCDIBlock(); - return ( block != null ) ? block.getStartAddress() : BigInteger.ZERO; - } - - private long getBlockSize() { - ICDIMemoryBlock block = getCDIBlock(); - return ( block != null ) ? block.getLength() : 0; - } - - private void handleChangedEvent( ICDIMemoryChangedEvent event ) { - ICDIMemoryBlock block = getCDIBlock(); - if ( block != null && fBytes != null ) { - MemoryByte[] memBytes = fBytes.clone(); - try { - BigInteger start = getRealBlockAddress(); - long length = block.getLength(); - byte[] newBytes = block.getBytes(); - BigInteger[] addresses = event.getAddresses(); - saveChanges( addresses ); - for ( int i = 0; i < addresses.length; ++i ) { - fChanges.add( addresses[i] ); - int addressableSize = fCDIBlock.getWordSize(); // # of bytes per address - if ( addresses[i].compareTo( start ) >= 0 && addresses[i].compareTo( start.add( BigInteger.valueOf( length / addressableSize ) ) ) < 0 ) { - int index = addressableSize * addresses[i].subtract( start ).intValue(); - int end = Math.min(Math.min(index + addressableSize, memBytes.length), newBytes.length); - for (index = Math.max(index, 0) ; index < end; index++ ) { - memBytes[index].setChanged( true ); - memBytes[index].setValue( newBytes[index] ); - } - } - } - fBytes = memBytes; - fireChangeEvent( DebugEvent.CONTENT ); - } - catch( CDIException e ) { - DebugPlugin.log( e ); - } - } - } - - private void saveChanges( BigInteger[] addresses ) { - fChanges.addAll( Arrays.asList( addresses ) ); - } - - private boolean hasChanged( BigInteger address ) { - return fChanges.contains( address ); - } - - private void resetChanges() { - if ( fBytes != null ) { - BigInteger[] changes = fChanges.toArray( new BigInteger[fChanges.size()] ); - for ( int i = 0; i < changes.length; ++i ) { - BigInteger real = getRealBlockAddress(); - if ( real.compareTo( changes[i] ) <= 0 && real.add( BigInteger.valueOf( getBlockSize() ) ).compareTo( changes[i] ) > 0 ) { - int index = changes[i].subtract( real ).intValue(); - if ( index >= 0 && index < fBytes.length ) { - fBytes[index].setChanged( false ); - } - } - } - } - fChanges.clear(); - fireChangeEvent( DebugEvent.CONTENT ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#supportsChangeManagement() - */ - @Override - public boolean supportsChangeManagement() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#connect(java.lang.Object) - */ - @Override - public void connect( Object object ) { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#disconnect(java.lang.Object) - */ - @Override - public void disconnect( Object object ) { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getConnections() - */ - @Override - public Object[] getConnections() { - // TODO Auto-generated method stub - return new Object[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#dispose() - */ - @Override - public void dispose() { - fChanges.clear(); - ICDIMemoryBlock cdiBlock = getCDIBlock(); - if ( cdiBlock != null ) { - try { - ((CDebugTarget)getDebugTarget()).getCDITarget().removeBlocks( new ICDIMemoryBlock[] {cdiBlock} ); - } - catch( CDIException e ) { - CDebugCorePlugin.log( e ); - } - fCDIBlock = null; - } - final ICDISession cdiSession = getCDISession(); - if (cdiSession != null) { - cdiSession.getEventManager().removeEventListener( this ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - @SuppressWarnings("rawtypes") - public Object getAdapter( Class adapter ) { - if ( IMemoryBlockRetrieval.class.equals( adapter ) ) - return getMemoryBlockRetrieval(); - return super.getAdapter( adapter ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getMemoryBlockStartAddress() - */ - @Override - public BigInteger getMemoryBlockStartAddress() throws DebugException { - return null; // return null to mean not bounded ... according to the spec - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getMemoryBlockEndAddress() - */ - @Override - public BigInteger getMemoryBlockEndAddress() throws DebugException { - return null;// return null to mean not bounded ... according to the spec - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getBigLength() - */ - @Override - public BigInteger getBigLength() throws DebugException { - ICDIMemoryBlock block = getCDIBlock(); - if ( block != null ) { - BigInteger length = new BigInteger( Long.toHexString( block.getLength() ), 16 ); - return length; - } - return BigInteger.ZERO; - } - - private MemoryByte createMemoryByte( byte value, byte cdiFlags, boolean changed ) { - byte flags = 0; - if ( (cdiFlags & ICDIMemoryBlock.VALID) != 0 ) { - flags |= MemoryByte.HISTORY_KNOWN | MemoryByte.ENDIANESS_KNOWN; - if ( (cdiFlags & ICDIMemoryBlock.READ_ONLY) != 0 ) { - flags |= MemoryByte.READABLE; - } - else { - flags |= MemoryByte.READABLE | MemoryByte.WRITABLE; - } - if ( isBigEndian() ) { - flags |= MemoryByte.BIG_ENDIAN; - } - if ( changed ) - flags |= MemoryByte.CHANGED; - } - return new MemoryByte( value, flags ); - } - - - /** - * @see org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlock#getMemorySpaceID() - */ - @Override - public String getMemorySpaceID() { - return fMemorySpaceID; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModule.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModule.java deleted file mode 100644 index 8789fe5c727..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModule.java +++ /dev/null @@ -1,314 +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.internal.core.model; - -import java.math.BigInteger; -import com.ibm.icu.text.MessageFormat; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.IBinary; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.ISourceRoot; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; -import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.internal.core.model.Binary; -import org.eclipse.cdt.internal.core.model.CModelManager; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.DebugException; - -/** - * The CDI based implementation of <code>ICModule</code>. - * - * This implementation is experimental and needs to be changed when - * the CDI level support is available. - */ -public class CModule extends CDebugElement implements ICModule { - - private int fType = 0; - - private Binary fBinary; - - private ICDIObject fCDIObject; - - private IPath fImageName; - - private IPath fSymbolsFileName; - - public static CModule createExecutable( CDebugTarget target, IPath path ) { - // TODO Add support for executables to CDI. - return new CModule( EXECUTABLE, target, path ); - } - - public static CModule createSharedLibrary( CDebugTarget target, ICDISharedLibrary lib ) { - return new CModule( SHARED_LIBRARY, target, lib ); - } - - /** - * Constructor for CModule. Used for the program. - */ - private CModule( int type, CDebugTarget target, IPath path ) { - super( target ); - fType = type; - fBinary = createBinary(path); - fCDIObject = null; - fImageName = path; - fSymbolsFileName = path; - } - - /** - * Constructor for CModule. Used for shared libraries. - */ - private CModule( int type, CDebugTarget target, ICDIObject cdiObject ) { - super( target ); - fType = type; - if ( cdiObject instanceof ICDISharedLibrary ) { - ICDISharedLibrary cdiSharedLib = (ICDISharedLibrary)cdiObject; - fBinary = createBinary(new Path(cdiSharedLib.getFileName())); - } - fCDIObject = cdiObject; - fImageName = ( ( cdiObject instanceof ICDISharedLibrary ) ) ? new Path( ((ICDISharedLibrary)cdiObject).getFileName() ) : new Path( CoreModelMessages.getString( "CModule.0" ) ); //$NON-NLS-1$ - fSymbolsFileName = fImageName; - } - - /** - * We used to ask the CoreModel to create the Binary (ICElement) for us but - * it will do so only for binary files that are in a project output - * directory (for performance reasons). So, we do all the leg work - * ourselves, duplicating much of the code, unfortunately. - * - * THE OLD WAY... - * fCElement = CoreModel.getDefault().create(path); - */ - private Binary createBinary(IPath path) { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IFile file = root.getFileForLocation(path); - if (file != null && !file.exists()) { - file = null; - } - - // In case this is an external resource see if we can find - // a file for it. - if (file == null) { - IFile[] files = root.findFilesForLocation(path); - if (files.length > 0) { - file = files[0]; - } - } - - if (file != null) { - ICProject cproject = CoreModel.getDefault().create(file.getProject()); - IPath resourcePath = file.getParent().getFullPath(); - - try { - ICElement cfolder = cproject.findElement(resourcePath); - - // Check if folder is a source root and use that instead - ISourceRoot sourceRoot = cproject.findSourceRoot(resourcePath); - if (sourceRoot != null) - cfolder = sourceRoot; - - IBinaryFile bin = CModelManager.getDefault().createBinaryFile(file); - if (bin != null) { - return new Binary(cfolder, file, (IBinaryObject)bin); - } - } catch (CModelException e) { - CDebugCorePlugin.log(e); - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getType() - */ - @Override - public int getType() { - return fType; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getName() - */ - @Override - public String getName() { - return fImageName.lastSegment().toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getImageName() - */ - @Override - public IPath getImageName() { - return fImageName; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getSymbolsFileName() - */ - @Override - public IPath getSymbolsFileName() { - return fSymbolsFileName; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#setSymbolsFileName(org.eclipse.core.runtime.IPath) - */ - @Override - public void setSymbolsFileName( IPath symbolsFile ) throws DebugException { - loadSymbolsFromFile( symbolsFile ); - fSymbolsFileName = symbolsFile; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getBaseAddress() - */ - @Override - public IAddress getBaseAddress() { - return ( fCDIObject instanceof ICDISharedLibrary ) ? getAddressFactory().createAddress( ((ICDISharedLibrary)fCDIObject).getStartAddress() ) : getAddressFactory().getZero(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getSize() - */ - @Override - public long getSize() { - long result = 0; - if ( fCDIObject instanceof ICDISharedLibrary ) { - BigInteger start = ((ICDISharedLibrary)fCDIObject).getStartAddress(); - BigInteger end = ((ICDISharedLibrary)fCDIObject).getEndAddress(); - if ( end.compareTo( start ) > 0 ) - result = end.subtract( start ).longValue(); - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#areSymbolsLoaded() - */ - @Override - public boolean areSymbolsLoaded() { - if (fCDIObject instanceof ICDISharedLibrary) - return ((ICDISharedLibrary)fCDIObject).areSymbolsLoaded(); - - if (fBinary != null) - return fBinary.hasDebug(); - - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#canLoadSymbols() - */ - @Override - public boolean canLoadSymbols() { - return ( getDebugTarget().isSuspended() && !areSymbolsLoaded() ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#loadSymbols() - */ - @Override - public void loadSymbols() throws DebugException { - loadSymbolsFromFile( getSymbolsFileName() ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getPlatform() - */ - @Override - public String getPlatform() { - return ( fBinary != null ) ? fBinary.getCPU() : CoreModelMessages.getString( "CModule.1" ); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#isLittleEndian() - */ - @Override - public boolean isLittleEndian() { - return ( fBinary != null ) ? fBinary.isLittleEndian() : ((CDebugTarget)getDebugTarget()).isLittleEndian(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getAddressFactory() - */ - @Override - public IAddressFactory getAddressFactory() { - return ((CDebugTarget)getDebugTarget()).getAddressFactory(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICModule#getCPU() - */ - @Override - public String getCPU() { - return ( fBinary != null ) ? fBinary.getCPU() : null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( ICElement.class.equals( adapter ) ) { - return getCElement(); - } - if ( IBinary.class.equals( adapter ) && getCElement() instanceof IBinary ) { - return getCElement(); - } - return super.getAdapter( adapter ); - } - - public void dispose() { - - } - - public boolean equals( ICDIObject cdiObject ) { - return ( fCDIObject != null ) ? fCDIObject.equals( cdiObject ) : false; - } - - protected ICElement getCElement() { - return fBinary; - } - - private void loadSymbolsFromFile(IPath path) throws DebugException { - if (fCDIObject instanceof ICDISharedLibrary) { - if (path == null || path.isEmpty()) { - requestFailed(CoreModelMessages.getString("CModule.2"), null); //$NON-NLS-1$ - } else { - if (path.equals(getSymbolsFileName())) { - try { - ((ICDISharedLibrary) fCDIObject).loadSymbols(); - } catch (CDIException e) { - targetRequestFailed(e.getMessage(), null); - } - } else { - String message = MessageFormat.format( // - CoreModelMessages.getString("CModule.5"), //$NON-NLS-1$ - new Object[] { path.toString() }); - targetRequestFailed(message, null); - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModuleManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModuleManager.java deleted file mode 100644 index 5b85e37526c..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModuleManager.java +++ /dev/null @@ -1,169 +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.internal.core.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; - -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.debug.core.model.IModuleRetrieval; -import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; - -/** - * Manages the modules loaded on this debug target. - */ -public class CModuleManager extends PlatformObject implements IModuleRetrieval { - - /** - * The debug target associated with this manager. - */ - private CDebugTarget fDebugTarget; - - /** - * The collection of the shared libraries loaded on this target. - */ - private ArrayList fModules; - - /** - * Constructor for CModuleManager. - */ - public CModuleManager( CDebugTarget target ) { - fDebugTarget = target; - fModules = new ArrayList( 5 ); - } - - @Override - public boolean hasModules() throws DebugException { - return !fModules.isEmpty(); - } - - @Override - public ICModule[] getModules() throws DebugException { - return (ICModule[])fModules.toArray( new ICModule[fModules.size()] ); - } - - @Override - public void loadSymbolsForAllModules() throws DebugException { - MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, CoreModelMessages.getString( "CModuleManager.0" ), null ); //$NON-NLS-1$ - Iterator it = fModules.iterator(); - while( it.hasNext() ) { - ICModule module = (ICModule)it.next(); - try { - module.loadSymbols(); - } - catch( DebugException e ) { - ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); - } - } - if ( !ms.isOK() ) { - throw new DebugException( ms ); - } - } - - public void loadSymbols( ICModule[] modules ) throws DebugException { - MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, CoreModelMessages.getString( "CModuleManager.1" ), null ); //$NON-NLS-1$ - for ( int i = 0; i < modules.length; ++i ) { - try { - modules[i].loadSymbols(); - } - catch( DebugException e ) { - ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); - } - } - if ( !ms.isOK() ) { - throw new DebugException( ms ); - } - } - - public void dispose() { - Iterator it = fModules.iterator(); - while( it.hasNext() ) { - ((CModule)it.next()).dispose(); - } - fModules.clear(); - } - - protected CDebugTarget getDebugTarget() { - return fDebugTarget; - } - - protected void addModules( ICModule[] modules ) { - fModules.addAll( Arrays.asList( modules ) ); - } - - protected void removeModules( ICModule[] modules ) { - fModules.removeAll( Arrays.asList( modules ) ); - } - - public void sharedLibraryLoaded( ICDISharedLibrary cdiLibrary ) { - CModule library = null; - synchronized( fModules ) { - if ( find( cdiLibrary ) == null ) { - library = CModule.createSharedLibrary( getDebugTarget(), cdiLibrary ); - fModules.add( library ); - } - } - if ( library != null ) - library.fireCreationEvent(); - } - - public void sharedLibraryUnloaded( ICDISharedLibrary cdiLibrary ) { - CModule library = null; - synchronized( fModules ) { - library = find( cdiLibrary ); - if ( library != null ) { - fModules.remove( library ); - } - } - if ( library != null ) { - library.dispose(); - library.fireTerminateEvent(); - } - } - - public void symbolsLoaded( ICDIObject cdiObject ) { - CModule module = find( cdiObject ); - if ( module != null ) { - module.fireChangeEvent( DebugEvent.STATE ); - } - } - - private CModule find( ICDIObject cdiObject ) { - Iterator it = fModules.iterator(); - while( it.hasNext() ) { - CModule module = (CModule)it.next(); - if ( module.equals( cdiObject ) ) - return module; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( adapter.equals( ICDebugTarget.class ) ) - return getDebugTarget(); - return super.getAdapter( adapter ); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java deleted file mode 100644 index 30da4afef57..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java +++ /dev/null @@ -1,451 +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 - * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -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.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration3; -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.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.core.model.CVariableFormat; -import org.eclipse.cdt.debug.core.model.ICRegister; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.core.model.IRegisterDescriptor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IRegisterGroup; - -/** - * Represents a register in the CDI model. - */ -public class CRegister extends CVariable implements ICRegister { - - private class InternalVariable implements IInternalVariable { - - /** - * The enclosing <code>CVariable</code> instance. - */ - private CVariable fVariable; - - /** - * The CDI variable object this variable is based on. - */ - private ICDIVariableDescriptor fCDIVariableObject; - - /** - * The underlying CDI register. - */ - private ICDIRegister fCDIRegister; - - /** - * The type of this variable. - */ - private CType fType; - - /** - * The expression used to eveluate the value of this variable. - */ - private String fQualifiedName; - - /** - * The cache of the current value. - */ - private ICValue fValue = CValueFactory.NULL_VALUE; - - /** - * The change flag. - */ - private boolean fChanged = false; - - /** - * Constructor for InternalVariable. - */ - InternalVariable( CVariable var, ICDIVariableDescriptor varObject ) { - setVariable( var ); - setCDIVariableObject( varObject ); - setCDIRegister( (varObject instanceof ICDIRegister) ? (ICDIRegister)varObject : null ); - } - - @Override - public IInternalVariable createShadow( int start, int length ) throws DebugException { - IInternalVariable iv = null; - try { - iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsArray( start, length ) ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - return iv; - } - - @Override - public IInternalVariable createShadow( String type ) throws DebugException { - IInternalVariable iv = null; - try { - iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsType( type ) ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - return iv; - } - - private synchronized ICDIRegister getCDIRegister() throws DebugException { - if ( fCDIRegister == null ) { - try { - fCDIRegister = getCDITarget().createRegister( (ICDIRegisterDescriptor)getCDIVariableObject() ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - return fCDIRegister; - } - - private void setCDIRegister( ICDIRegister register ) { - fCDIRegister = register; - } - - private ICDIVariableDescriptor getCDIVariableObject() { - if ( fCDIRegister != null ) { - return fCDIRegister; - } - return fCDIVariableObject; - } - - private void setCDIVariableObject( ICDIVariableDescriptor variableObject ) { - fCDIVariableObject = variableObject; - } - - @Override - public String getQualifiedName() throws DebugException { - if ( fQualifiedName == null ) { - try { - fQualifiedName = (fCDIVariableObject != null) ? fCDIVariableObject.getQualifiedName() : null; - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - return fQualifiedName; - } - - @Override - public CType getType() throws DebugException { - if ( fType == null ) { - ICDIVariableDescriptor varObject = getCDIVariableObject(); - if ( varObject != null ) { - synchronized( this ) { - if ( fType == null ) { - try { - fType = new CType( varObject.getType() ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - } - } - } - return fType; - } - - private synchronized void invalidate( boolean destroy ) { - try { - if ( destroy && fCDIRegister != null ) - fCDIRegister.dispose(); - } - catch( CDIException e ) { - logError( e.getMessage() ); - } - invalidateValue(); - setCDIRegister( null ); - if ( fType != null ) - fType.dispose(); - fType = null; - } - - @Override - public void dispose( boolean destroy ) { - invalidate( destroy ); - } - - @Override - public boolean isSameVariable( ICDIVariable cdiVar ) { - return ( fCDIRegister != null ) ? fCDIRegister.equals( cdiVar ) : false; - } - - @Override - public int sizeof() { - if ( getCDIVariableObject() != null ) { - try { - return getCDIVariableObject().sizeof(); - } - catch( CDIException e ) { - } - } - return 0; - } - - @Override - public boolean isArgument() { - return ( getCDIVariableObject() instanceof ICDIArgumentDescriptor ); - } - - @Override - public void setValue( String expression ) throws DebugException { - ICDIRegister cdiRegister = null; - try { - cdiRegister = getCDIRegister(); - if ( cdiRegister != null ) - cdiRegister.setValue( expression ); - else - requestFailed( CoreModelMessages.getString( "CModificationVariable.0" ), null ); //$NON-NLS-1$ - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - - @Override - public synchronized ICValue getValue() throws DebugException { - CStackFrame frame = getCurrentStackFrame(); - if ( frame == null || frame.isDisposed() ) - fValue = CValueFactory.NULL_VALUE; - else if ( fValue.equals( CValueFactory.NULL_VALUE ) ) { - ICDIRegister reg = getCDIRegister(); - if ( reg != null ) { - try { - ICDIValue cdiValue = reg.getValue( getCurrentStackFrame().getCDIStackFrame() ); - if ( cdiValue != null ) { - ICDIType cdiType = cdiValue.getType(); - if ( cdiValue instanceof ICDIArrayValue && cdiType != null ) { - ICType type = new CType( cdiType ); - if ( type.isArray() ) { - int[] dims = type.getArrayDimensions(); - if ( dims.length > 0 && dims[0] > 0 ) - fValue = CValueFactory.createIndexedValue( getVariable(), (ICDIArrayValue)cdiValue, 0, dims[0] ); - } - } - else { - fValue = CValueFactory.createValue( getVariable(), cdiValue ); - } - } - } - catch( CDIException e ) { - requestFailed( e.getMessage(), e ); - } - } - } - return fValue; - } - - @Override - public void invalidateValue() { - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).dispose(); - fValue = CValueFactory.NULL_VALUE; - } - } - - @Override - public boolean isChanged() { - return fChanged; - } - - @Override - public synchronized void setChanged( boolean changed ) { - if ( changed ) { - invalidateValue(); - } - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).setChanged( changed ); - } - fChanged = changed; - } - - @Override - public synchronized void preserve() { - setChanged( false ); - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).preserve(); - } - } - - CVariable getVariable() { - return fVariable; - } - - private void setVariable( CVariable variable ) { - fVariable = variable; - } - - @Override - public void resetValue() { - if ( fValue instanceof AbstractCValue ) { - ((AbstractCValue)fValue).reset(); - } - } - - @Override - public boolean isEditable() throws DebugException { - ICDIRegister reg = getCDIRegister(); - if ( reg != null && reg.getTarget().getConfiguration().supportsRegisterModification() ) { - try { - return reg.isEditable(); - } - catch( CDIException e ) { - } - } - return false; - } - /** - * Compares the underlying variable objects. - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals( Object obj ) { - if ( obj instanceof InternalVariable ) { - return getCDIVariableObject().equals( ((InternalVariable)obj).getCDIVariableObject() ); - } - return false; - } - - @Override - public boolean isSameDescriptor( ICDIVariableDescriptor desc ) { - return getCDIVariableObject().equals( desc ); - } - - @Override - public ICDIObject getCdiObject() { - return fCDIRegister; - } - } - - /** - * Constructor for CRegister. - */ - protected CRegister( CRegisterGroup parent, IRegisterDescriptor descriptor ) { - super( parent, ((CRegisterDescriptor)descriptor).getCDIDescriptor() ); - setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) ); - setInitialFormat(); - } - - /** - * Constructor for CRegister. - */ - protected CRegister( CRegisterGroup parent, IRegisterDescriptor descriptor, String message ) { - super( parent, ((CRegisterDescriptor)descriptor).getCDIDescriptor(), message ); - setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) ); - setInitialFormat(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IRegister#getRegisterGroup() - */ - @Override - public IRegisterGroup getRegisterGroup() throws DebugException { - return (IRegisterGroup)getParent(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.CVariable#isBookkeepingEnabled() - */ - @Override - protected boolean isBookkeepingEnabled() { - boolean result = false; - try { - result = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false ); - } - catch( CoreException e ) { - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICVariable#canEnableDisable() - */ - @Override - public boolean canEnableDisable() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - for( int i = 0; i < events.length; i++ ) { - ICDIEvent event = events[i]; - ICDIObject source = event.getSource(); - if (source != null) { - ICDITarget cdiTarget = source.getTarget(); - if ( event instanceof ICDIResumedEvent ) { - if ( getCDITarget().equals( cdiTarget ) ) { - setChanged( false ); - } - } - else if ( event instanceof ICDIMemoryChangedEvent && - cdiTarget.getConfiguration() instanceof ICDITargetConfiguration3 && - ((ICDITargetConfiguration3)cdiTarget.getConfiguration()).needsRegistersUpdated(event)) { - resetValue(); - return; // avoid similar but logic inappropriate for us in CVariable - } - } - } - super.handleDebugEvents( events ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#dispose() - */ - @Override - public void dispose() { - internalDispose( true ); - setDisposed( true ); - } - - @Override - protected ICStackFrame getStackFrame() { - ICStackFrame frame = super.getStackFrame(); - if (frame == null) - frame = getCurrentStackFrame(); - return frame; - } - - protected CStackFrame getCurrentStackFrame() { - return ((CDebugTarget)getDebugTarget()).getRegisterManager().getCurrentFrame(); - } - - @Override - protected void createOriginal( ICDIVariableDescriptor vo ) { - if ( vo != null ) { - setName( vo.getName() ); - setOriginal( new InternalVariable( this, vo ) ); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterDescriptor.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterDescriptor.java deleted file mode 100644 index 997ed79cffa..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterDescriptor.java +++ /dev/null @@ -1,66 +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.internal.core.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup; -import org.eclipse.cdt.debug.core.model.IRegisterDescriptor; - -/** - * A register descriptor. Temporary, need to change the related CDI interfaces. - */ -public class CRegisterDescriptor implements IRegisterDescriptor { - - private String fName; - private String fGroupName; - private ICDIRegisterDescriptor fCDIDescriptor = null; - - /** - * Constructor for CRegisterDescriptor. - */ - public CRegisterDescriptor( String name, String groupName ) { - fName = name; - fGroupName = groupName; - } - - /** - * Constructor for CRegisterDescriptor. - */ - public CRegisterDescriptor( ICDIRegisterGroup group, ICDIRegisterDescriptor desc ) { - fName = desc.getName(); - fGroupName = group.getName(); - fCDIDescriptor = desc; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRegisterDescriptor#getName() - */ - @Override - public String getName() { - return fName; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRegisterDescriptor#getGroupName() - */ - @Override - public String getGroupName() { - return fGroupName; - } - - public ICDIRegisterDescriptor getCDIDescriptor() { - return fCDIDescriptor; - } - - public void setCDIDescriptor( ICDIRegisterDescriptor descriptor ) { - fCDIDescriptor = descriptor; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterGroup.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterGroup.java deleted file mode 100644 index 50a22a1971f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterGroup.java +++ /dev/null @@ -1,279 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.util.ArrayList; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.model.IEnableDisableTarget; -import org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup; -import org.eclipse.cdt.debug.core.model.IRegisterDescriptor; -import org.eclipse.cdt.debug.internal.core.CRegisterManager; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IRegister; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * Represents a group of registers. - */ -public class CRegisterGroup extends CDebugElement implements IPersistableRegisterGroup, IEnableDisableTarget { - - private static final String ELEMENT_REGISTER_GROUP = "registerGroup"; //$NON-NLS-1$ - private static final String ATTR_REGISTER_GROUP_NAME = "name"; //$NON-NLS-1$ - private static final String ATTR_REGISTER_GROUP_ENABLED = "enabled"; //$NON-NLS-1$ - - private static final String ELEMENT_REGISTER = "register"; //$NON-NLS-1$ - private static final String ATTR_REGISTER_NAME = "name"; //$NON-NLS-1$ - private static final String ATTR_REGISTER_ORIGINAL_GROUP_NAME = "originalGroupName"; //$NON-NLS-1$ - - private String fName; - - private IRegisterDescriptor[] fRegisterDescriptors; - - private IRegister[] fRegisters; - - private boolean fIsEnabled = true; - - private boolean fDisposed = false; - - /** - * Constructor for CRegisterGroup. - */ - public CRegisterGroup( CDebugTarget target ) { - super( target ); - } - - /** - * Constructor for CRegisterGroup. - */ - public CRegisterGroup( CDebugTarget target, String name, IRegisterDescriptor[] descriptors ) { - super( target ); - fName = name; - fRegisterDescriptors = descriptors; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IRegisterGroup#getName() - */ - @Override - public String getName() throws DebugException { - return fName; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IRegisterGroup#getRegisters() - */ - @Override - public IRegister[] getRegisters() throws DebugException { - if ( fDisposed ) - return new IRegister[0]; - if ( fRegisters == null ) { - synchronized( this ) { - if ( fRegisters == null ) { - fRegisters = new IRegister[fRegisterDescriptors.length]; - for( int i = 0; i < fRegisters.length; ++i ) { - fRegisters[i] = new CRegister( this, fRegisterDescriptors[i] ); - } - } - } - } - return fRegisters; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IRegisterGroup#hasRegisters() - */ - @Override - public boolean hasRegisters() throws DebugException { - return ( fRegisterDescriptors.length > 0 ); - } - - public void dispose() { - fDisposed = true; - invalidate(); - } - - public void targetSuspended() { - if ( fRegisters == null ) { - return; - } - for ( int i = 0; i < fRegisters.length; ++i ) { - if ( fRegisters[i] != null && ((CRegister)fRegisters[i]).hasErrors() ) { - ((CRegister)fRegisters[i]).resetStatus(); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( IEnableDisableTarget.class.equals( adapter ) ) - return this; - return super.getAdapter( adapter ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IEnableDisableTarget#canEnableDisable() - */ - @Override - public boolean canEnableDisable() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IEnableDisableTarget#isEnabled() - */ - @Override - public boolean isEnabled() { - return fIsEnabled; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IEnableDisableTarget#setEnabled(boolean) - */ - @Override - public void setEnabled( boolean enabled ) throws DebugException { - if ( fRegisters != null ) { - synchronized( fRegisters ) { - if ( fRegisters != null ) { - for ( int i = 0; i < fRegisters.length; ++i ) { - if ( fRegisters[i] instanceof CRegister ) { - ((CRegister)fRegisters[i]).setEnabled( enabled ); - } - } - } - } - } - fIsEnabled = enabled; - fireChangeEvent( DebugEvent.CONTENT ); - } - - @Override - public String getMemento() throws CoreException { - Document document = DebugPlugin.newDocument(); - Element element = document.createElement( ELEMENT_REGISTER_GROUP ); - element.setAttribute( ATTR_REGISTER_GROUP_NAME, getName() ); - element.setAttribute( ATTR_REGISTER_GROUP_ENABLED, Boolean.valueOf( isEnabled() ).toString() ); - for ( int i = 0; i < fRegisterDescriptors.length; ++i ) { - Element child = document.createElement( ELEMENT_REGISTER ); - child.setAttribute( ATTR_REGISTER_NAME, fRegisterDescriptors[i].getName() ); - child.setAttribute( ATTR_REGISTER_ORIGINAL_GROUP_NAME, fRegisterDescriptors[i].getGroupName() ); - element.appendChild( child ); - } - document.appendChild( element ); - return DebugPlugin.serializeDocument( document ); - } - - @Override - public void initializeFromMemento( String memento ) throws CoreException { - Node node = DebugPlugin.parseDocument( memento ); - if ( node.getNodeType() != Node.ELEMENT_NODE ) { - abort( CoreModelMessages.getString( "CRegisterGroup.0" ), null ); //$NON-NLS-1$ - } - Element element = (Element)node; - if ( !ELEMENT_REGISTER_GROUP.equals( element.getNodeName() ) ) { - abort( CoreModelMessages.getString( "CRegisterGroup.1" ), null ); //$NON-NLS-1$ - } - String groupName = element.getAttribute( ATTR_REGISTER_GROUP_NAME ); - if ( groupName == null || groupName.length() == 0 ) { - abort( CoreModelMessages.getString( "CRegisterGroup.2" ), null ); //$NON-NLS-1$ - } - String e = element.getAttribute( ATTR_REGISTER_GROUP_ENABLED ); - boolean enabled = Boolean.valueOf( e ).booleanValue(); - CRegisterManager rm = getRegisterManager(); - ArrayList list = new ArrayList(); - Node childNode = element.getFirstChild(); - while( childNode != null ) { - if ( childNode.getNodeType() == Node.ELEMENT_NODE ) { - Element child = (Element)childNode; - if ( ELEMENT_REGISTER.equals( child.getNodeName() ) ) { - String name = child.getAttribute( ATTR_REGISTER_NAME ); - String originalGroupName = child.getAttribute( ATTR_REGISTER_ORIGINAL_GROUP_NAME ); - if ( name == null || name.length() == 0 || originalGroupName == null || originalGroupName.length() == 0 ) { - abort( CoreModelMessages.getString( "CRegisterGroup.3" ), null ); //$NON-NLS-1$ - } - else { - IRegisterDescriptor d = rm.findDescriptor( originalGroupName, name ); - if ( d != null ) - list.add( d ); - else - CDebugCorePlugin.log( CoreModelMessages.getString( "CRegisterGroup.4" ) ); //$NON-NLS-1$ - } - } - } - childNode = childNode.getNextSibling(); - } - setName( groupName ); - fRegisterDescriptors = (IRegisterDescriptor[])list.toArray( new IRegisterDescriptor[list.size()] ); - setEnabled( enabled ); - } - - private void abort( String message, Throwable exception ) throws CoreException { - IStatus status = new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, message, exception ); - throw new CoreException( status ); - } - - private void setName( String name ) { - fName = name; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup#setRegisterDescriptors(org.eclipse.cdt.debug.core.model.IRegisterDescriptor[]) - */ - @Override - public void setRegisterDescriptors( IRegisterDescriptor[] registerDescriptors ) { - invalidate(); - fRegisterDescriptors = registerDescriptors; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup#getRegisterDescriptors() - */ - @Override - public IRegisterDescriptor[] getRegisterDescriptors() { - return fRegisterDescriptors; - } - - private CRegisterManager getRegisterManager() { - return getDebugTarget().getAdapter( CRegisterManager.class ); - } - - private void invalidate() { - if ( fRegisters == null ) { - return; - } - for ( int i = 0; i < fRegisters.length; ++i ) { - if ( fRegisters[i] != null ) { - ((CRegister)fRegisters[i]).dispose(); - } - } - fRegisters = null; - } - - public void resetRegisterValues() { - if ( fRegisters == null ) { - return; - } - for ( int i = 0; i < fRegisters.length; ++i ) { - if ( fRegisters[i] != null ) { - ((CRegister)fRegisters[i]).invalidateValue(); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSignal.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSignal.java deleted file mode 100644 index 8732a75a1d6..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSignal.java +++ /dev/null @@ -1,148 +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.internal.core.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -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.ICDISignal; -import org.eclipse.cdt.debug.core.model.ICSignal; -import org.eclipse.debug.core.DebugException; - -/** - * Enter type comment. - * - * @since: Jan 31, 2003 - */ -public class CSignal extends CDebugElement implements ICSignal, ICDIEventListener -{ - private ICDISignal fCDISignal; - - /** - * Constructor for CSignal. - * @param target - */ - public CSignal( CDebugTarget target, ICDISignal cdiSignal ) - { - super( target ); - fCDISignal = cdiSignal; - getCDISession().getEventManager().addEventListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#getDescription() - */ - @Override - public String getDescription() throws DebugException - { - return getCDISignal().getDescription(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#getName() - */ - @Override - public String getName() throws DebugException - { - return getCDISignal().getName(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#isPassEnabled() - */ - @Override - public boolean isPassEnabled() throws DebugException - { - return !getCDISignal().isIgnore(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#isStopEnabled() - */ - @Override - public boolean isStopEnabled() throws DebugException - { - return getCDISignal().isStopSet(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#setPassEnabled(boolean) - */ - @Override - public void setPassEnabled( boolean enable ) throws DebugException - { - handle( enable, isStopEnabled() ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#setStopEnabled(boolean) - */ - @Override - public void setStopEnabled( boolean enable ) throws DebugException - { - handle( isPassEnabled(), enable ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(ICDIEvent) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) - { - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#dispose() - */ - public void dispose() - { - getCDISession().getEventManager().removeEventListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICSignal#signal() - */ - @Override - public void signal() throws DebugException - { - try - { - getCDITarget().resume( getCDISignal() ); - } - catch( CDIException e ) - { - targetRequestFailed( e.getMessage(), null ); - } - } - - protected ICDISignal getCDISignal() - { - return fCDISignal; - } - - private void handle( boolean pass, boolean stop ) throws DebugException - { - try - { - getCDISignal().handle( !pass, stop ); - } - catch( CDIException e ) - { - targetRequestFailed( e.getMessage(), null ); - } - } - - @Override - public boolean canModify() { - // TODO add canModify method to ICDISignal - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java deleted file mode 100644 index ea38ed259fa..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java +++ /dev/null @@ -1,1049 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.math.BigInteger; -import com.ibm.icu.text.MessageFormat; -import com.ibm.icu.text.NumberFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; -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.ICDIDisposable; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteMoveInstructionPointer; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume; -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.ICDIThread; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.model.ICGlobalVariable; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IMoveToAddress; -import org.eclipse.cdt.debug.core.model.IMoveToLine; -import org.eclipse.cdt.debug.core.model.IRestart; -import org.eclipse.cdt.debug.core.model.IResumeAtAddress; -import org.eclipse.cdt.debug.core.model.IResumeAtLine; -import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal; -import org.eclipse.cdt.debug.core.model.IRunToAddress; -import org.eclipse.cdt.debug.core.model.IRunToLine; -import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; -import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IMemoryBlockRetrieval; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.model.IVariable; - -/** - * Proxy to a stack frame on the target. - */ -public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart, IResumeWithoutSignal, IMoveToAddress, IMoveToLine, ICDIEventListener { - - /** - * Underlying CDI stack frame. - */ - private ICDIStackFrame fCDIStackFrame; - - /** - * The last (previous) CDI stack frame. - */ - private ICDIStackFrame fLastCDIStackFrame; - - /** - * Containing thread. - */ - private CThread fThread; - - /** - * List of visible variable (includes arguments). - */ - private List fVariables; - - /** - * Whether the variables need refreshing - */ - private boolean fRefreshVariables = true; - - /** - * List of watch expressions evaluating in the context of this frame. - */ - private List fExpressions; - - /** - * Need this flag to prevent evaluations on disposed frames. - */ - private boolean fIsDisposed = false; - - /** - * Constructor for CStackFrame. - */ - public CStackFrame( CThread thread, ICDIStackFrame cdiFrame ) { - super( (CDebugTarget)thread.getDebugTarget() ); - setCDIStackFrame( cdiFrame ); - setThread( thread ); - getCDISession().getEventManager().addEventListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getThread() - */ - @Override - public IThread getThread() { - return fThread; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getVariables() - */ - @Override - public IVariable[] getVariables() throws DebugException { - if ( isDisposed() ) { - return new IVariable[0]; - } - ICGlobalVariable[] globals = getGlobals(); - List vars = getVariables0(); - List all = new ArrayList( globals.length + vars.size() ); - all.addAll( Arrays.asList( globals ) ); - all.addAll( vars ); - return (IVariable[])all.toArray( new IVariable[all.size()] ); - } - - protected synchronized List getVariables0() throws DebugException { - if ( isDisposed() ) { - return Collections.EMPTY_LIST; - } - CThread thread = (CThread)getThread(); - if ( thread.isSuspended() ) { - if ( fVariables == null ) { - List vars = getAllCDIVariableObjects(); - fVariables = new ArrayList( vars.size() ); - Iterator it = vars.iterator(); - while( it.hasNext() ) { - fVariables.add( CVariableFactory.createLocalVariable( this, (ICDIVariableDescriptor)it.next() ) ); - } - } - else if ( refreshVariables() ) { - updateVariables(); - } - setRefreshVariables( false ); - } - return ( fVariables != null ) ? fVariables : Collections.EMPTY_LIST; - } - - /** - * Incrementally updates this stack frame's variables. - */ - protected void updateVariables() throws DebugException { - List locals = getAllCDIVariableObjects(); - Iterator<CVariable> it = fVariables.iterator(); - while (it.hasNext()) { - CVariable var = it.next(); - ICDIVariableDescriptor varObject = findVariable(locals, var); - if (varObject != null && !var.isDisposed()) - locals.remove(varObject); - else { - // ensure variable is unregistered from event listener - var.dispose(); - it.remove(); - } - } - // add any new locals - Iterator newOnes = locals.iterator(); - while( newOnes.hasNext() ) { - fVariables.add( CVariableFactory.createLocalVariable( this, (ICDIVariableDescriptor)newOnes.next() ) ); - } - } - - /** - * Sets the containing thread. - * - * @param thread the containing thread - */ - protected void setThread( CThread thread ) { - fThread = thread; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#hasVariables() - */ - @Override - public boolean hasVariables() throws DebugException { - return ( isDisposed() ) ? false : (getVariables0().size() > 0 || getGlobals().length > 0); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() - */ - @Override - public int getLineNumber() throws DebugException { - if ( isSuspended() ) { - ISourceLocator locator = ((CDebugTarget)getDebugTarget()).getSourceLocator(); - if ( locator != null && locator instanceof IAdaptable && ((IAdaptable)locator).getAdapter( ICSourceLocator.class ) != null ) - return ((IAdaptable)locator).getAdapter( ICSourceLocator.class ).getLineNumber( this ); - - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - if ( cdiFrame != null && cdiFrame.getLocator() != null ) - return cdiFrame.getLocator().getLineNumber(); - } - return -1; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getCharStart() - */ - @Override - public int getCharStart() throws DebugException { - return -1; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() - */ - @Override - public int getCharEnd() throws DebugException { - return -1; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getName() - */ - @Override - public String getName() throws DebugException { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - if (cdiFrame == null) { - return ""; //$NON-NLS-1$ - } - - ICDILocator locator = cdiFrame.getLocator(); - String func = ""; //$NON-NLS-1$ - String file = ""; //$NON-NLS-1$ - String line = ""; //$NON-NLS-1$ - if ( locator.getFunction() != null && locator.getFunction().trim().length() > 0 ) - func += locator.getFunction() + "() "; //$NON-NLS-1$ - if ( locator.getFile() != null && locator.getFile().trim().length() > 0 ) { - file = locator.getFile(); - if ( locator.getLineNumber() != 0 ) { - line = NumberFormat.getInstance().format( new Integer( locator.getLineNumber() ) ); - } - } - else { - return func; - } - return MessageFormat.format( CoreModelMessages.getString( "CStackFrame.0" ), new String[]{ func, file, line } ); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() - */ - @Override - public IRegisterGroup[] getRegisterGroups() throws DebugException { - return ( isDisposed() ) ? new IRegisterGroup[0] : ((CDebugTarget)getDebugTarget()).getRegisterGroups( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() - */ - @Override - public boolean hasRegisterGroups() throws DebugException { - return ( isDisposed() ) ? false : ((CDebugTarget)getDebugTarget()).getRegisterGroups( this ).length > 0; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepInto() - */ - @Override - public boolean canStepInto() { - try { - return exists() /*&& isTopStackFrame()*/ && getThread().canStepInto(); - } - catch( DebugException e ) { - logError( e ); - return false; - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepOver() - */ - @Override - public boolean canStepOver() { - try { - return exists() && getThread().canStepOver(); - } - catch( DebugException e ) { - logError( e ); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepReturn() - */ - @Override - public boolean canStepReturn() { - try { - if ( !exists() ) { - return false; - } - List frames = ((CThread)getThread()).computeStackFrames(); - if ( frames != null && !frames.isEmpty() ) { - boolean bottomFrame = this.equals( frames.get( frames.size() - 1 ) ); - return !bottomFrame && getThread().canStepReturn(); - } - } - catch( DebugException e ) { - logError( e ); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#isStepping() - */ - @Override - public boolean isStepping() { - return getThread().isStepping(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepInto() - */ - @Override - public void stepInto() throws DebugException { - if ( canStepInto() ) { - getThread().stepInto(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepOver() - */ - @Override - public void stepOver() throws DebugException { - if ( canStepOver() ) { - getThread().stepOver(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepReturn() - */ - @Override - public void stepReturn() throws DebugException { - if ( canStepReturn() ) { - getThread().stepReturn(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canResume() - */ - @Override - public boolean canResume() { - return getThread().canResume(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() - */ - @Override - public boolean canSuspend() { - return getThread().canSuspend(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() - */ - @Override - public boolean isSuspended() { - return getThread().isSuspended(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#resume() - */ - @Override - public void resume() throws DebugException { - getThread().resume(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#suspend() - */ - @Override - public void suspend() throws DebugException { - getThread().suspend(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#canTerminate() - */ - @Override - public boolean canTerminate() { - boolean exists = false; - try { - exists = exists(); - } - catch( DebugException e ) { - logError( e ); - } - return exists && getThread().canTerminate() || getDebugTarget().canTerminate(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#isTerminated() - */ - @Override - public boolean isTerminated() { - return getThread().isTerminated(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#terminate() - */ - @Override - public void terminate() throws DebugException { - if ( getThread().canTerminate() ) { - getThread().terminate(); - } - else { - getDebugTarget().terminate(); - } - } - - /** - * Returns the underlying CDI stack frame that this model object is a proxy to. - * - * @return the underlying CDI stack frame - */ - protected ICDIStackFrame getCDIStackFrame() { - return fCDIStackFrame; - } - - /** - * Sets the underlying CDI stack frame. Called by a thread when incrementally updating after a step has completed. - * - * @param frame the underlying stack frame - */ - protected void setCDIStackFrame( ICDIStackFrame frame ) { - if ( frame != null ) { - fLastCDIStackFrame = frame; - } - else { - fLastCDIStackFrame = fCDIStackFrame; - } - fCDIStackFrame = frame; - setRefreshVariables( true ); - } - - /** - * The underlying stack frame that existed before the current underlying stack frame. Used only so that equality can be checked on stack frame after the new - * one has been set. - */ - protected ICDIStackFrame getLastCDIStackFrame() { - return fLastCDIStackFrame; - } - - /** - * Helper method for computeStackFrames(). For the purposes of detecting if an underlying stack frame needs to be disposed, stack frames are equal if the - * frames are equal and the locations are equal. - */ - protected static boolean equalFrame( ICDIStackFrame frameOne, ICDIStackFrame frameTwo ) { - if ( frameOne == null || frameTwo == null ) - return false; - ICDILocator loc1 = frameOne.getLocator(); - ICDILocator loc2 = frameTwo.getLocator(); - if ( loc1 == null || loc2 == null ) - return false; - if ( loc1.getFile() != null && loc1.getFile().length() > 0 && loc2.getFile() != null && loc2.getFile().length() > 0 && loc1.getFile().equals( loc2.getFile() ) ) { - if ( loc1.getFunction() != null && loc1.getFunction().length() > 0 && loc2.getFunction() != null && loc2.getFunction().length() > 0 && loc1.getFunction().equals( loc2.getFunction() ) ) - return true; - } - if ( (loc1.getFile() == null || loc1.getFile().length() < 1) && (loc2.getFile() == null || loc2.getFile().length() < 1) ) { - if ( loc1.getFunction() != null && loc1.getFunction().length() > 0 && loc2.getFunction() != null && loc2.getFunction().length() > 0 && loc1.getFunction().equals( loc2.getFunction() ) ) - return true; - } - if ( (loc1.getFile() == null || loc1.getFile().length() < 1) && (loc2.getFile() == null || loc2.getFile().length() < 1) && (loc1.getFunction() == null || loc1.getFunction().length() < 1) && (loc2.getFunction() == null || loc2.getFunction().length() < 1) ) { - if ( loc1.getAddress() == loc2.getAddress() ) - return true; - } - return false; - } - - protected boolean exists() throws DebugException { - return ((CThread)getThread()).computeStackFrames().indexOf( this ) != -1; - } - - /** - * @see IAdaptable#getAdapter(Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( adapter == IRunToLine.class ) { - return this; - } - if ( adapter == IRunToAddress.class ) { - return this; - } - if ( adapter == IResumeAtLine.class ) { - return this; - } - if ( adapter == IResumeAtAddress.class ) { - return this; - } - if ( adapter == IMoveToLine.class ) { - return this; - } - if ( adapter == IMoveToAddress.class ) { - return this; - } - if ( adapter == CStackFrame.class ) { - return this; - } - if ( adapter == ICStackFrame.class ) { - return this; - } - if ( adapter == IStackFrame.class ) { - return this; - } - if ( adapter == ICDIStackFrame.class ) { - return getCDIStackFrame(); - } - if ( adapter == IMemoryBlockRetrieval.class ) { - return getDebugTarget().getAdapter( adapter ); - } - return super.getAdapter( adapter ); - } - - protected void dispose() { - setDisposed( true ); - getCDISession().getEventManager().removeEventListener( this ); - disposeAllVariables(); - disposeExpressions(); - - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - setCDIStackFrame(null); - if (cdiFrame instanceof ICDIDisposable) { - ((ICDIDisposable)cdiFrame).dispose(); - } - } - - /** - * Retrieves local variables in this stack frame. Returns an empty list if there are no local variables. - * - */ - protected List getCDILocalVariableObjects() throws DebugException { - List list = new ArrayList(); - try { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - if (cdiFrame != null) { - list.addAll( Arrays.asList( cdiFrame.getLocalVariableDescriptors( ) ) ); - } - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - return list; - } - - /** - * Retrieves arguments in this stack frame. Returns an empty list if there are no arguments. - * - */ - protected List getCDIArgumentObjects() throws DebugException { - List list = new ArrayList(); - try { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - if (cdiFrame != null) { - list.addAll( Arrays.asList( cdiFrame.getArgumentDescriptors() ) ); - } - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - return list; - } - - protected List getAllCDIVariableObjects() throws DebugException { - List list = new ArrayList(); - list.addAll( getCDIArgumentObjects() ); - list.addAll( getCDILocalVariableObjects() ); - return list; - } - - protected boolean isTopStackFrame() throws DebugException { - IStackFrame tos = getThread().getTopStackFrame(); - return tos != null && tos.equals( this ); - } - - protected void disposeAllVariables() { - if ( fVariables == null ) - return; - Iterator it = fVariables.iterator(); - while( it.hasNext() ) { - ((CVariable)it.next()).dispose(); - } - fVariables.clear(); - fVariables = null; - } - - protected void disposeExpressions() { - if ( fExpressions != null ) { - Iterator it = fExpressions.iterator(); - while( it.hasNext() ) { - ((CExpression)it.next()).dispose(); - } - fExpressions.clear(); - } - fExpressions = null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress() - */ - @Override - public IAddress getAddress() { - IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - return cdiFrame != null ? factory.createAddress( cdiFrame.getLocator().getAddress() ) : null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFile() - */ - @Override - public String getFile() { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - return cdiFrame != null ? cdiFrame.getLocator().getFile() : ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFunction() - */ - @Override - public String getFunction() { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - return cdiFrame != null ? cdiFrame.getLocator().getFunction() : ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getLevel() - */ - @Override - public int getLevel() { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - return cdiFrame != null ? cdiFrame.getLevel() : -1; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFrameLineNumber() - */ - @Override - public int getFrameLineNumber() { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - return cdiFrame != null ? cdiFrame.getLocator().getLineNumber() : -1; - } - - protected synchronized void preserve() { - preserveVariables(); - preserveExpressions(); - } - - private void preserveVariables() { - if ( fVariables == null ) - return; - Iterator it = fVariables.iterator(); - while( it.hasNext() ) { - AbstractCVariable av = (AbstractCVariable)it.next(); - av.preserve(); - } - } - - private void preserveExpressions() { - if ( fExpressions == null ) - return; - Iterator it = fExpressions.iterator(); - while( it.hasNext() ) { - CExpression exp = (CExpression)it.next(); - exp.preserve(); - } - } - - protected ICDIVariableDescriptor findVariable( List list, CVariable var ) { - Iterator it = list.iterator(); - while( it.hasNext() ) { - ICDIVariableDescriptor newVarObject = (ICDIVariableDescriptor)it.next(); - if ( var.sameVariable( newVarObject ) ) - return newVarObject; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRestart#canRestart() - */ - @Override - public boolean canRestart() { - return getDebugTarget() instanceof IRestart && ((IRestart)getDebugTarget()).canRestart(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRestart#restart() - */ - @Override - public void restart() throws DebugException { - if ( canRestart() ) { - ((IRestart)getDebugTarget()).restart(); - } - } - - public void setRefreshVariables( boolean refresh ) { - fRefreshVariables = refresh; - } - - private boolean refreshVariables() { - return fRefreshVariables; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal() - */ - @Override - public boolean canResumeWithoutSignal() { - return (getDebugTarget() instanceof IResumeWithoutSignal && ((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal()); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal() - */ - @Override - public void resumeWithoutSignal() throws DebugException { - if ( canResumeWithoutSignal() ) { - ((IResumeWithoutSignal)getDebugTarget()).resumeWithoutSignal(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String) - */ - @Override - public IValue evaluateExpression( String expressionText ) throws DebugException { - if ( !isDisposed() ) { - CExpression expression = getExpression( expressionText ); - if ( expression != null ) { - return expression.getValue( this ); - } - } - return null; - } - - private ICGlobalVariable[] getGlobals() { - CGlobalVariableManager gvm = ((CDebugTarget)getDebugTarget()).getGlobalVariableManager(); - if ( gvm != null ) { - return gvm.getGlobals(); - } - return new ICGlobalVariable[0]; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - try { - return getName(); - } - catch( DebugException e ) { - return e.getLocalizedMessage(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpressionToString(java.lang.String) - */ - @Override - public String evaluateExpressionToString( String expression ) throws DebugException { - try { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - if (cdiFrame != null) { - return getCDITarget().evaluateExpressionToString( cdiFrame, expression ); - } - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICStackFrame#canEvaluate() - */ - @Override - public boolean canEvaluate() { - CDebugTarget target = ((CDebugTarget)getDebugTarget()); - return target.supportsExpressionEvaluation() && isSuspended(); - } - - protected void doStepReturn() throws DebugException { - try { - final ICDIStackFrame cdiFrame = getCDIStackFrame(); - if (cdiFrame != null) { - cdiFrame.stepReturn(); - } - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - - private synchronized CExpression getExpression( String expressionText ) throws DebugException { - if ( isDisposed() ) { - return null; - } - if ( fExpressions == null ) { - fExpressions = new ArrayList( 5 ); - } - CExpression expression = null; - Iterator it = fExpressions.iterator(); - while( it.hasNext() ) { - expression = (CExpression)it.next(); - if ( expression.getExpressionText().compareTo( expressionText ) == 0 ) { - return expression; - } - } - try { - ICDIExpression cdiExpression = ((CDebugTarget)getDebugTarget()).getCDITarget().createExpression( expressionText ); - expression = new CExpression( this, cdiExpression, null ); - fExpressions.add( expression ); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - return expression; - } - - protected boolean isDisposed() { - return fIsDisposed; - } - - private synchronized void setDisposed( boolean isDisposed ) { - fIsDisposed = isDisposed; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(org.eclipse.core.resources.IFile, int) - */ - @Override - public boolean canRunToLine( IFile file, int lineNumber ) { - return ((CThread)getThread()).canRunToLine( file, lineNumber ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(org.eclipse.core.resources.IFile, int, boolean) - */ - @Override - public void runToLine( IFile file, int lineNumber, boolean skipBreakpoints ) throws DebugException { - if ( !canRunToLine( file, lineNumber ) ) - return; - ((CThread)getThread()).runToLine( file, lineNumber, skipBreakpoints ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(java.lang.String, int) - */ - @Override - public boolean canRunToLine( String fileName, int lineNumber ) { - return ((CThread)getThread()).canRunToLine( fileName, lineNumber ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(java.lang.String, int, boolean) - */ - @Override - public void runToLine( String fileName, int lineNumber, boolean skipBreakpoints ) throws DebugException { - if ( !canRunToLine( fileName, lineNumber ) ) - return; - ((CThread)getThread()).runToLine( fileName, lineNumber, skipBreakpoints ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(org.eclipse.cdt.core.IAddress) - */ - @Override - public boolean canRunToAddress( IAddress address ) { - return getThread().canResume(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToAddress(org.eclipse.cdt.core.IAddress, boolean) - */ - @Override - public void runToAddress( IAddress address, boolean skipBreakpoints ) throws DebugException { - if ( !canRunToAddress( address ) ) - return; - if ( skipBreakpoints ) { - ((CDebugTarget)getDebugTarget()).skipBreakpoints( true ); - } - ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) ); - try { - getCDIThread().stepUntil( location ); - } - catch( CDIException e ) { - if ( skipBreakpoints ) { - ((CDebugTarget)getDebugTarget()).skipBreakpoints( false ); - } - targetRequestFailed( e.getMessage(), e ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeAtLine#canResumeAtLine(org.eclipse.core.resources.IFile, int) - */ - @Override - public boolean canResumeAtLine( IFile file, int lineNumber ) { - return getThread().canResume(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeAtLine#resumeAtLine(org.eclipse.core.resources.IFile, int) - */ - @Override - public void resumeAtLine( IFile file, int lineNumber ) throws DebugException { - if ( !canResumeAtLine( file, lineNumber ) ) - return; - resumeAtLine( file.getLocation().lastSegment(), lineNumber ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeAtLine#canResumeAtLine(java.lang.String, int) - */ - @Override - public boolean canResumeAtLine( String fileName, int lineNumber ) { - return getThread().canResume(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeAtLine#resumeAtLine(java.lang.String, int) - */ - @Override - public void resumeAtLine( String fileName, int lineNumber ) throws DebugException { - if ( !canResumeAtLine( fileName, lineNumber ) ) - return; - - ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber ); - try { - ICDIExecuteResume resumer = getCDIThread(); - resumer.resume(location); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), e ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeAtAddress#canResumeAtAddress(org.eclipse.cdt.core.IAddress) - */ - @Override - public boolean canResumeAtAddress( IAddress address ) { - return getThread().canResume(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeAtAddress#resumeAtAddress(org.eclipse.cdt.core.IAddress) - */ - @Override - public void resumeAtAddress( IAddress address ) throws DebugException { - if ( !canResumeAtAddress( address ) ) - return; - ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) ); - try { - getCDIThread().resume( location ); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), e ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IMoveToAddress#canMoveToAddress(org.eclipse.cdt.core.IAddress) - */ - @Override - public boolean canMoveToAddress(IAddress address) { - return getThread().isSuspended() && (getCDIThread() instanceof ICDIExecuteMoveInstructionPointer); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IMoveToAddress#moveToAddress(org.eclipse.cdt.core.IAddress) - */ - @Override - public void moveToAddress(IAddress address) throws DebugException { - if ( !canMoveToAddress( address ) ) - return; - ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) ); - ICDIExecuteMoveInstructionPointer mover = (ICDIExecuteMoveInstructionPointer)getCDIThread(); - try { - mover.moveInstructionPointer( location); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), e ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IMoveToLine#canMoveToLine(java.lang.String, int) - */ - @Override - public boolean canMoveToLine(String fileName, int lineNumber) { - return getThread().isSuspended() && (getCDIThread() instanceof ICDIExecuteMoveInstructionPointer); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IMoveToLine#moveToLine(java.lang.String, int) - */ - @Override - public void moveToLine(String fileName, int lineNumber) throws DebugException { - if ( !canMoveToLine( fileName, lineNumber ) ) - return; - ICDILocation location= getCDITarget().createLineLocation( fileName, lineNumber ); - ICDIExecuteMoveInstructionPointer mover = (ICDIExecuteMoveInstructionPointer)getCDIThread(); - try { - mover.moveInstructionPointer( location ); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), e ); - } - } - - private ICDIThread getCDIThread() { - return ((CThread)getThread()).getCDIThread(); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java deleted file mode 100644 index 726c3bfeddd..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java +++ /dev/null @@ -1,1101 +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 - * Stefan Bylund (Enea, steby@enea.se) - patch for bug 155464 - * Ken Ryall (Nokia) - Support for breakpoint actions (bug 118308) - * Ling Wang (Nokia) - Bug 176077 - * Denis Pilat (ST) - Bug 205017 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import com.ibm.icu.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit; -import org.eclipse.cdt.debug.core.cdi.ICDIEndSteppingRange; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; -import org.eclipse.cdt.debug.core.cdi.ICDISignalReceived; -import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger; -import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIDisconnectedEvent; -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.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIDisposable; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.core.model.CDebugElementState; -import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.cdt.debug.core.model.IDummyStackFrame; -import org.eclipse.cdt.debug.core.model.IMoveToAddress; -import org.eclipse.cdt.debug.core.model.IMoveToLine; -import org.eclipse.cdt.debug.core.model.IRestart; -import org.eclipse.cdt.debug.core.model.IResumeAtAddress; -import org.eclipse.cdt.debug.core.model.IResumeAtLine; -import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal; -import org.eclipse.cdt.debug.core.model.IRunToAddress; -import org.eclipse.cdt.debug.core.model.IRunToLine; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IMemoryBlockRetrieval; -import org.eclipse.debug.core.model.IStackFrame; - -/** - * A thread in a C/C++ debug model. - */ -public class CThread extends CDebugElement implements ICThread, IRestart, IResumeWithoutSignal, ICDIEventListener { - - private final static int MAX_STACK_DEPTH = 100; - - /** - * Underlying CDI thread. - */ - private ICDIThread fCDIThread; - - /** - * Collection of stack frames - */ - private ArrayList fStackFrames; - - /** - * Whether children need to be refreshed. Set to <code>true</code> when stack frames are re-used on the next suspend. - */ - private boolean fRefreshChildren = true; - - /** - * The debug configuration of this session. - */ - private ICDITargetConfiguration fConfig; - - /** - * Whether this thread is current. - */ - private boolean fIsCurrent = false; - - /** - * The depth of the current stack. - */ - private int fLastStackDepth = 0; - - /** - * Whether this thread is disposed. - */ - private boolean fDisposed = false; - - /** - * Constructor for CThread. - */ - public CThread( CDebugTarget target, ICDIThread cdiThread ) { - super( target ); - setState( cdiThread.isSuspended() ? CDebugElementState.SUSPENDED : CDebugElementState.RESUMED ); - setCDIThread( cdiThread ); - fConfig = getCDITarget().getConfiguration(); - initialize(); - getCDISession().getEventManager().addEventListener( this ); - } - - protected void initialize() { - fStackFrames = new ArrayList(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getStackFrames() - */ - @Override - public IStackFrame[] getStackFrames() throws DebugException { - List list = Collections.EMPTY_LIST; - try { - list = computeStackFrames(); - } - catch( DebugException e ) { - setStatus( ICDebugElementStatus.ERROR, e.getStatus().getMessage() ); - throw e; - } - return (IStackFrame[])list.toArray( new IStackFrame[list.size()] ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#hasStackFrames() - */ - @Override - public boolean hasStackFrames() throws DebugException { - // Always return true to postpone the stack frames request. - // But not if the thread is already resumed. This fixes flickering in the Debug View. - if (getState().equals( CDebugElementState.RESUMED )) - return false; - - return true; - } - - /** - * @see computeStackFrames() - * - * @param refreshChildren whether or not this method should request new stack frames from the target - */ - protected synchronized List computeStackFrames( boolean refreshChildren ) throws DebugException { - if ( isSuspended() ) { - if ( isTerminated() ) { - fStackFrames = new ArrayList(); - } - else if ( refreshChildren ) { - // Remove dummy frame - if ( fStackFrames.size() > 0 ) { - Object frame = fStackFrames.get( fStackFrames.size() - 1 ); - if ( frame instanceof IDummyStackFrame ) { - fStackFrames.remove( frame ); - } - } - // Retrieve stack frames from the backend - int depth = getStackDepth(); - if ( depth >= getMaxStackDepth() ) - depth = getMaxStackDepth() - 1; - ICDIStackFrame[] frames = ( depth != 0 ) ? getCDIStackFrames( 0, depth - 1 ) : new ICDIStackFrame[0]; - - // Safety precaution in case getting the stack frames failed to get us as many as it said - depth = frames.length; - - if ( fStackFrames.isEmpty() ) { - if ( frames.length > 0 ) { - addStackFrames( frames, 0, frames.length, false ); - } - } - else { - int diff = depth - getLastStackDepth(); - int offset = ( diff > 0 ) ? frames.length - diff : 0; - int length = ( diff > 0 ) ? diff : -diff; - if (offset < 0 || !compareStackFrames( frames, fStackFrames, offset, length ) ) { - // replace all frames - disposeStackFrames( 0, fStackFrames.size() ); - addStackFrames( frames, 0, frames.length, false ); - } - if ( diff < 0 ) { - // stepping out of the last frame - disposeStackFrames( 0, getLastStackDepth() - depth ); - if ( frames.length > 0 ) { - updateStackFrames( frames, 0, fStackFrames, fStackFrames.size() ); - if ( fStackFrames.size() < frames.length ) { - addStackFrames( frames, fStackFrames.size(), frames.length - fStackFrames.size(), true ); - } - } - } - else if ( diff > 0 ) { - // stepping into a new frame - disposeStackFrames( frames.length - depth + getLastStackDepth(), depth - getLastStackDepth() ); - addStackFrames( frames, 0, depth - getLastStackDepth(), false ); - updateStackFrames( frames, depth - getLastStackDepth(), fStackFrames, frames.length - depth + getLastStackDepth() ); - } - else { // diff == 0 - if ( depth != 0 ) { - // we are in the same frame - updateStackFrames( frames, 0, fStackFrames, frames.length ); - } - } - } - if ( depth > getMaxStackDepth() ) { - fStackFrames.add( new CDummyStackFrame( this ) ); - } - setLastStackDepth( depth ); - setRefreshChildren( false ); - } - } - return fStackFrames; - } - - /** - * Compares the lists of the old and new frames. - * - * @param newFrames the array of the new frames - * @param oldFrames the list of the old frames - * @param offset the offset in the new frames array - * @param length the number of frames to compare - * - * @return <code>true</code> if all frames are same - */ - private boolean compareStackFrames( ICDIStackFrame[] newFrames, List oldFrames, int offset, int length ) { - if (offset<0) return false; - int index = offset; - Iterator it = oldFrames.iterator(); - while( it.hasNext() && index < newFrames.length ) { - CStackFrame frame = (CStackFrame)it.next(); - if ( !frame.getCDIStackFrame().equals( newFrames[index++] ) ) - return false; - } - return true; - } - - /** - * Retrieves and returns all underlying stack frames - * - * @return list of <code>StackFrame</code> - * @exception DebugException if this method fails. Reasons include: - * <ul> - * </ul> - */ - protected ICDIStackFrame[] getCDIStackFrames() throws DebugException { - return new ICDIStackFrame[0]; - } - - /** - * Retrieves and returns underlying stack frames between <code>lowFrame<code/> - * and <code>highFrame<code/>. - * - * @return list of <code>StackFrame</code> - * @exception DebugException if this method fails. Reasons include: - * <ul> - * </ul> - */ - protected ICDIStackFrame[] getCDIStackFrames( int lowFrame, int highFrame ) throws DebugException { - try { - final ICDIThread cdiThread = getCDIThread(); - if (cdiThread != null) { - return cdiThread.getStackFrames( lowFrame, highFrame ); - } - } - catch( CDIException e ) { - setStatus( ICDebugElementStatus.WARNING, MessageFormat.format( CoreModelMessages.getString( "CThread.0" ), new String[]{ e.getMessage() } ) ); //$NON-NLS-1$ - targetRequestFailed( e.getMessage(), null ); - } - return new ICDIStackFrame[0]; - } - - /** - * Replaces the underlying stack frame objects in the preserved frames list with the current underlying stack frames. - * - * @param newFrames list of current underlying <code>ICDIStackFrame</code>s. Frames from this list are assigned to the underlying frames in the - * <code>oldFrames</code> list. - * @param offset the offset in the lists at which to start replacing the old underlying frames - * @param oldFrames list of preserved frames, of type <code>CStackFrame</code> - * @param length the number of frames to replace - */ - protected void updateStackFrames( ICDIStackFrame[] newFrames, int offset, List oldFrames, int length ) throws DebugException { - for( int i = 0; i < length; i++ ) { - CStackFrame frame = (CStackFrame)oldFrames.get( offset ); - frame.setCDIStackFrame( newFrames[offset] ); - offset++; - } - } - - protected void addStackFrames( ICDIStackFrame[] newFrames, int startIndex, int length, boolean append ) { - if ( newFrames.length >= startIndex + length ) { - for( int i = 0; i < length; ++i ) { - if ( append ) - fStackFrames.add( new CStackFrame( this, newFrames[startIndex + i] ) ); - else - fStackFrames.add( i, new CStackFrame( this, newFrames[startIndex + i] ) ); - } - } - } - - /** - * Returns this thread's current stack frames as a list, computing them if required. Returns an empty collection if this thread is not currently suspended, - * or this thread is terminated. This method should be used internally to get the current stack frames, instead of calling <code>#getStackFrames()</code>, - * which makes a copy of the current list. - * <p> - * Before a thread is resumed a call must be made to one of: - * <ul> - * <li><code>preserveStackFrames()</code></li> - * <li><code>disposeStackFrames()</code></li> - * </ul> - * If stack frames are disposed before a thread is resumed, stack frames are completely re-computed on the next call to this method. If stack frames are to - * be preserved, this method will attempt to re-use any stack frame objects which represent the same stack frame as on the previous suspend. Stack frames - * are cached until a subsequent call to preserve or dispose stack frames. - * </p> - * - * @return list of <code>IStackFrame</code> - * @exception DebugException if this method fails. Reasons include: - * <ul> - * </ul> - */ - public synchronized List computeStackFrames() throws DebugException { - return computeStackFrames( refreshChildren() ); - } - - /** - * @see CThread#computeStackFrames() - * - * This method differs from computeStackFrames() in that it always requests new stack frames from the target. As this is an expensive operation, this method - * should only be used by clients who know for certain that the stack frames on the target have changed. - */ - public List computeNewStackFrames() throws DebugException { - return computeStackFrames( true ); - } - - /** - * Helper method for <code>#computeStackFrames()</code> to create all underlying stack frames. - * - * @exception DebugException if this method fails. Reasons include: - * <ul> - * </ul> - */ - protected List createAllStackFrames( int depth, ICDIStackFrame[] frames ) throws DebugException { - List list = new ArrayList( frames.length ); - for( int i = 0; i < frames.length; ++i ) { - list.add( new CStackFrame( this, frames[i] ) ); - } - if ( depth > frames.length ) { - list.add( new CDummyStackFrame( this ) ); - } - return list; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getPriority() - */ - @Override - public int getPriority() throws DebugException { - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getTopStackFrame() - */ - @Override - public IStackFrame getTopStackFrame() throws DebugException { - List c = computeStackFrames(); - return (c.isEmpty()) ? null : (IStackFrame)c.get( 0 ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getName() - */ - @Override - public String getName() throws DebugException { - final ICDIThread cdiThread = getCDIThread(); - return cdiThread != null ? cdiThread.toString() : ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getBreakpoints() - */ - @Override - public IBreakpoint[] getBreakpoints() { - List list = new ArrayList( 1 ); - if ( isSuspended() ) { - IBreakpoint bkpt = null; - if ( getCurrentStateInfo() instanceof ICDIBreakpointHit ) - bkpt = ((CDebugTarget)getDebugTarget()).getBreakpointManager().getBreakpoint( ((ICDIBreakpointHit)getCurrentStateInfo()).getBreakpoint() ); - else if ( getCurrentStateInfo() instanceof ICDIWatchpointTrigger ) - bkpt = ((CDebugTarget)getDebugTarget()).getBreakpointManager().getBreakpoint( ((ICDIWatchpointTrigger)getCurrentStateInfo()).getWatchpoint() ); - if ( bkpt != null ) - list.add( bkpt ); - } - return (IBreakpoint[])list.toArray( new IBreakpoint[list.size()] ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - if ( isDisposed() ) - return; - for( int i = 0; i < events.length; i++ ) { - ICDIEvent event = events[i]; - ICDIObject source = event.getSource(); - final ICDIThread cdiThread = getCDIThread(); - if ( source instanceof ICDIThread && cdiThread != null && source.equals( cdiThread ) ) { - if ( event instanceof ICDISuspendedEvent ) { - handleSuspendedEvent( (ICDISuspendedEvent)event ); - } - else if ( event instanceof ICDIResumedEvent ) { - handleResumedEvent( (ICDIResumedEvent)event ); - } - else if ( event instanceof ICDIDestroyedEvent ) { - handleTerminatedEvent( (ICDIDestroyedEvent)event ); - } - else if ( event instanceof ICDIDisconnectedEvent ) { - handleDisconnectedEvent( (ICDIDisconnectedEvent)event ); - } - else if ( event instanceof ICDIChangedEvent ) { - handleChangedEvent( (ICDIChangedEvent)event ); - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canResume() - */ - @Override - public boolean canResume() { - return ( fConfig.supportsResume() && isSuspended() ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(org.eclipse.core.resources.IFile, int) - */ - @Override - public boolean canRunToLine( IFile file, int lineNumber ) { - return canRunToLine( file.getLocation().lastSegment(), lineNumber ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(java.lang.String, int) - */ - @Override - public boolean canRunToLine( String fileName, int lineNumber ) { - return canResume(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() - */ - @Override - public boolean canSuspend() { - CDebugElementState state = getState(); - return ( fConfig.supportsSuspend() && (state.equals( CDebugElementState.RESUMED ) || state.equals( CDebugElementState.STEPPED )) ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() - */ - @Override - public boolean isSuspended() { - return getState().equals( CDebugElementState.SUSPENDED ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#resume() - */ - @Override - public void resume() throws DebugException { - if ( !canResume() ) - return; - CDebugElementState oldState = getState(); - setState( CDebugElementState.RESUMING ); - try { - final ICDIThread cdiThread = getCDIThread(); - if (cdiThread != null) { - cdiThread.resume( false ); - } - } - catch( CDIException e ) { - setState( oldState ); - targetRequestFailed( e.getMessage(), null ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(org.eclipse.core.resources.IFile, int, boolean) - */ - @Override - public void runToLine( IFile file, int lineNumber, boolean skipBreakpoints ) throws DebugException { - runToLine( file.getLocation().lastSegment(), lineNumber, skipBreakpoints ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(java.lang.String, int, boolean) - */ - @Override - public void runToLine( String fileName, int lineNumber, boolean skipBreakpoints ) throws DebugException { - if ( !canRunToLine( fileName, lineNumber ) ) - return; - if ( skipBreakpoints ) { - ((CDebugTarget)getDebugTarget()).skipBreakpoints( true ); - } - CDebugElementState oldState = getState(); - setState( CDebugElementState.RESUMING ); - ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber ); - - try { - final ICDIThread cdiThread = getCDIThread(); - if (cdiThread != null) { - cdiThread.stepUntil( location ); - } - } - catch( CDIException e ) { - setState( oldState ); - if ( skipBreakpoints ) { - ((CDebugTarget)getDebugTarget()).skipBreakpoints( false ); - } - targetRequestFailed( e.getMessage(), e ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#suspend() - */ - @Override - public void suspend() throws DebugException { - if ( !canSuspend() ) - return; - CDebugElementState oldState = getState(); - setState( CDebugElementState.SUSPENDING ); - try { - final ICDIThread cdiThread = getCDIThread(); - if (cdiThread != null) { - cdiThread.suspend(); - } - } - catch( CDIException e ) { - setState( oldState ); - targetRequestFailed( e.getMessage(), null ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepInto() - */ - @Override - public boolean canStepInto() { - return canStep(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepOver() - */ - @Override - public boolean canStepOver() { - return canStep(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepReturn() - */ - @Override - public boolean canStepReturn() { - if ( !fConfig.supportsStepping() || !canResume() ) { - return false; - } - return ( fStackFrames.size() > 1 ); - } - - /** - * Returns whether this thread is in a valid state to step. - * - * @return whether this thread is in a valid state to step - */ - protected boolean canStep() { - if ( !fConfig.supportsStepping() || !isSuspended() ) { - return false; - } - return !fStackFrames.isEmpty(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#isStepping() - */ - @Override - public boolean isStepping() { - return ( getState().equals( CDebugElementState.STEPPING ) ) || ( getState().equals( CDebugElementState.STEPPED ) ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepInto() - */ - @Override - public void stepInto() throws DebugException { - if ( !canStepInto() ) - return; - CDebugElementState oldState = getState(); - setState( CDebugElementState.STEPPING ); - try { - final ICDIThread cdiThread = getCDIThread(); - if (cdiThread != null) { - if ( !isInstructionsteppingEnabled() ) { - cdiThread.stepInto( 1 ); - } - else { - cdiThread.stepIntoInstruction( 1 ); - } - } - } - catch( CDIException e ) { - setState( oldState ); - targetRequestFailed( e.getMessage(), null ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepOver() - */ - @Override - public void stepOver() throws DebugException { - if ( !canStepOver() ) - return; - CDebugElementState oldState = getState(); - setState( CDebugElementState.STEPPING ); - try { - final ICDIThread cdiThread = getCDIThread(); - if (cdiThread != null) { - if ( !isInstructionsteppingEnabled() ) { - cdiThread.stepOver( 1 ); - } - else { - cdiThread.stepOverInstruction( 1 ); - } - } - } - catch( CDIException e ) { - setState( oldState ); - targetRequestFailed( e.getMessage(), null ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepReturn() - */ - @Override - public void stepReturn() throws DebugException { - if ( !canStepReturn() ) - return; - IStackFrame[] frames = getStackFrames(); - if ( frames.length == 0 ) - return; - CStackFrame f = (CStackFrame)frames[0]; - CDebugElementState oldState = getState(); - setState( CDebugElementState.STEPPING ); - try { - f.doStepReturn(); - } - catch( DebugException e ) { - setState( oldState ); - throw e; - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#canTerminate() - */ - @Override - public boolean canTerminate() { - return getDebugTarget().canTerminate(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#isTerminated() - */ - @Override - public boolean isTerminated() { - return getDebugTarget().isTerminated(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#terminate() - */ - @Override - public void terminate() throws DebugException { - getDebugTarget().terminate(); - } - - /** - * Sets the underlying CDI thread that this model object is a proxy to. - * - * @param thread the underlying CDI thread - */ - protected void setCDIThread( ICDIThread cdiThread ) { - fCDIThread = cdiThread; - } - - /** - * Returns the underlying CDI thread that this model object is a proxy to. - * - * @return the underlying CDI thread - */ - protected ICDIThread getCDIThread() { - return fCDIThread; - } - - /** - * Preserves stack frames to be used on the next suspend event. Iterates through all current stack frames, setting their state as invalid. This method - * should be called before this thread is resumed, when stack frames are to be re-used when it later suspends. - * - * @see computeStackFrames() - */ - protected synchronized void preserveStackFrames() { - Iterator it = fStackFrames.iterator(); - while( it.hasNext() ) { - CStackFrame frame = (((IAdaptable)it.next()).getAdapter( CStackFrame.class )); - if ( frame != null ) { - frame.preserve(); - } - } - setRefreshChildren( true ); - } - - /** - * Disposes stack frames, to be completely re-computed on the next suspend event. This method should be called before this thread is resumed when stack - * frames are not to be re-used on the next suspend. - */ - protected synchronized void disposeStackFrames() { - Iterator it = fStackFrames.iterator(); - while( it.hasNext() ) { - Object obj = it.next(); - if ( obj instanceof CStackFrame ) { - ((CStackFrame)obj).dispose(); - } - } - fStackFrames.clear(); - setLastStackDepth( 0 ); - resetStatus(); - setRefreshChildren( true ); - } - - protected void disposeStackFrames( int index, int length ) { - List removeList = new ArrayList( length ); - Iterator it = fStackFrames.iterator(); - int counter = 0; - while( it.hasNext() ) { - CStackFrame frame = (((IAdaptable)it.next()).getAdapter( CStackFrame.class )); - if ( frame != null && counter >= index && counter < index + length ) { - frame.dispose(); - removeList.add( frame ); - } - ++counter; - } - fStackFrames.removeAll( removeList ); - } - - /** - * Notification this thread has terminated - update state and fire a terminate event. - */ - protected void terminated() { - setState( CDebugElementState.TERMINATED ); - dispose(); - } - - private void handleSuspendedEvent( ICDISuspendedEvent event ) { - if ( !(getState().equals( CDebugElementState.RESUMED ) || - getState().equals( CDebugElementState.STEPPED ) || - getState().equals( CDebugElementState.SUSPENDING )) ) - return; - setState( CDebugElementState.SUSPENDED ); - ICDISessionObject reason = event.getReason(); - setCurrentStateInfo( reason ); - if ( reason instanceof ICDIEndSteppingRange ) { - handleEndSteppingRange( (ICDIEndSteppingRange)reason ); - } - else if ( reason instanceof ICDIBreakpointHit ) { - handleBreakpointHit( (ICDIBreakpointHit)reason ); - } - else if ( reason instanceof ICDISignalReceived ) { - handleSuspendedBySignal( (ICDISignalReceived)reason ); - } - else { - // fireSuspendEvent( DebugEvent.CLIENT_REQUEST ); - // Temporary fix for bug 56520 - fireSuspendEvent( DebugEvent.BREAKPOINT ); - } - } - - private void handleResumedEvent( ICDIResumedEvent event ) { - CDebugElementState state = CDebugElementState.RESUMED; - int detail = DebugEvent.RESUME; - syncWithBackend(); - if ( isCurrent() && event.getType() != ICDIResumedEvent.CONTINUE ) { - preserveStackFrames(); - switch( event.getType() ) { - case ICDIResumedEvent.STEP_INTO: - case ICDIResumedEvent.STEP_INTO_INSTRUCTION: - detail = DebugEvent.STEP_INTO; - break; - case ICDIResumedEvent.STEP_OVER: - case ICDIResumedEvent.STEP_OVER_INSTRUCTION: - detail = DebugEvent.STEP_OVER; - break; - case ICDIResumedEvent.STEP_RETURN: - detail = DebugEvent.STEP_RETURN; - break; - } - state = CDebugElementState.STEPPED; - } - else { - disposeStackFrames(); - fireChangeEvent( DebugEvent.CONTENT ); - } - setCurrent( false ); - setState( state ); - setCurrentStateInfo( null ); - fireResumeEvent( detail ); - } - - private void handleEndSteppingRange( ICDIEndSteppingRange endSteppingRange ) { - fireSuspendEvent( DebugEvent.STEP_END ); - } - - private void handleBreakpointHit( ICDIBreakpointHit breakpointHit ) { - IBreakpoint platformBreakpoint = ((CDebugTarget)getDebugTarget()).getBreakpointManager().getBreakpoint(breakpointHit.getBreakpoint()); - if (platformBreakpoint != null) - CDebugCorePlugin.getDefault().getBreakpointActionManager().executeActions(platformBreakpoint, this); - fireSuspendEvent( DebugEvent.BREAKPOINT ); - } - - private void handleWatchpointHit( ICDIWatchpointTrigger watchPointTrigger ) { - IBreakpoint platformBreakpoint = ((CDebugTarget)getDebugTarget()).getBreakpointManager().getBreakpoint(watchPointTrigger.getWatchpoint()); - if (platformBreakpoint != null) - CDebugCorePlugin.getDefault().getBreakpointActionManager().executeActions(platformBreakpoint, this); - fireSuspendEvent( DebugEvent.BREAKPOINT ); - } - - private void handleSuspendedBySignal( ICDISignalReceived signal ) { - fireSuspendEvent( DebugEvent.CLIENT_REQUEST ); - } - - private void handleTerminatedEvent( ICDIDestroyedEvent event ) { - setState( CDebugElementState.TERMINATED ); - setCurrentStateInfo( null ); - terminated(); - } - - private void handleDisconnectedEvent( ICDIDisconnectedEvent event ) { - setState( CDebugElementState.TERMINATED ); - setCurrentStateInfo( null ); - terminated(); - } - - private void handleChangedEvent( ICDIChangedEvent event ) { - } - - /** - * Cleans up the internal state of this thread. - */ - protected void cleanup() { - getCDISession().getEventManager().removeEventListener( this ); - disposeStackFrames(); - - final ICDIThread cdiThread = getCDIThread(); - setCDIThread(null); - if (cdiThread instanceof ICDIDisposable) { - ((ICDIDisposable)cdiThread).dispose(); - } - } - - private void setRefreshChildren( boolean refresh ) { - fRefreshChildren = refresh; - } - - private boolean refreshChildren() { - return fRefreshChildren; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRestart#canRestart() - */ - @Override - public boolean canRestart() { - return getDebugTarget() instanceof IRestart && ((IRestart)getDebugTarget()).canRestart(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IRestart#restart() - */ - @Override - public void restart() throws DebugException { - if ( canRestart() ) { - ((IRestart)getDebugTarget()).restart(); - } - } - - protected boolean isCurrent() { - return fIsCurrent; - } - - protected void setCurrent( boolean current ) { - boolean c = current; - if ( !c ) { - if ( getCDITarget().getConfiguration() instanceof ICDITargetConfiguration2 - && ((ICDITargetConfiguration2)getCDITarget().getConfiguration()).supportsThreadControl() ) - c = true; // When the debugger can control individual - // threads treat every thread is "current" - } - fIsCurrent = c; - } - - protected int getStackDepth() throws DebugException { - int depth = 0; - try { - final ICDIThread cdiThread = getCDIThread(); - if (cdiThread != null) { - depth = cdiThread.getStackFrameCount(); - } - } - catch( CDIException e ) { - setStatus( ICDebugElementStatus.WARNING, MessageFormat.format( CoreModelMessages.getString( "CThread.1" ), new String[]{ e.getMessage() } ) ); //$NON-NLS-1$ - } - return depth; - } - - protected int getMaxStackDepth() { - return MAX_STACK_DEPTH; - } - - private void setLastStackDepth( int depth ) { - fLastStackDepth = depth; - } - - protected int getLastStackDepth() { - return fLastStackDepth; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( adapter.equals( IRunToLine.class ) || - adapter.equals( IRunToAddress.class ) || - adapter.equals( IResumeAtLine.class ) || - adapter.equals( IResumeAtAddress.class ) || - adapter.equals( IMoveToLine.class ) || - adapter.equals( IMoveToAddress.class ) ) { - try { - // Alain: Put a proper fix later. - Object obj = getTopStackFrame(); - if (obj instanceof ICStackFrame) { - return obj; - } - } - catch( DebugException e ) { - // do nothing - } - } - if ( adapter.equals( CDebugElementState.class ) ) - return this; - if ( adapter == ICStackFrame.class ) { - try { - // Alain: Put a proper fix later. - Object obj = getTopStackFrame(); - if (obj instanceof ICStackFrame) { - return obj; - } - } - catch( DebugException e ) { - // do nothing - } - } - if ( adapter == IMemoryBlockRetrieval.class ) { - return getDebugTarget().getAdapter( adapter ); - } - if ( adapter == ICDIThread.class ) { - return getCDIThread(); - } - return super.getAdapter( adapter ); - } - - protected void dispose() { - fDisposed = true; - cleanup(); - } - - protected boolean isDisposed() { - return fDisposed; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal() - */ - @Override - public boolean canResumeWithoutSignal() { - return (getDebugTarget() instanceof IResumeWithoutSignal && ((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal()); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal() - */ - @Override - public void resumeWithoutSignal() throws DebugException { - if ( canResumeWithoutSignal() ) { - ((IResumeWithoutSignal)getDebugTarget()).resumeWithoutSignal(); - } - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - String result = ""; //$NON-NLS-1$ - try { - result = getName(); - } - catch( DebugException e ) { - } - return result; - } - - protected void resumedByTarget( int detail, List events ) { - syncWithBackend(); - if ( isCurrent() && detail != DebugEvent.CLIENT_REQUEST && detail != DebugEvent.UNSPECIFIED ) { - setState( CDebugElementState.STEPPED ); - preserveStackFrames(); - events.add( createResumeEvent( detail ) ); - } - else { - setState( CDebugElementState.RESUMED ); - disposeStackFrames(); - // events.add( createResumeEvent( DebugEvent.CLIENT_REQUEST ) ); FIX FOR 218260 - } - setCurrent( false ); - setCurrentStateInfo( null ); - } - - protected boolean isInstructionsteppingEnabled() { - return ((CDebugTarget)getDebugTarget()).isInstructionSteppingEnabled(); - } - - protected void suspendByTarget( ICDISessionObject reason, ICDIThread suspensionThread ) { - setState( CDebugElementState.SUSPENDED ); - setCurrentStateInfo( null ); - final ICDIThread cdiThread = getCDIThread(); - if ( cdiThread != null && cdiThread.equals( suspensionThread ) ) { - setCurrent( true ); - setCurrentStateInfo( reason ); - if ( reason instanceof ICDIEndSteppingRange ) { - handleEndSteppingRange( (ICDIEndSteppingRange)reason ); - } - else if ( reason instanceof ICDIBreakpointHit ) { - handleBreakpointHit( (ICDIBreakpointHit)reason ); - } - else if ( reason instanceof ICDIWatchpointTrigger ) { - handleWatchpointHit( (ICDIWatchpointTrigger)reason ); - } - else if ( reason instanceof ICDISignalReceived ) { - handleSuspendedBySignal( (ICDISignalReceived)reason ); - } - else { - // fireSuspendEvent( DebugEvent.CLIENT_REQUEST ); - // Temporary fix for bug 56520 - fireSuspendEvent( DebugEvent.BREAKPOINT ); - } - } - } - - private void syncWithBackend() { - ICDIThread cdiThread = getCDIThread(); - if (cdiThread == null) { - return; - } - - ICDIThread currentThread = null; - try { - currentThread = cdiThread.getTarget().getCurrentThread(); - } - catch( CDIException e ) { - // ignore - } - setCurrent( cdiThread.equals( currentThread ) ); - } - -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CType.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CType.java deleted file mode 100644 index d85cbc4ec29..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CType.java +++ /dev/null @@ -1,148 +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.internal.core.model; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralType; -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.ICDIStructType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.core.model.ICType; - -/** - * The CDI-based implementation of <code>ICType</code>. - */ -public class CType implements ICType { - - /** - * The underlying CDI type. - */ - private ICDIType fCDIType; - - /** - * Constructor for CType. - */ - public CType( ICDIType cdiType ) { - setCDIType( cdiType ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#getName() - */ - @Override - public String getName() { - return ( fCDIType != null ) ? fCDIType.getTypeName() : null; - } - - public void dispose() { - fCDIType = null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#getArrayDimensions() - */ - @Override - public int[] getArrayDimensions() { - int length = 0; - ICDIType type = getCDIType(); - while( type instanceof ICDIArrayType ) { - ++length; - type = ((ICDIDerivedType)type).getComponentType(); - } - int[] dims = new int[length]; - type = getCDIType(); - for (int i = 0; i < length; i++) { - dims[i] = ((ICDIArrayType)type).getDimension(); - type = ((ICDIDerivedType)type).getComponentType(); - } - return dims; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isArray() - */ - @Override - public boolean isArray() { - return ( getCDIType() instanceof ICDIArrayType ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isCharacter() - */ - @Override - public boolean isCharacter() { - return ( getCDIType() instanceof ICDICharType ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isFloatingPointType() - */ - @Override - public boolean isFloatingPointType() { - return ( getCDIType() instanceof ICDIFloatingPointType ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isPointer() - */ - @Override - public boolean isPointer() { - return ( getCDIType() instanceof ICDIPointerType ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isReference() - */ - @Override - public boolean isReference() { - return ( getCDIType() instanceof ICDIReferenceType ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isStructure() - */ - @Override - public boolean isStructure() { - return ( getCDIType() instanceof ICDIStructType ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isUnsigned() - */ - @Override - public boolean isUnsigned() { - return ( isIntegralType() ) ? ((ICDIIntegralType)getCDIType()).isUnsigned() : false; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICType#isIntegralType() - */ - @Override - public boolean isIntegralType() { - return ( getCDIType() instanceof ICDIIntegralType ); - } - - protected ICDIType getCDIType() { - return fCDIType; - } - - protected void setCDIType( ICDIType type ) { - fCDIType = type; - } - - protected boolean isAggregate() { - return ( isArray() || isStructure() || isPointer() || isReference() ); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java deleted file mode 100644 index ffa02991cec..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java +++ /dev/null @@ -1,846 +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 - * Mark Mitchell, CodeSourcery - Bug 136896: View variables in binary format - * Warren Paul (Nokia) - 150860, 150864, 150862, 150863, 217493 - * Ken Ryall (Nokia) - 207675 - * Mathias Kunter - Support for octal number format (bug 370462) -*******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.nio.charset.CharacterCodingException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIFormat; -import org.eclipse.cdt.debug.core.cdi.ICDIFormattable; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2; -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.ICDIBoolValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBigIntegerValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharValue; -import org.eclipse.cdt.debug.core.model.CVariableFormat; -import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.utils.Addr32; -import org.eclipse.cdt.utils.Addr64; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IVariable; - -/** - * Represents the value of a variable in the CDI model. - */ -public class CValue extends AbstractCValue { - /** - * Cached value. - */ - private String fValueString = null; - - /** - * Underlying CDI value. - */ - private ICDIValue fCDIValue; - - /** - * List of child variables. - */ - private List<AbstractCVariable> fVariables = new ArrayList<AbstractCVariable>(); - - private CType fType; - - /** - * Constructor for CValue. - */ - protected CValue( CVariable parent, ICDIValue cdiValue ) { - super( parent ); - fCDIValue = cdiValue; - } - - /** - * Constructor for CValue. - */ - protected CValue( CVariable parent, String message ) { - super( parent ); - setStatus( ICDebugElementStatus.ERROR, message ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() - */ - @Override - public String getReferenceTypeName() throws DebugException { - return ( getParentVariable() != null ) ? getParentVariable().getReferenceTypeName() : null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getValueString() - */ - @Override - public String getValueString() throws DebugException { - if ( fValueString == null && getUnderlyingValue() != null ) { - resetStatus(); - ICStackFrame cframe = getParentVariable().getStackFrame(); - boolean isSuspended = (cframe == null) ? getCDITarget().isSuspended() : cframe.isSuspended(); - if ( isSuspended ) { - try { - fValueString = processUnderlyingValue( getUnderlyingValue() ); - } - catch( CDIException e ) { - setStatus( ICDebugElementStatus.ERROR, e.getMessage() ); - fValueString = e.getLocalizedMessage(); - } - } - } - return fValueString; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#isAllocated() - */ - @Override - public boolean isAllocated() throws DebugException { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getVariables() - */ - @Override - public IVariable[] getVariables() throws DebugException { - List<AbstractCVariable> list = getVariables0(); - return list.toArray( new IVariable[list.size()] ); - } - - protected synchronized List<AbstractCVariable> getVariables0() throws DebugException { - if ( !isAllocated() || !hasVariables() ) - return new ArrayList<AbstractCVariable>(); - if ( fVariables.size() == 0 ) { - try { - List<ICDIVariable> vars = getCDIVariables(); - for (ICDIVariable var : vars) { - if (getParentVariable() instanceof CGlobalVariable) { - fVariables.add(CVariableFactory.createGlobalVariable( - this, - null, - var)); - } - else { - fVariables.add(CVariableFactory.createLocalVariable(this, var)); - } - } - resetStatus(); - } - catch( DebugException e ) { - setStatus( ICDebugElementStatus.ERROR, e.getMessage() ); - } - } - return fVariables; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#hasVariables() - */ - @Override - public boolean hasVariables() throws DebugException { - try { - ICDIValue value = getUnderlyingValue(); - if ( value != null ) - return value.getChildrenNumber() > 0; - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - return false; - } - - public ICDIValue getUnderlyingValue() { - return fCDIValue; - } - - protected List<ICDIVariable> getCDIVariables() throws DebugException { - ICDIVariable[] vars = null; - try { - ICDIValue value = getUnderlyingValue(); - if ( value != null ) { - vars = value.getVariables(); - } - } - catch( CDIException e ) { - requestFailed( e.getMessage(), e ); - } - - // getVariables should return an empty array instead of null. - if ( vars == null ) { - vars = new ICDIVariable[0]; - } - - return Arrays.asList( vars ); - } - - @Override - protected synchronized void setChanged( boolean changed ) { - if ( changed ) { - fValueString = null; - resetStatus(); - } - else { - if (getCDITarget().getConfiguration() instanceof ICDITargetConfiguration2 && - ((ICDITargetConfiguration2)getCDITarget().getConfiguration()).supportsPassiveVariableUpdate()) - fValueString = null; - } - - for (AbstractCVariable var : fVariables) { - var.setChanged( changed ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#dispose() - */ - @Override - public void dispose() { - for (AbstractCVariable var : fVariables) { - var.dispose(); - } - } - - private String processUnderlyingValue( ICDIValue cdiValue ) throws CDIException { - if ( cdiValue != null ) { - if ( cdiValue instanceof ICDIBoolValue ) - return getBoolValueString( (ICDIBoolValue)cdiValue ); - if ( cdiValue instanceof ICDICharValue ) - return getCharValueString( (ICDICharValue)cdiValue ); - else if ( cdiValue instanceof ICDIShortValue ) - return getShortValueString( (ICDIShortValue)cdiValue ); - else if ( cdiValue instanceof ICDIIntValue ) - return getIntValueString( (ICDIIntValue)cdiValue ); - else if ( cdiValue instanceof ICDILongValue ) - return getLongValueString( (ICDILongValue)cdiValue ); - else if ( cdiValue instanceof ICDILongLongValue ) - return getLongLongValueString( (ICDILongLongValue)cdiValue ); - else if ( cdiValue instanceof ICDIBigIntegerValue ) - return getBigIntegerValueString( (ICDIBigIntegerValue)cdiValue ); - else if ( cdiValue instanceof ICDIFloatValue ) - return getFloatValueString( (ICDIFloatValue)cdiValue ); - else if ( cdiValue instanceof ICDIDoubleValue ) - return getDoubleValueString( (ICDIDoubleValue)cdiValue ); - else if ( cdiValue instanceof ICDIPointerValue ) - return getPointerValueString( (ICDIPointerValue)cdiValue ); - else if ( cdiValue instanceof ICDIReferenceValue ) - return processUnderlyingValue(((ICDIReferenceValue)cdiValue).referenceValue()); - else if ( cdiValue instanceof ICDIWCharValue ) - return getWCharValueString( (ICDIWCharValue)cdiValue ); - else - return getGenericValueString(cdiValue.getValueString()); - } - return null; - } - - private String getBoolValueString( ICDIBoolValue value ) throws CDIException { - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) ) { - short byteValue = value.shortValue(); - if (byteValue == 0) - return "false";//$NON-NLS-1$ - else if (byteValue == 1) - return "true";//$NON-NLS-1$ - else - return Integer.toString( value.shortValue() ); - } - else if ( CVariableFormat.DECIMAL.equals( format ) ) { - return Integer.toString( value.shortValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Integer.toHexString( value.shortValue() ) : Integer.toHexString( (byte)value.byteValue() ); - sb.append( (stringValue.length() > 2) ? stringValue.substring( stringValue.length() - 2 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Integer.toOctalString( value.shortValue() ) : Integer.toOctalString( (byte)value.byteValue() ); - stringValue = (stringValue.length() > 3) ? stringValue.substring( stringValue.length() - 3 ) : stringValue; - sb.append( (stringValue.length() == 3 && stringValue.charAt( 0 ) >= '4') ? (char)(stringValue.charAt( 0 ) - 4) + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Integer.toBinaryString( value.shortValue() ) : Integer.toBinaryString( (byte)value.byteValue() ); - sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue ); - return sb.toString(); - } - return null; - } - - private String getCharValueString( ICDICharValue value ) throws CDIException { - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) ) { - byte byteValue = (byte)value.byteValue(); - switch (byteValue) { - case '\b': - return "'\\b'"; //$NON-NLS-1$ - case '\t': - return "'\\t'"; //$NON-NLS-1$ - case '\n': - return "'\\n'"; //$NON-NLS-1$ - case '\f': - return "'\\f'"; //$NON-NLS-1$ - case '\r': - return "'\\r'"; //$NON-NLS-1$ - } - - if (Character.isISOControl(byteValue)) - return Byte.toString(byteValue); - else if (byteValue < 0) - return isUnsigned() ? Short.toString(value.shortValue()) : Byte.toString(byteValue); - - return new String( new byte[]{ '\'', byteValue, '\'' } ); - } - else if ( CVariableFormat.DECIMAL.equals( format ) ) { - return (isUnsigned()) ? Integer.toString( value.shortValue() ) : Integer.toString( (byte)value.byteValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Integer.toHexString( value.shortValue() ) : Integer.toHexString( (byte)value.byteValue() ); - sb.append( (stringValue.length() > 2) ? stringValue.substring( stringValue.length() - 2 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Integer.toOctalString( value.shortValue() ) : Integer.toOctalString( (byte)value.byteValue() ); - stringValue = (stringValue.length() > 3) ? stringValue.substring( stringValue.length() - 3 ) : stringValue; - sb.append( (stringValue.length() == 3 && stringValue.charAt( 0 ) >= '4') ? (char)(stringValue.charAt( 0 ) - 4) + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Integer.toBinaryString( value.shortValue() ) : Integer.toBinaryString( (byte)value.byteValue() ); - sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue ); - return sb.toString(); - } - return null; - } - - private String getShortValueString( ICDIShortValue value ) throws CDIException { - CVariableFormat format = getParentVariable().getFormat(); - - if (CVariableFormat.NATURAL.equals(format)) { - format = getNaturalFormat(value, CVariableFormat.DECIMAL); - } - - if ( CVariableFormat.DECIMAL.equals( format ) ) { - return (isUnsigned()) ? Integer.toString( value.intValue() ) : Short.toString( value.shortValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = Integer.toHexString( (isUnsigned()) ? value.intValue() : value.shortValue() ); - sb.append( (stringValue.length() > 4) ? stringValue.substring( stringValue.length() - 4 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = Integer.toOctalString( (isUnsigned()) ? value.intValue() : value.shortValue() ); - stringValue = (stringValue.length() > 6) ? stringValue.substring( stringValue.length() - 6 ) : stringValue; - sb.append( (stringValue.length() == 6 && stringValue.charAt( 0 ) >= '2') ? (char)((stringValue.charAt( 0 ) - '0') % 2 + '0') + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = Integer.toBinaryString( (isUnsigned()) ? value.intValue() : value.shortValue() ); - sb.append( (stringValue.length() > 16) ? stringValue.substring( stringValue.length() - 16 ) : stringValue ); - return sb.toString(); - } - return null; - } - - private String getIntValueString( ICDIIntValue value ) throws CDIException { - CVariableFormat format = getParentVariable().getFormat(); - - if (CVariableFormat.NATURAL.equals(format)) { - format = getNaturalFormat(value, CVariableFormat.DECIMAL); - } - - if ( CVariableFormat.DECIMAL.equals( format ) ) { - return (isUnsigned()) ? Long.toString( value.longValue() ) : Integer.toString( value.intValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Long.toHexString( value.longValue() ) : Integer.toHexString( value.intValue() ); - sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Long.toOctalString( value.longValue() ) : Integer.toOctalString( value.intValue() ); - stringValue = (stringValue.length() > 11) ? stringValue.substring( stringValue.length() - 11 ) : stringValue; - sb.append( (stringValue.length() == 11 && stringValue.charAt( 0 ) >= '4') ? (char)(stringValue.charAt( 0 ) - 4) + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Long.toBinaryString( value.longValue() ) : Integer.toBinaryString( value.intValue() ); - sb.append( (stringValue.length() > 32) ? stringValue.substring( stringValue.length() - 32 ) : stringValue ); - return sb.toString(); - } - return null; - } - - private String getLongValueString( ICDILongValue value ) throws CDIException { - try { - CVariableFormat format = getParentVariable().getFormat(); - - if (CVariableFormat.NATURAL.equals(format)) { - format = getNaturalFormat(value, CVariableFormat.DECIMAL); - } - - if ( CVariableFormat.DECIMAL.equals( format ) ) { - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - return bigValue.toString(); - } - return Integer.toString( value.intValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - sb.append( bigValue.toString( 16 ) ); - } - else - sb.append( Integer.toHexString( value.intValue() ) ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - sb.append( bigValue.toString( 8 ) ); - } - else - sb.append( Integer.toOctalString( value.intValue() ) ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - sb.append( bigValue.toString( 2 ) ); - } - else - sb.append( Integer.toBinaryString( value.intValue() ) ); - return sb.toString(); - } - } - catch( NumberFormatException e ) { - } - return null; - } - - private String getLongLongValueString( ICDILongLongValue value ) throws CDIException { - try { - CVariableFormat format = getParentVariable().getFormat(); - - if (CVariableFormat.NATURAL.equals(format)) { - format = getNaturalFormat(value, CVariableFormat.DECIMAL); - } - - if ( CVariableFormat.DECIMAL.equals( format ) ) { - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - return bigValue.toString(); - } - return Long.toString( value.longValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - sb.append( bigValue.toString( 16 ) ); - } - else - sb.append( Long.toHexString( value.longValue() ) ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - sb.append( bigValue.toString( 8 ) ); - } - else - sb.append( Long.toOctalString( value.longValue() ) ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - if ( isUnsigned() ) { - BigInteger bigValue = new BigInteger( value.getValueString() ); - sb.append( bigValue.toString( 2 ) ); - } - else - sb.append( Long.toBinaryString( value.longValue() ) ); - return sb.toString(); - } - } - catch( NumberFormatException e ) { - } - return null; - } - - private String getGenericValueString(String svalue) throws CDIException { - try { - BigInteger bigValue = new BigInteger(svalue); - CVariableFormat format = getParentVariable().getFormat(); - if (CVariableFormat.NATURAL.equals(format)) { - format = CVariableFormat.DECIMAL; - } - if (CVariableFormat.DECIMAL.equals(format)) { - return svalue; - } else if (CVariableFormat.HEXADECIMAL.equals(format)) { - StringBuffer sb = new StringBuffer("0x"); //$NON-NLS-1$ - if (isUnsigned()) { - sb.append(bigValue.toString(16)); - } else - sb.append(Long.toHexString(bigValue.longValue())); - return sb.toString(); - } else if (CVariableFormat.OCTAL.equals(format)) { - StringBuffer sb = new StringBuffer("0"); //$NON-NLS-1$ - if (isUnsigned()) { - sb.append(bigValue.toString(8)); - } else - sb.append(Long.toOctalString(bigValue.longValue())); - return sb.toString(); - } else if (CVariableFormat.BINARY.equals(format)) { - StringBuffer sb = new StringBuffer("0b"); //$NON-NLS-1$ - if (isUnsigned()) { - sb.append(bigValue.toString(2)); - } else - sb.append(Long.toBinaryString(bigValue.longValue())); - return sb.toString(); - } - } catch (NumberFormatException e) { - } - return svalue; - } - - - private String getFloatValueString( ICDIFloatValue value ) throws CDIException { - float floatValue = value.floatValue(); - if ( Float.isNaN(floatValue) ) - return "NaN"; //$NON-NLS-1$ - if ( Float.isInfinite(floatValue) ) - return "inf"; //$NON-NLS-1$ - - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) ) { - return Float.toString( floatValue ); - } - else if ( CVariableFormat.DECIMAL.equals( format ) ) { - return Long.toString( Float.floatToIntBits(floatValue) ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = Long.toHexString( Float.floatToIntBits(floatValue) ); - sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = Long.toOctalString( Float.floatToIntBits(floatValue) ); - stringValue = (stringValue.length() > 11) ? stringValue.substring( stringValue.length() - 11 ) : stringValue; - sb.append( (stringValue.length() == 11 && stringValue.charAt( 0 ) >= '4') ? (char)(stringValue.charAt( 0 ) - 4) + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = Long.toBinaryString( Float.floatToIntBits(floatValue) ); - sb.append( (stringValue.length() > 32) ? stringValue.substring( stringValue.length() - 32 ) : stringValue ); - return sb.toString(); - } - return null; - } - - private String getDoubleValueString( ICDIDoubleValue value ) throws CDIException { - double doubleValue = value.doubleValue(); - if ( Double.isNaN(doubleValue) ) - return "NaN"; //$NON-NLS-1$ - if ( Double.isInfinite(doubleValue) ) - return "inf"; //$NON-NLS-1$ - - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) ) { - return Double.toString(doubleValue); - } - else if ( CVariableFormat.DECIMAL.equals( format ) ) { - return Long.toString( Double.doubleToLongBits(doubleValue) ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = Long.toHexString( Double.doubleToLongBits(doubleValue) ); - sb.append( (stringValue.length() > 16) ? stringValue.substring( stringValue.length() - 16 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = Long.toOctalString( Double.doubleToLongBits(doubleValue) ); - stringValue = (stringValue.length() > 22) ? stringValue.substring( stringValue.length() - 22 ) : stringValue; - sb.append( (stringValue.length() == 22 && stringValue.charAt( 0 ) >= '2') ? (char)((stringValue.charAt( 0 ) - '0') % 2 + '0') + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = Long.toBinaryString( Double.doubleToLongBits(doubleValue) ); - sb.append( (stringValue.length() > 64) ? stringValue.substring( stringValue.length() - 64 ) : stringValue ); - return sb.toString(); - } - return null; - } - - private String getPointerValueString( ICDIPointerValue value ) throws CDIException { - //TODO:IPF_TODO Workaround to solve incorrect handling of structures referenced by pointers or references - IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); - BigInteger pv = value.pointerValue(); - if ( pv == null ) - return ""; //$NON-NLS-1$ - IAddress address = factory.createAddress( pv ); - if ( address == null ) - return ""; //$NON-NLS-1$ - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) - return address.toHexAddressString(); - else if ( CVariableFormat.DECIMAL.equals( format ) ) - return address.toString(); - else if ( CVariableFormat.OCTAL.equals( format ) ) { - // Using the instanceof operator here to avoid API change - // Add IAddress.toOctalAddressString() in a future CDT release - if (address instanceof Addr32) { - return ((Addr32)address).toOctalAddressString(); - } else if (address instanceof Addr64) { - return ((Addr64)address).toOctalAddressString(); - } else { - // Fall back to hexadecimal address format - return address.toHexAddressString(); - } - } else if ( CVariableFormat.BINARY.equals( format ) ) - return address.toBinaryAddressString(); - return null; - } - - private String getWCharValueString( ICDIWCharValue value ) throws CDIException { - if ( getParentVariable() instanceof CVariable ) { - int size = ((CVariable)getParentVariable()).sizeof(); - if ( size == 2 ) { - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) ) { - ByteBuffer buffer = ByteBuffer.allocate(4); - buffer.putInt(value.intValue()); - buffer.position(2); - String stringValue; - try { - stringValue = new String(CDebugUtils.getCharsetDecoder().decode(buffer).array()); - } catch (CharacterCodingException e) { - stringValue = e.toString(); - } - StringBuffer sb = new StringBuffer("'"); //$NON-NLS-1$ - sb.append(stringValue); - sb.append('\''); - return sb.toString(); - } - else if ( CVariableFormat.DECIMAL.equals( format ) ) { - return (isUnsigned()) ? Integer.toString( value.intValue() ) : Short.toString( value.shortValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = Integer.toHexString( (isUnsigned()) ? value.intValue() : value.shortValue() ); - sb.append( (stringValue.length() > 4) ? stringValue.substring( stringValue.length() - 4 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = Integer.toOctalString( (isUnsigned()) ? value.intValue() : value.shortValue() ); - stringValue = (stringValue.length() > 6) ? stringValue.substring( stringValue.length() - 6 ) : stringValue; - sb.append( (stringValue.length() == 6 && stringValue.charAt( 0 ) >= '2') ? (char)((stringValue.charAt( 0 ) - '0') % 2 + '0') + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = Integer.toBinaryString( (isUnsigned()) ? value.intValue() : value.shortValue() ); - sb.append( (stringValue.length() > 16) ? stringValue.substring( stringValue.length() - 16 ) : stringValue ); - return sb.toString(); - } - } - if ( size == 4 ) { - CVariableFormat format = getParentVariable().getFormat(); - if ( CVariableFormat.NATURAL.equals( format ) ) { - ByteBuffer buffer = ByteBuffer.allocate(8); - buffer.putLong(value.longValue()); - buffer.position(4); - String stringValue; - try { - stringValue = new String(CDebugUtils.getCharsetDecoder().decode(buffer).array()); - } catch (CharacterCodingException e) { - stringValue = e.toString(); - } - StringBuffer sb = new StringBuffer("'"); //$NON-NLS-1$ - sb.append(stringValue); - sb.append('\''); - return sb.toString(); - } - else if ( CVariableFormat.DECIMAL.equals( format ) ) { - return (isUnsigned()) ? Long.toString( value.longValue() ) : Integer.toString( value.intValue() ); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Long.toHexString( value.longValue() ) : Integer.toHexString( value.intValue() ); - sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Long.toOctalString( value.longValue() ) : Integer.toOctalString( value.intValue() ); - stringValue = (stringValue.length() > 11) ? stringValue.substring( stringValue.length() - 11 ) : stringValue; - sb.append( (stringValue.length() == 11 && stringValue.charAt( 0 ) >= '4') ? (char)(stringValue.charAt( 0 ) - 4) + stringValue.substring( 1 ) : stringValue ); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$ - String stringValue = (isUnsigned()) ? Long.toBinaryString( value.longValue() ) : Integer.toBinaryString( value.intValue() ); - sb.append( (stringValue.length() > 32) ? stringValue.substring( stringValue.length() - 32 ) : stringValue ); - return sb.toString(); - } - } - } - return value.getValueString(); - } - - private String getBigIntegerValueString( ICDIBigIntegerValue value ) throws CDIException { - try { - CVariableFormat format = getParentVariable().getFormat(); - - if (CVariableFormat.NATURAL.equals(format)) { - format = getNaturalFormat(value, CVariableFormat.DECIMAL); - } - - if ( CVariableFormat.DECIMAL.equals( format ) ) { - BigInteger bigValue = value.bigIntegerValue(); - return bigValue.toString(10); - } - else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { - StringBuffer sb = new StringBuffer("0x"); //$NON-NLS-1$ - sb.append(value.bigIntegerValue().toString(16)); - return sb.toString(); - } - else if ( CVariableFormat.OCTAL.equals( format ) ) { - StringBuffer sb = new StringBuffer("0"); //$NON-NLS-1$ - sb.append(value.bigIntegerValue().toString(8)); - return sb.toString(); - } - else if ( CVariableFormat.BINARY.equals( format ) ) { - StringBuffer sb = new StringBuffer("0b"); //$NON-NLS-1$ - sb.append(value.bigIntegerValue().toString(2)); - return sb.toString(); - } - } - catch( NumberFormatException e ) { - } - return null; - } - private boolean isUnsigned() { - boolean result = false; - try { - ICType type = getParentVariable().getType(); - if ( type != null ) - result = type.isUnsigned(); - } - catch( DebugException e ) { - } - return result; - } - - /** - * Invalidates the string cache. - */ - @Override - protected void reset() { - resetStatus(); - fValueString = null; - for (AbstractCVariable var : fVariables) { - var.resetValue(); - } - } - - @Override - public ICType getType() throws DebugException { - ICDIValue cdiValue = getUnderlyingValue(); - if ( fType == null ) { - if ( cdiValue != null ) { - synchronized( this ) { - if ( fType == null ) { - try { - fType = new CType( cdiValue.getType() ); - } - catch( CDIException e ) { - requestFailed( e.getMessage(), null ); - } - } - } - } - } - return fType; -// AbstractCVariable var = getParentVariable(); -// return ( var instanceof CVariable ) ? ((CVariable)var).getType() : null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#preserve() - */ - @Override - protected void preserve() { - setChanged( false ); - resetStatus(); - for (AbstractCVariable var : fVariables) { - var.preserve(); - } - } - - private static CVariableFormat getNaturalFormat(ICDIValue value, CVariableFormat defaultFormat) throws CDIException { - if (value instanceof ICDIFormattable) { - int naturalFormat = ((ICDIFormattable)value).getNaturalFormat(); - switch (naturalFormat) { - case ICDIFormat.DECIMAL: - return CVariableFormat.DECIMAL; - case ICDIFormat.BINARY: - return CVariableFormat.BINARY; - case ICDIFormat.OCTAL: - return CVariableFormat.OCTAL; - case ICDIFormat.HEXADECIMAL: - return CVariableFormat.HEXADECIMAL; - } - } - return defaultFormat; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValueFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValueFactory.java deleted file mode 100644 index 9db5e6efdbf..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValueFactory.java +++ /dev/null @@ -1,118 +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.internal.core.model; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue; -import org.eclipse.cdt.debug.core.model.CDebugElementState; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IVariable; - -/** - * The value factory for variable and expressions. - */ -public class CValueFactory { - - static public final ICValue NULL_VALUE = new ICValue() { - - @Override - public String getReferenceTypeName() throws DebugException { - return ""; //$NON-NLS-1$ - } - - @Override - public String getValueString() throws DebugException { - return ""; //$NON-NLS-1$ - } - - @Override - public boolean isAllocated() throws DebugException { - return true; - } - - @Override - public IVariable[] getVariables() throws DebugException { - return new IVariable[0]; - } - - @Override - public boolean hasVariables() throws DebugException { - return false; - } - - @Override - public String getModelIdentifier() { - return CDebugCorePlugin.getUniqueIdentifier(); - } - - @Override - public IDebugTarget getDebugTarget() { - return null; - } - - @Override - public ILaunch getLaunch() { - return null; - } - - @Override - public Object getAdapter( Class adapter ) { - return null; - } - - @Override - public ICType getType() throws DebugException { - return null; - } - - @Override - public String evaluateAsExpression( ICStackFrame frame ) { - return ""; //$NON-NLS-1$ - } - - @Override - public CDebugElementState getState() { - return CDebugElementState.UNDEFINED; - } - - @Override - public Object getCurrentStateInfo() { - return null; - } - - }; - - static public CValue createValue( CVariable parent, ICDIValue cdiValue ) { - if ( cdiValue instanceof ICDIFloatingPointValue ) { - return new CFloatingPointValue( parent, cdiValue ); - } - return new CValue( parent, cdiValue ); - } - - static public CIndexedValue createIndexedValue( AbstractCVariable parent, ICDIArrayValue cdiValue, int start, int length ) { - return new CIndexedValue( parent, cdiValue, start, length ); - } - - static public CValue createGlobalValue( CVariable parent, ICDIValue cdiValue ) { - return new CGlobalValue( parent, cdiValue ); - } - - static public ICValue createValueWithError( CVariable parent, String message ) { - return new CValue( parent, message ); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java deleted file mode 100644 index d905acaa68f..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java +++ /dev/null @@ -1,941 +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.internal.core.model; - -import com.ibm.icu.text.MessageFormat; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.ICWatchpointTarget; -import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; -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.event.ICDIMemoryChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -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.ICDITargetConfiguration2; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration3; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.model.CVariableFormat; -import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.internal.core.CSettingsManager; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IValue; - -/** - * A thin wrapper over the CVariable for injection into the CDI event manager's - * listener collection. We used to directly inject the CVariable, but that's - * problematic since CVariable overrides the equals() method to base the - * decision on the internal variable object. So if two CVariables were added to - * the listener list for the same underlying value, trying to later remove one - * of the listeners had a 50/50 chance of removing the wrong one. - * - * How can you end up with two CVariables for the same internal variable on the - * listener list? Easy. - * 1. View a register in the Registers view. - * 2. Create a custom register group that contains the same register. - * 3. Expand the custom register group - * 4. Remove the custom register group - * Step 4 removed the wrong CVariable from the listener list. - * - */ -class VariableEventListener implements ICDIEventListener { - private CVariable fVar; - public VariableEventListener(CVariable var) { - fVar = var; - } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents(ICDIEvent[] events) { - fVar.handleDebugEvents(events); - } -} - -/** - * Represents a variable in the CDI model. - */ -public abstract class CVariable extends AbstractCVariable implements ICDIEventListener, ICWatchpointTarget { - - interface IInternalVariable { - IInternalVariable createShadow( int start, int length ) throws DebugException; - IInternalVariable createShadow( String type ) throws DebugException; - CType getType() throws DebugException; - String getQualifiedName() throws DebugException; - ICValue getValue() throws DebugException; - void setValue( String expression ) throws DebugException; - boolean isChanged(); - void setChanged( boolean changed ); - void dispose( boolean destroy ); - boolean isSameDescriptor( ICDIVariableDescriptor desc ); - boolean isSameVariable( ICDIVariable cdiVar ); - void resetValue(); - boolean isEditable() throws DebugException; - boolean isArgument(); - int sizeof(); - void invalidateValue(); - void preserve(); - - // Note: the CDI object association can change; e.g., if a "Cast to Type" - // or "Display as Array" is done on the element. - ICDIObject getCdiObject(); - } - - /** - * Whether this variable is currently enabled. - */ - private boolean fIsEnabled = true; - - /** - * The original internal variable. - */ - private IInternalVariable fOriginal; - - /** - * The shadow internal variable used for casting. - */ - private IInternalVariable fShadow; - - /** - * The name of this variable. - */ - private String fName; - - /** - * The current format of this variable. - */ - private CVariableFormat fFormat = CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ); - - /** - * Whether this variable has been disposed. - */ - private boolean fIsDisposed = false; - - /** - * Thin wrapper for instertion into the CDI event manager's listener list - */ - private VariableEventListener fEventListenerWrapper; - - /** - * Constructor for CVariable. - */ - protected CVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject ) { - super( parent ); - fEventListenerWrapper = new VariableEventListener(this); - if ( cdiVariableObject != null ) { - setName( cdiVariableObject.getName() ); - createOriginal( cdiVariableObject ); - } - fIsEnabled = ( parent instanceof AbstractCValue ) ? ((AbstractCValue)parent).getParentVariable().isEnabled() : !isBookkeepingEnabled(); - getCDISession().getEventManager().addEventListener( fEventListenerWrapper ); - if ( cdiVariableObject != null ) { - setInitialFormat(); - } - } - - /** - * Constructor for CVariable. - */ - protected CVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject, String errorMessage ) { - super( parent ); - fEventListenerWrapper = new VariableEventListener(this); - if ( cdiVariableObject != null ) { - setName( cdiVariableObject.getName() ); - createOriginal( cdiVariableObject ); - } - fIsEnabled = !isBookkeepingEnabled(); - setStatus( ICDebugElementStatus.ERROR, MessageFormat.format( CoreModelMessages.getString( "CVariable.1" ), new String[]{ errorMessage } ) ); //$NON-NLS-1$ - getCDISession().getEventManager().addEventListener( fEventListenerWrapper ); - if ( cdiVariableObject != null ) { - setInitialFormat(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICVariable#getType() - */ - @Override - public ICType getType() throws DebugException { - if ( isDisposed() ) - return null; - IInternalVariable iv = getCurrentInternalVariable(); - return ( iv != null ) ? iv.getType() : null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICVariable#isEnabled() - */ - @Override - public boolean isEnabled() { - return fIsEnabled; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICVariable#setEnabled(boolean) - */ - @Override - public void setEnabled( boolean enabled ) throws DebugException { - // Debugger engines that use active variable objects will benefit - // performance-wise if we dispose the internal variable when it's - // disabled by the user (it will automatically get lazily recreated if - // it's ever needed again). Engines using passive variables probably - // won't, so we can defer the dispose until we have no use for the - // variable altogether. - boolean disposeVariable = true; - ICDITargetConfiguration configuration = getParent().getCDITarget().getConfiguration(); - if (configuration instanceof ICDITargetConfiguration2) { - disposeVariable = !((ICDITargetConfiguration2)configuration).supportsPassiveVariableUpdate(); - } - if (disposeVariable) { - IInternalVariable iv = getOriginal(); - if ( iv != null ) - iv.dispose( true ); - iv = getShadow(); - if ( iv != null ) - iv.dispose( true ); - } - fIsEnabled = enabled; - fireChangeEvent( DebugEvent.STATE ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICVariable#canEnableDisable() - */ - @Override - public boolean canEnableDisable() { - return !( getParent() instanceof IValue ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICVariable#isArgument() - */ - @Override - public boolean isArgument() { - IInternalVariable iv = getOriginal(); - return ( iv != null ) ? iv.isArgument() : false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IVariable#getValue() - */ - @Override - public IValue getValue() throws DebugException { - if ( !isDisposed() && isEnabled() ) { - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) { - try { - return iv.getValue(); - } - catch( DebugException e ) { - setStatus( ICDebugElementStatus.ERROR, e.getMessage() ); - } - } - } - return CValueFactory.NULL_VALUE; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IVariable#getName() - */ - @Override - public String getName() throws DebugException { - return fName; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() - */ - @Override - public String getReferenceTypeName() throws DebugException { - ICType type = getType(); - return ( type != null ) ? type.getName() : ""; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() - */ - @Override - public boolean hasValueChanged() throws DebugException { - if ( isDisposed() ) - return false; - IInternalVariable iv = getCurrentInternalVariable(); - return ( iv != null ) ? iv.isChanged() : false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.IFormatSupport#supportsFormatting() - */ - @Override - public boolean supportsFormatting() { - return true; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.IFormatSupport#getFormat() - */ - @Override - public CVariableFormat getFormat() { - return fFormat; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.IFormatSupport#changeFormat(org.eclipse.cdt.debug.core.model.CVariableFormat) - */ - @Override - public void changeFormat( CVariableFormat format ) throws DebugException { - setFormat( format ); - storeFormat( format ); - resetValue(); - } - - /* - * (non-Javadoc) - * Allow this operation only for the pointer types (???). - * - * @see org.eclipse.cdt.debug.core.model.ICastToArray#canCastToArray() - */ - @Override - public boolean canCastToArray() { - ICType type; - try { - type = getType(); - return ( getOriginal() != null && isEnabled() && type != null && type.isPointer() ); - } - catch( DebugException e ) { - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICastToArray#castToArray(int, int) - */ - @Override - public void castToArray( int startIndex, int length ) throws DebugException { - IInternalVariable current = getCurrentInternalVariable(); - if ( current != null ) { - IInternalVariable newVar = current.createShadow( startIndex, length ); - if ( getShadow() != null ) - getShadow().dispose( true ); - setShadow( newVar ); - // If casting of variable to a type or array causes an error, the status - // of the variable is set to "error" and it can't be reset by subsequent castings. - resetValue(); - storeCastToArray( startIndex, length ); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String) - */ - @Override - public void setValue( String expression ) throws DebugException { - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) { - String newExpression = processExpression( expression ); - iv.setValue( newExpression ); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) - */ - @Override - public void setValue( IValue value ) throws DebugException { - notSupported( CoreModelMessages.getString( "CVariable.3" ) ); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification() - */ - @Override - public boolean supportsValueModification() { - try { - return fIsEnabled ? getCurrentInternalVariable().isEditable() : false; - } - catch( DebugException e ) { - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String) - */ - @Override - public boolean verifyValue( String expression ) throws DebugException { - return true; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue) - */ - @Override - public boolean verifyValue( IValue value ) throws DebugException { - return value.getDebugTarget().equals( getDebugTarget() ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICastToType#canCast() - */ - @Override - public boolean canCast() { - return ( getOriginal() != null && isEnabled() ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICastToType#getCurrentType() - */ - @Override - public String getCurrentType() { - String typeName = ""; //$NON-NLS-1$ - try { - typeName = getReferenceTypeName(); - } - catch( DebugException e ) { - } - return typeName; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICastToType#cast(java.lang.String) - */ - @Override - public void cast( String type ) throws DebugException { - IInternalVariable current = getCurrentInternalVariable(); - if ( current != null ) { - IInternalVariable newVar = current.createShadow( type ); - if ( getShadow() != null ) - getShadow().dispose( true ); - setShadow( newVar ); - // If casting of variable to a type or array causes an error, the status - // of the variable is set to "error" and it can't be reset by subsequent castings. - resetValue(); - storeCast(type); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICastToType#restoreOriginal() - */ - @Override - public void restoreOriginal() throws DebugException { - IInternalVariable oldVar = getShadow(); - setShadow( null ); - if ( oldVar != null ) - oldVar.dispose( true ); - IInternalVariable iv = getOriginal(); - if ( iv != null ) - iv.invalidateValue(); - // If casting of variable to a type or array causes an error, the status - // of the variable is set to "error" and it can't be reset by subsequent castings. - resetValue(); - forgetCast(); - forgetCastToArray(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.ICastToType#isCasted() - */ - @Override - public boolean isCasted() { - return ( getShadow() != null ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv == null ) - return; - for( int i = 0; i < events.length; i++ ) { - ICDIEvent event = events[i]; - ICDIObject source = event.getSource(); - if ( source == null ) - continue; - ICDITarget target = source.getTarget(); - if ( target.equals( getCDITarget() ) ) { - if ( event instanceof ICDIMemoryChangedEvent && - target.getConfiguration() instanceof ICDITargetConfiguration3 && - ((ICDITargetConfiguration3)target.getConfiguration()).needsVariablesUpdated(event)) { - resetValue(); - } - else if ( event instanceof ICDIChangedEvent ) { - if ( source instanceof ICDIVariable && iv.isSameVariable( (ICDIVariable)source ) ) { - handleChangedEvent( (ICDIChangedEvent)event ); - } - } - else if ( event instanceof ICDIResumedEvent ) { - handleResumedEvent( (ICDIResumedEvent)event ); - } - else if (event instanceof ICDIDestroyedEvent - && iv.getCdiObject() == source) { - dispose(); - fireChangeEvent(DebugEvent.STATE); - } - } - } - } - - private void handleResumedEvent( ICDIResumedEvent event ) { - boolean changed = false; - if ( hasErrors() ) { - resetStatus(); - changed = true; - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) - iv.invalidateValue(); - } - if ( changed ) - fireChangeEvent( DebugEvent.STATE ); - } - - private void handleChangedEvent( ICDIChangedEvent event ) { - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) { - iv.setChanged( true ); - fireChangeEvent( DebugEvent.STATE ); - } - } - - private IInternalVariable getCurrentInternalVariable() { - if ( getShadow() != null ) - return getShadow(); - return getOriginal(); - } - - private IInternalVariable getOriginal() { - return fOriginal; - } - - protected void setOriginal( IInternalVariable original ) { - fOriginal = original; - } - - private IInternalVariable getShadow() { - return fShadow; - } - - private void setShadow( IInternalVariable shadow ) { - fShadow = shadow; - } - - protected boolean isBookkeepingEnabled() { - boolean result = false; - try { - result = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false ); - } - catch( CoreException e ) { - } - return result; - } - - abstract protected void createOriginal( ICDIVariableDescriptor vo ); - - protected boolean hasErrors() { - return !isOK(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#setChanged(boolean) - */ - @Override - protected void setChanged( boolean changed ) { - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) { - iv.setChanged( changed ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#resetValue() - */ - @Override - protected void resetValue() { - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) { - resetStatus(); - iv.resetValue(); - fireChangeEvent( DebugEvent.STATE ); - } - } - - private String processExpression( String oldExpression ) { - return oldExpression; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#dispose() - */ - @Override - public void dispose() { - // Hack: do not destroy local variables - internalDispose( false ); - setDisposed( true ); - } - - public int sizeof() { - IInternalVariable iv = getCurrentInternalVariable(); - return ( iv != null ) ? iv.sizeof() : -1; - } - - /** - * Compares the original internal variables. - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals( Object obj ) { - if ( obj instanceof CVariable ) { - // A disposed copy can be stored in the viewer. - // false should be returned to force the viewer to - // replace it by a new variable. See bug #115385 - if ( isDisposed() != ((CVariable)obj).isDisposed() ) - return false; - IInternalVariable iv = getOriginal(); - return ( iv != null ) ? iv.equals( ((CVariable)obj).getOriginal() ) : false; - } - return false; - } - - protected boolean sameVariable( ICDIVariableDescriptor vo ) { - IInternalVariable iv = getOriginal(); - return ( iv != null && iv.isSameDescriptor( vo ) ); - } - - protected void setFormat( CVariableFormat format ) { - fFormat = format; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICVariable#getExpressionString() - */ - @Override - public String getExpressionString() throws DebugException { - IInternalVariable iv = getCurrentInternalVariable(); - return ( iv != null ) ? iv.getQualifiedName() : null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#preserve() - */ - @Override - protected void preserve() { - resetStatus(); - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) - iv.preserve(); - } - - protected void internalDispose( boolean destroy ) { - getCDISession().getEventManager().removeEventListener( fEventListenerWrapper ); - IInternalVariable iv = getOriginal(); - if ( iv != null ) - iv.dispose( destroy ); - iv = getShadow(); - if ( iv != null ) - iv.dispose( destroy ); - } - - protected boolean isDisposed() { - return fIsDisposed; - } - - protected void setDisposed( boolean isDisposed ) { - fIsDisposed = isDisposed; - } - - protected void invalidateValue() { - resetStatus(); - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) - iv.invalidateValue(); - } - - protected void setName( String name ) { - fName = name; - } - - public ICDIObject getCdiObject() { - IInternalVariable iv = getCurrentInternalVariable(); - if ( iv != null ) { - return iv.getCdiObject(); - } - return null; - } - - protected CSettingsManager getFormatManager() { - return ((CDebugTarget) getDebugTarget()).getFormatManager(); - } - - /** - * used to concatenate multiple names to a single identifier - */ - private final static String NAME_PART_SEPARATOR = "-"; //$NON-NLS-1$ - - /** - * suffix used to identify format informations - */ - private final static String FORMAT_SUFFIX = NAME_PART_SEPARATOR + "(format)"; //$NON-NLS-1$ - - /** - * suffix used to identify cast settings - */ - private final static String CAST_SUFFIX = NAME_PART_SEPARATOR + "(cast)"; //$NON-NLS-1$ - - /** - * suffix used to identify cast to array settings - */ - private final static String CAST_TO_ARRAY_SUFFIX = NAME_PART_SEPARATOR + "(cast_to_array)"; //$NON-NLS-1$ - - /** retrieve the identification for this variable. - * @return a string identifying this variable, to be used to store settings - * @throws DebugException - */ - String getVariableID() throws DebugException { - return getName(); // TODO: better identification if multiple variables have the same name - } - - /** helper to generate a string id used to persist the settings. - * @param next_obj next object to encode into the id - * @param buf contains the id of the part encoded so far. - * @throws DebugException - */ - static private void buildPesistID( CDebugElement next_obj, StringBuffer buf ) throws DebugException { - if ( next_obj instanceof CVariable ) { - CVariable cVariableParent = (CVariable) next_obj; - buf.append( NAME_PART_SEPARATOR ); - buf.append( cVariableParent.getVariableID() ); - buildPesistID( cVariableParent.getParent(), buf ); - } else if ( next_obj instanceof CStackFrame ) { - buf.append(NAME_PART_SEPARATOR); - // TODO: better identification if multiple functions have the same name (say for static functions) - buf.append( ((CStackFrame)next_obj ).getFunction() ); - } else if ( next_obj instanceof CDebugTarget ) { - // global, we use a root NAME_PART_SEPARATOR as indicator of that - buf.append( NAME_PART_SEPARATOR ); - } else if ( next_obj instanceof AbstractCValue ) { - // index or indirection. - AbstractCValue av = (AbstractCValue) next_obj; - buildPesistID( av.getParentVariable(), buf ); - } - } - - /** returns an string used to identify this variable - * @return - * @throws DebugException - */ - private final String getPersistID() throws DebugException { - StringBuffer id = new StringBuffer(); - id.append( getVariableID() ); - buildPesistID( getParent(), id ); - return id.toString(); - } - - /** stores the given format - * @param format the format to be used for this variable - */ - protected void storeFormat( CVariableFormat format ) { - try { - String formatString = Integer.toString( format.getFormatNumber() ); - - getFormatManager().putValue( getPersistID() + FORMAT_SUFFIX, formatString ); - } catch ( DebugException e ) { - // if we do not get the name, we use the default format, no reason for the creation to fail too. - DebugPlugin.log( e ); - } - } - - /** stores the cast information. - * @param type the type to be displayed instead - */ - protected void storeCast( String type ) { - try { - String id = getPersistID() + CAST_SUFFIX; - getFormatManager().putValue( id, type ); - } catch ( DebugException e ) { - DebugPlugin.log( e ); - } - } - - /** drops the cast information. - */ - protected void forgetCast() { - try { - String id = getPersistID() + CAST_SUFFIX; - getFormatManager().removeValue( id ); - } catch ( DebugException e ) { - DebugPlugin.log( e ); - } - } - - /** stores the cast array information. - * @param startIndex the first item to be displayed in the cast array operation - * @param length the number of elements to display - */ - protected void storeCastToArray(int startIndex, int length) { - try { - // we persist the information in a (startIndex):(Length) format. - String content = Integer.toString( startIndex ) + ":" + Integer.toString( length ); //$NON-NLS-1$ - getFormatManager().putValue( getPersistID() + CAST_TO_ARRAY_SUFFIX, content ); - } catch ( DebugException e ) { - DebugPlugin.log( e ); - } - } - - /** drops previously stored cast array information. - */ - protected void forgetCastToArray() { - try { - String id = getPersistID() + CAST_TO_ARRAY_SUFFIX; - getFormatManager().removeValue( id ); - } catch ( DebugException e ) { - DebugPlugin.log( e ); - } - } - - /** - * restore the format stored previously for this variable. - * Only sets explicitly retrieved formats in order to maintain defaults. - */ - protected void setInitialFormat() { - try { - String persistID= getPersistID(); - String stringFormat = getFormatManager().getValue( persistID + FORMAT_SUFFIX ); - if ( stringFormat != null ) { - try { - CVariableFormat format = CVariableFormat.getFormat( Integer.parseInt( stringFormat ) ); - setFormat( format ); - } catch ( NumberFormatException e ) { - DebugPlugin.log( e ); - } - } - - if ( canCast() ) { - String castString = getFormatManager().getValue( persistID + CAST_SUFFIX ); - if ( castString != null ) { - cast( castString ); - } - } - if ( canCastToArray() ) { - String castToArrayString = getFormatManager().getValue( persistID + CAST_TO_ARRAY_SUFFIX ); - if (castToArrayString != null) { - int index = castToArrayString.indexOf( ':' ); - if ( index > 0 ) { - try { - int beg = Integer.parseInt( castToArrayString.substring( 0, index ) ); - int num = Integer.parseInt( castToArrayString.substring( index + 1 ) ); - castToArray( beg, num ); - } catch ( NumberFormatException e ) { - DebugPlugin.log( e ); - } - } else { - DebugPlugin.logMessage( "did not find expected : for cast to array", null ); //$NON-NLS-1$ - } - } - } - } catch ( DebugException e ) { - DebugPlugin.log( e ); - // we drop (and log) the exception here. - // even if the initial setup fails, we still want the complete creation to be successful - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#getExpression() - */ - @Override - public String getExpression() { - try { - return getExpressionString(); - } catch (DebugException e) { - return ""; //$NON-NLS-1$ - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#getSize() - */ - @Override - public void getSize(ICWatchpointTarget.GetSizeRequest request) { - // CDI has synchronous APIs, so this is easy... - request.setSize(sizeof()); - request.done(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#canCreateWatchpoint(org.eclipse.cdt.debug.internal.core.IWatchpointTarget.CanCreateWatchpointRequest) - */ - @Override - public void canSetWatchpoint(ICWatchpointTarget.CanCreateWatchpointRequest request) { - // CDI has synchronous APIs, so this is easy... - request.setCanCreate(sizeof() > 0); - request.done(); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java deleted file mode 100644 index 1dd3f640f7b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java +++ /dev/null @@ -1,84 +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.internal.core.model; - -import com.ibm.icu.text.MessageFormat; - -import org.eclipse.cdt.core.IBinaryParser.ISymbol; -import org.eclipse.cdt.core.model.IBinaryModule; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * Provides factory methods for the variable types. - */ -public class CVariableFactory { - - public static CLocalVariable createLocalVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject ) { - return new CLocalVariable( parent, cdiVariableObject ); - } - - public static CLocalVariable createLocalVariableWithError( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject, String message ) { - return new CLocalVariable( parent, cdiVariableObject, message ); - } - - public static IGlobalVariableDescriptor createGlobalVariableDescriptor( final String name, final IPath path ) { - - return new IGlobalVariableDescriptor() { - - @Override - public String getName() { - return name; - } - - @Override - public IPath getPath() { - return ( path != null ) ? path : new Path( "" ); //$NON-NLS-1$ - } - - @Override - public String toString() { - return MessageFormat.format( "{0}::{1}", new String[] { getPath().toOSString(), getName() } ); //$NON-NLS-1$ - } - - @Override - public boolean equals( Object obj ) { - if ( !(obj instanceof IGlobalVariableDescriptor) ) - return false; - IGlobalVariableDescriptor d = (IGlobalVariableDescriptor)obj; - return ( getName().compareTo( d.getName() ) == 0 && getPath().equals( d.getPath() ) ); - } - }; - } - - public static IGlobalVariableDescriptor createGlobalVariableDescriptor( final org.eclipse.cdt.core.model.IVariable var ) { - IPath path = new Path( "" ); //$NON-NLS-1$ - ICElement parent = var.getParent(); - if ( parent instanceof IBinaryModule ) { - path = ((IBinaryModule)parent).getPath(); - } - return createGlobalVariableDescriptor( var.getElementName(), path ); - } - - public static IGlobalVariableDescriptor createGlobalVariableDescriptor( ISymbol symbol ) { - return createGlobalVariableDescriptor( symbol.getName(), symbol.getFilename() ); - } - - /** - * @param descriptor can be null if creating a child for a global - */ - public static CGlobalVariable createGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableDescriptor cdiVariableObject ) { - return new CGlobalVariable( parent, descriptor, cdiVariableObject ); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java deleted file mode 100644 index 58b571f6482..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * oyvind.harboe@zylin.com - http://bugs.eclipse.org/250638 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.math.BigInteger; -import java.util.ArrayList; -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -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.event.ICDIMemoryChangedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; -import org.eclipse.cdt.debug.core.model.IExecFileInfo; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; - -/** - * CDI implementation of IDisassembly - */ -public class Disassembly extends CDebugElement implements IDisassembly, ICDIEventListener { - - final static private int DISASSEMBLY_BLOCK_SIZE = 100; - - private DisassemblyBlock[] fBlocks = new DisassemblyBlock[1]; - - /** - * Constructor for Disassembly. - * - * @param target - */ - public Disassembly( CDebugTarget target ) { - super( target ); - getCDISession().getEventManager().addEventListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassembly#getDisassemblyBlock(org.eclipse.cdt.debug.core.model.ICStackFrame) - */ - @Override - public IDisassemblyBlock getDisassemblyBlock( ICStackFrame frame ) throws DebugException { - if ( fBlocks[0] == null || !fBlocks[0].contains( frame ) ) { - fBlocks[0] = createBlock( frame ); - } - return fBlocks[0]; - } - - private DisassemblyBlock createBlock( ICStackFrame frame ) throws DebugException { - ICDITarget target = getDebugTarget().getAdapter( ICDITarget.class ); - if ( target != null ) { - String fileName = frame.getFile(); - int lineNumber = frame.getLineNumber(); - ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0]; - IAddress address = frame.getAddress(); - if (address==null) - return null; - if ( fileName != null && fileName.length() > 0 ) { - try { - mixedInstrs = target.getMixedInstructions( fileName, - lineNumber, - CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) ); - } - catch( CDIException e ) { - // ignore and try to get disassembly without source - } - } - // Double check if debugger returns correct address range. - if ( mixedInstrs.length == 0 || - !containsAddress( mixedInstrs, address ) ) { - try { - BigInteger addr = new BigInteger( address.toString() ); - ICDIInstruction[] instructions = getFunctionInstructions( target.getInstructions( addr, addr.add( BigInteger.valueOf( DISASSEMBLY_BLOCK_SIZE ) ) ) ); - return DisassemblyBlock.create( this, instructions ); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), e ); - } - } - else { - return DisassemblyBlock.create( this, mixedInstrs ); - } - } - return null; - } - - @Override - public IDisassemblyBlock getDisassemblyBlock( IAddress address ) throws DebugException { - fBlocks[0] = createBlock( address, null); - return fBlocks[0]; - } - - public IDisassemblyBlock getDisassemblyBlock( IAddress startAddress, IAddress endAddress ) throws DebugException { - fBlocks[0] = createBlock( startAddress, endAddress ); - return fBlocks[0]; - } - - private DisassemblyBlock createBlock( IAddress startAddress, IAddress endAddress) throws DebugException { - ICDITarget target = getDebugTarget().getAdapter( ICDITarget.class ); - if ( target != null ) { - ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0]; - if ( mixedInstrs.length == 0 || - !containsAddress( mixedInstrs, startAddress ) ) { - try { - BigInteger startAddr = new BigInteger( startAddress.toString() ); - BigInteger endAddr = null; - if (endAddress != null) { - endAddr = new BigInteger( endAddress.toString() ); - } else { - endAddr = startAddr.add( BigInteger.valueOf( - CDebugCorePlugin.getDefault().getPluginPreferences().getInt(ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS))); - } - mixedInstrs = target.getMixedInstructions( startAddr, endAddr); - return DisassemblyBlock.create( this, mixedInstrs ); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), e ); - } - } - else { - return DisassemblyBlock.create( this, mixedInstrs ); - } - } - return null; - } - - - private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) { - for( int i = 0; i < mi.length; ++i ) { - ICDIInstruction[] instructions = mi[i].getInstructions(); - for ( int j = 0; j < instructions.length; ++j ) { - if ( address.getValue().equals( instructions[j].getAdress() ) ) - return true; - } - } - return false; - } - - private ICDIInstruction[] getFunctionInstructions( ICDIInstruction[] rawInstructions ) { - if ( rawInstructions.length > 0 && rawInstructions[0].getFuntionName() != null && rawInstructions[0].getFuntionName().length() > 0 ) { - ArrayList list = new ArrayList( rawInstructions.length ); - list.add( rawInstructions[0] ); - for( int i = 1; i < rawInstructions.length; ++i ) { - if ( rawInstructions[0].getFuntionName().equals( rawInstructions[i].getFuntionName() ) ) { - list.add( rawInstructions[i] ); - } - } - return (ICDIInstruction[])list.toArray( new ICDIInstruction[list.size()] ); - } - return rawInstructions; - } - - public void dispose() { - getCDISession().getEventManager().removeEventListener( this ); - CDebugCorePlugin.getDefault().getDisassemblyContextService().unregister( this ); - for ( int i = 0; i < fBlocks.length; ++i ) - if ( fBlocks[i] != null ) { - fBlocks[i].dispose(); - fBlocks[i] = null; - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - if ( IExecFileInfo.class.equals( adapter ) ) - return getDebugTarget().getAdapter( adapter ); - return super.getAdapter( adapter ); - } - - public void reset() { - for ( int i = 0; i < fBlocks.length; ++i ) - if ( fBlocks[i] != null ) { - fBlocks[i].dispose(); - fBlocks[i] = null; - } - fireChangeEvent( DebugEvent.CONTENT ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassembly#getAddressFactory() - */ - @Override - public IAddressFactory getAddressFactory() { - return ((CDebugTarget)getDebugTarget()).getAddressFactory(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - boolean update = false; - for ( int i = 0; i < events.length; ++i ) { - if ( events[i] instanceof ICDIMemoryChangedEvent ) { - BigInteger[] addresses = ((ICDIMemoryChangedEvent)events[i]).getAddresses(); - for ( int j = 0; j < addresses.length; ++j ) { - IAddress address = getAddressFactory().createAddress( addresses[j] ); - for ( int k = 0; k < fBlocks.length; ++k ) { - if ( fBlocks[k] != null && fBlocks[k].contains( address ) ) { - update = true; - break; - } - } - } - } - } - if ( update ) - reset(); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java deleted file mode 100644 index f5a09f7417d..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Mike Caraman (Frescale) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=210863 - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.model; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.LineNumberReader; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; -import org.eclipse.cdt.debug.core.model.IAsmInstruction; -import org.eclipse.cdt.debug.core.model.IAsmSourceLine; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; -import org.eclipse.cdt.debug.core.model.IExecFileInfo; -import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; - -/** - * CDI-based implementation of <code>IDisassemblyBlock</code>. - */ -public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable { - - private IDisassembly fDisassembly; - - private Object fSourceElement; - - private IAsmSourceLine[] fSourceLines; - - private IAddress fStartAddress = null; - - private IAddress fEndAddress = null; - - private boolean fMixedMode = false; - - /** - * Constructor for DisassemblyBlock. - */ - private DisassemblyBlock( IDisassembly disassembly ) { - fDisassembly = disassembly; - } - - public static DisassemblyBlock create( IDisassembly disassembly, ICDIMixedInstruction[] instructions ) { - DisassemblyBlock block = new DisassemblyBlock( disassembly ); - ISourceLocator locator = disassembly.getDebugTarget().getLaunch().getSourceLocator(); - IAddressFactory factory = ((CDebugTarget)disassembly.getDebugTarget()).getAddressFactory(); - block.initialize( factory, locator, instructions ); - return block; - } - - public static DisassemblyBlock create( IDisassembly disassembly, ICDIInstruction[] instructions ) { - DisassemblyBlock block = new DisassemblyBlock( disassembly ); - IAddressFactory factory = ((CDebugTarget)disassembly.getDebugTarget()).getAddressFactory(); - block.initialize( factory, instructions ); - return block; - } - - private void initialize( IAddressFactory factory, ICDIInstruction[] instructions ) { - setMixedMode( false ); - createSourceLines( factory, instructions ); - initializeAddresses(); - } - - private void initialize( IAddressFactory factory, ISourceLocator locator, ICDIMixedInstruction[] mi ) { - setMixedMode( true ); - createSourceLines( factory, locator, mi ); - initializeAddresses(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getDisassembly() - */ - @Override - public IDisassembly getDisassembly() { - return fDisassembly; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getModuleFile() - */ - @Override - public String getModuleFile() { - IDisassembly d = getDisassembly(); - if ( d != null ) { - IExecFileInfo info = d.getAdapter( IExecFileInfo.class ); - if ( info != null && info.getExecFile() != null ) { - return info.getExecFile().getPath().toOSString(); - } - } - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getSourceElement() - */ - @Override - public Object getSourceElement() { - return fSourceElement; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#contains(org.eclipse.cdt.debug.core.model.ICStackFrame) - */ - @Override - public boolean contains( ICStackFrame frame ) { - if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) ) - return false; - if ( fStartAddress == null || fEndAddress == null ) - return false; - IAddress address = frame.getAddress(); // will return null if frame was disposed - return (address != null && address.compareTo( fStartAddress ) >= 0 && address.compareTo( fEndAddress ) <= 0); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getSourceLines() - */ - @Override - public IAsmSourceLine[] getSourceLines() { - return fSourceLines; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#isMixedMode() - */ - @Override - public boolean isMixedMode() { - return fMixedMode; - } - - public void dispose() { - } - - private void createSourceLines( IAddressFactory factory, ISourceLocator locator, ICDIMixedInstruction[] mi ) { - IAsmSourceLine[] result = new IAsmSourceLine[mi.length]; - LineNumberReader reader = null; - if ( result.length > 0 && locator != null ) { - String fileName = mi[0].getFileName(); - Object element = null; - if ( locator instanceof ISourceLookupDirector ) { - element = ((ISourceLookupDirector)locator).getSourceElement( fileName ); - } - if ( locator instanceof ICSourceLocator ) { - element = ((ICSourceLocator)locator).findSourceElement( fileName ); - } - fSourceElement = element; - File file = null; - if ( element instanceof IFile ) { - file = ((IFile)element).getLocation().toFile(); - } - else if ( element instanceof ITranslationUnit ) { - file = ((ITranslationUnit)element).getLocation().toFile(); - } - else if ( element instanceof IStorage ) { - file = ((IStorage)element).getFullPath().toFile(); - } - if ( file != null ) { - try { - reader = new LineNumberReader( new FileReader( file ) ); - } - catch( FileNotFoundException e ) { - } - } - } - for ( int i = 0; i < result.length; ++i ) { - String text = null; - boolean failed = false; - int lineNumber = mi[i].getLineNumber(); - if ( reader != null ) { - while( reader.getLineNumber() + 1 < lineNumber ) { - try { - if ( reader.readLine() == null ) { - // break if the end of file is reached (see bug #123745) - failed = true; - break; - } - } - catch( IOException e ) { - } - } - if ( !failed && reader.getLineNumber() + 1 == lineNumber ) { - try { - text = reader.readLine() + '\n'; - } - catch( IOException e ) { - } - } - } - result[i] = new AsmSourceLine( factory, text, lineNumber, mi[i].getInstructions() ); - } - fSourceLines = result; - } - - private void createSourceLines( IAddressFactory factory, ICDIInstruction[] instructions ) { - fSourceLines = new IAsmSourceLine[] { new AsmSourceLine( factory, "", instructions ) }; //$NON-NLS-1$ - } - - private void initializeAddresses() { - for ( int i = 0; i < fSourceLines.length; ++i ) { - IAsmInstruction[] instr = fSourceLines[i].getInstructions(); - if ( instr.length > 0 ) { - if ( fStartAddress == null ) - fStartAddress = instr[0].getAdress(); - fEndAddress = instr[instr.length - 1].getAdress(); - } - } - } - - private void setMixedMode( boolean mixedMode ) { - this.fMixedMode = mixedMode; - } - - protected boolean contains( IAddress address ) { - return ( address.compareTo( fStartAddress ) >= 0 && address.compareTo( fEndAddress ) <= 0 ); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyInstruction.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyInstruction.java deleted file mode 100644 index 982af00a252..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyInstruction.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.core.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction; - -public class DisassemblyInstruction extends CDebugElement implements IDisassemblyInstruction { - - private ICDIInstruction fCDIInstruction; - private IAddress fAddress; - - public DisassemblyInstruction( CDebugTarget target, BigInteger baseElement, ICDIInstruction instruction ) { - super( target ); - fCDIInstruction = instruction; - fAddress = target.getAddressFactory().createAddress( fCDIInstruction.getAdress() ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress() - */ - @Override - public IAddress getAdress() { - return fAddress; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getArguments() - */ - @Override - public String getArguments() { - return fCDIInstruction.getArgs(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getFunctionName() - */ - @Override - public String getFunctionName() { - return fCDIInstruction.getFuntionName(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getInstructionText() - */ - @Override - public String getInstructionText() { - return fCDIInstruction.getInstruction(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getOffset() - */ - @Override - public long getOffset() { - return fCDIInstruction.getOffset(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getOpcode() - */ - @Override - public String getOpcode() { - return fCDIInstruction.getOpcode(); - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals( Object obj ) { - if ( obj == this ) - return true; - if ( !(obj instanceof IDisassemblyInstruction) ) - return false; - IDisassemblyInstruction instr = (IDisassemblyInstruction)obj; - if ( !instr.getAdress().equals( getAdress() ) ) - return false; - if ( instr.getOffset() != getOffset() ) - return false; - if ( instr.getFunctionName().compareTo( getFunctionName() ) != 0 ) - return false; - if ( instr.getOpcode().compareTo( getOpcode() ) != 0 ) - return false; - if ( instr.getArguments().compareTo( getArguments() ) != 0 ) - return false; - if ( instr.getInstructionText().compareTo( getInstructionText() ) != 0 ) - return false; - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyRetrieval.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyRetrieval.java deleted file mode 100644 index 16d4411a896..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyRetrieval.java +++ /dev/null @@ -1,327 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2015 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.core.model; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.event.ICDIBreakpointMovedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIBreakpointProblemEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; -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.ICDIInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction; -import org.eclipse.cdt.debug.core.model.IDisassemblyLine; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; - -public class DisassemblyRetrieval extends CDebugElement implements ICDIEventListener { - - public static final int FLAGS_SHOW_INSTRUCTIONS = 0x1; - public static final int FLAGS_SHOW_SOURCE = 0x2; - - private Object fInput = null; - private BigInteger fBaseElement = null; - private int fCurrentOffset = 0; - private int fFlags = 0; - private IDisassemblyLine[] fLines; - - public DisassemblyRetrieval( CDebugTarget target ) { - super( target ); - fLines = new IDisassemblyLine[0]; - CDebugCorePlugin.getDefault().getDisassemblyContextService().register( this ); - getCDISession().getEventManager().addEventListener( this ); - } - - public void dispose() { - getCDISession().getEventManager().removeEventListener( this ); - CDebugCorePlugin.getDefault().getDisassemblyContextService().unregister( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - @Override - public void handleDebugEvents( ICDIEvent[] events ) { - for ( ICDIEvent event : events ) { - Object source = event.getSource(); - if ( (event instanceof ICDICreatedEvent - || event instanceof ICDIChangedEvent - || event instanceof ICDIDestroyedEvent - || event instanceof ICDIBreakpointMovedEvent - || event instanceof ICDIBreakpointProblemEvent ) - && source instanceof ICDILocationBreakpoint ) { - BigInteger address = ((ICDILocationBreakpoint)source).getLocator().getAddress(); - if ( address != null ) { - int index = getIndexForAddress( address, fLines ); - if ( index >= 0 ) { - fireEvent( new DebugEvent( fLines[index], DebugEvent.CHANGE, DebugEvent.STATE ) ); - } - if ( event instanceof ICDIBreakpointMovedEvent ) { - address = ((ICDIBreakpointMovedEvent)event).getNewLocation().getAddress(); - if ( address != null ) { - index = getIndexForAddress( address, fLines ); - if ( index >= 0 ) { - fireEvent( new DebugEvent( fLines[index], DebugEvent.CHANGE, DebugEvent.STATE ) ); - } - } - } - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassemblyRetrieval#getInput() - */ - public Object getInput() { - return fInput; - } - - public BigInteger getBaseElement() { - return fBaseElement; - } - - public int getCurrentOffset() { - return fCurrentOffset; - } - - public IDisassemblyLine[] getLines() { - return fLines; - } - - public void changeBase( Object input, int offset, int flags ) throws DebugException { - if ( input instanceof ICStackFrame ) { - fInput = input; - ICStackFrame frame = (ICStackFrame)input; - IAddress frameAddress = frame.getAddress(); - BigInteger address = (frameAddress != null) ? frameAddress.getValue() : BigInteger.valueOf(0); - if ( !containsAddress( address, fLines ) ) { - fCurrentOffset = 0; - reset(); - } - else if ( flags != fFlags ) { - reset(); - } - else { - fCurrentOffset += getDistance( fBaseElement, address ); - } - fFlags = flags; - fBaseElement = address; - } - } - - public void retrieveDisassembly( Object input, Object base, int offset, int lineCount, boolean reveal, int flags ) throws DebugException { - fFlags = flags; - boolean showSource = ( (flags & FLAGS_SHOW_SOURCE) != 0 ); - List<IDisassemblyLine> lines = new ArrayList<IDisassemblyLine>( lineCount ); - BigInteger startAddress = getCurrentStartAddress(); - BigInteger address = null; - if ( startAddress != null ) { - if ( getCurrentOffset() > offset ) { - // scrolling up - address = startAddress.subtract( BigInteger.valueOf( getMinInstructionSize() * (getCurrentOffset() - offset) ) ); - } - else if ( getCurrentOffset() < offset ) { - // scrolling down - IDisassemblyInstruction next = getNextInstruction( startAddress, fLines ); - if ( next != null ) - address = next.getAdress().getValue(); - } - else { - address = startAddress; - } - } - if ( address == null ) - address = fBaseElement; - lines.addAll( Arrays.asList( disassembleDown( address, lineCount, showSource ) ) ); - fLines = lines.toArray( new IDisassemblyLine[lines.size()] ); - fCurrentOffset = offset; - } - - private boolean containsAddress( BigInteger address, IDisassemblyLine[] lines ) { - return ( getIndexForAddress( address, lines ) >= 0 ); - } - - public void reset() { - fLines = new IDisassemblyLine[0]; - } - - private int getDistance( BigInteger address1, BigInteger address2 ) { - int index1 = getIndexForAddress( address1, fLines ); - Assert.isTrue( index1 >=0 ); - int index2 = getIndexForAddress( address2, fLines ); - Assert.isTrue( index2 >=0 ); - return index2 - index1; - } - - private int getIndexForAddress( BigInteger address, IDisassemblyLine[] lines ) { - for ( int i = 0; i < lines.length; ++i ) { - if ( lines[i] instanceof IDisassemblyInstruction && - address.compareTo( ((IDisassemblyInstruction)lines[i]).getAdress().getValue() ) == 0 ) - return i; - } - return -1; - } - - private BigInteger getCurrentStartAddress() { - for ( IDisassemblyLine l : fLines ) { - if ( l instanceof IDisassemblyInstruction ) - return ((IDisassemblyInstruction)l).getAdress().getValue(); - } - return null; - } - - private IDisassemblyLine[] disassembleDown( BigInteger address, int lineCount, boolean mixed ) throws DebugException { - BigInteger startAddress = address; - IDisassemblyLine[] lines = new IDisassemblyLine[0]; - BigInteger endAddress = startAddress; - if ( lines.length < lineCount && endAddress.compareTo( getGlobalEndAddress() ) < 0 ) { - endAddress = address.add( BigInteger.valueOf( lineCount * getMaxInstructionSize() ) ); - if ( endAddress.compareTo( getGlobalEndAddress() ) > 0 ) - endAddress = getGlobalEndAddress(); - lines = disassemble( address, endAddress, mixed ); - IDisassemblyInstruction firstInstruction = getFirstInstruction( lines ); - IDisassemblyInstruction lastInstruction = getLastInstruction( lines ); - if ( firstInstruction != null && lastInstruction != null ) { - if ( startAddress.compareTo( firstInstruction.getAdress().getValue() ) < 0 ) { - lines = appendLines( disassemble( startAddress, firstInstruction.getAdress().getValue(), mixed ), lines ); - } - startAddress = lastInstruction.getAdress().getValue(); - if ( startAddress.compareTo( endAddress ) < 0 ) { - IDisassemblyLine[] extraLines = new IDisassemblyLine[0]; - while( extraLines.length == 0 && endAddress.compareTo( getGlobalEndAddress() ) < 0 ) { - endAddress = endAddress.add( BigInteger.valueOf( getMaxInstructionSize() ) ); - extraLines = disassemble( startAddress, endAddress, mixed ); - } - lines = appendLines( lines, extraLines ); - } - } - } - int size = Math.min( lineCount, lines.length ); - IDisassemblyLine[] result = new IDisassemblyLine[size]; - int start = getIndexForAddress( address, lines ); - if ( start != -1 ) { - System.arraycopy( lines, start, result, 0, size ); - } - return result; - } - - private IDisassemblyLine[] disassemble( BigInteger startAddress, BigInteger endAddress, boolean mixed ) throws DebugException { - List<IDisassemblyLine> list = new ArrayList<IDisassemblyLine>(); - ICDITarget cdiTarget = getDebugTarget().getAdapter( ICDITarget.class ); - try { - ICDIMixedInstruction[] mixedInstructions = null; - ICDIInstruction[] asmInstructions = null; - if ( mixed ) { - mixedInstructions = cdiTarget.getMixedInstructions( startAddress, endAddress ); - if ( mixedInstructions.length == 0 - || mixedInstructions.length == 1 - && mixedInstructions[0].getInstructions().length == 0 ) { - mixedInstructions = null; - } - } - if ( mixedInstructions == null ) { - asmInstructions = cdiTarget.getInstructions( startAddress, endAddress ); - } - if ( mixedInstructions != null ) { - for ( ICDIMixedInstruction mi : mixedInstructions ) { - ICDIInstruction[] instructions = mi.getInstructions(); - if ( instructions.length > 0 ) { - list.add( new DisassemblySourceLine( (CDebugTarget)getDebugTarget(), fBaseElement, mi ) ); - for ( ICDIInstruction i : instructions ) { - list.add( new DisassemblyInstruction( (CDebugTarget)getDebugTarget(), fBaseElement, i ) ); - } - } - } - } - else if ( asmInstructions != null ) { - for ( ICDIInstruction i : asmInstructions ) { - list.add( new DisassemblyInstruction( (CDebugTarget)getDebugTarget(), fBaseElement, i ) ); - } - } - } - catch( CDIException exc ) { - throw new DebugException( new Status( IStatus.ERROR, "dummy", exc.getDetailMessage(), exc ) ); //$NON-NLS-1$ - } - return list.toArray( new IDisassemblyLine[list.size()] ); - } - - private int getMaxInstructionSize() { - return 4; - } - - private int getMinInstructionSize() { - return 1; - } - - private IDisassemblyInstruction getNextInstruction( BigInteger address, IDisassemblyLine[] lines ) { - int index = getIndexForAddress( address, lines ); - if ( index == -1 || index == lines.length - 1 ) - return null; - for ( int i = index + 1; i < lines.length; ++i ) { - if ( lines[i] instanceof IDisassemblyInstruction ) - return (IDisassemblyInstruction)lines[i]; - } - return null; - } - - private IDisassemblyInstruction getFirstInstruction( IDisassemblyLine[] lines ) { - for ( IDisassemblyLine l : lines ) { - if ( l instanceof IDisassemblyInstruction ) - return (IDisassemblyInstruction)l; - } - return null; - } - - private IDisassemblyInstruction getLastInstruction( IDisassemblyLine[] lines ) { - for ( int i = lines.length - 1; i >= 0; --i ) { - if ( lines[i] instanceof IDisassemblyInstruction ) - return (IDisassemblyInstruction)lines[i]; - } - return null; - } - - private BigInteger getGlobalEndAddress() { - return getAddressFactory().getMax().getValue(); - } - - private IAddressFactory getAddressFactory() { - return ((CDebugTarget)getDebugTarget()).getAddressFactory(); - } - - private IDisassemblyLine[] appendLines( IDisassemblyLine[] lines1, IDisassemblyLine[] lines2 ) { - List<IDisassemblyLine> list = new ArrayList<IDisassemblyLine>( lines1.length + lines2.length ); - list.addAll( Arrays.asList( lines1 ) ); - for ( IDisassemblyLine l : lines2 ) { - if ( !list.contains( l ) ) - list.add( l ); - } - return list.toArray( new IDisassemblyLine[list.size()] ); - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblySourceLine.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblySourceLine.java deleted file mode 100644 index 5b503d86074..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblySourceLine.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.core.model; - -import java.io.File; -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; -import org.eclipse.cdt.debug.core.model.IAsmInstruction; -import org.eclipse.cdt.debug.core.model.IDisassemblySourceLine; - -public class DisassemblySourceLine extends CDebugElement implements IDisassemblySourceLine { - - private BigInteger fBaseElement; - private ICDIMixedInstruction fCDIMixedInstruction; - - public DisassemblySourceLine( CDebugTarget target, BigInteger baseElement, ICDIMixedInstruction mixedInstruction ) { - super( target ); - fBaseElement = baseElement; - fCDIMixedInstruction = mixedInstruction; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IDisassemblySourceLine#getFile() - */ - @Override - public File getFile() { - String name = fCDIMixedInstruction.getFileName(); - if ( name != null && name.length() > 0 ) { - return new File( name ); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmSourceLine#getInstructions() - */ - @Override - public IAsmInstruction[] getInstructions() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.IAsmSourceLine#getLineNumber() - */ - @Override - public int getLineNumber() { - return fCDIMixedInstruction.getLineNumber(); - } - - public BigInteger getBaseAddress() { - return fBaseElement; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return fCDIMixedInstruction.getFileName() + ' ' + getLineNumber(); - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals( Object obj ) { - if ( !(obj instanceof IDisassemblySourceLine) ) - return false; - IDisassemblySourceLine other = (IDisassemblySourceLine)obj; - if ( !getFile().equals( other.getFile() ) ) - return false; - if ( getLineNumber() != other.getLineNumber() ) - return false; - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java index c9bde9be8e2..b86e9e5bfad 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java @@ -19,16 +19,11 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer; import org.eclipse.cdt.debug.core.sourcelookup.ISourceLookupChangeListener; -import org.eclipse.cdt.debug.internal.core.CBreakpointManager; import org.eclipse.cdt.debug.internal.core.ListenerList; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant; @@ -64,13 +59,6 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant { if (object instanceof String) { return (String)object; } - if (object instanceof IAdaptable) { - ICStackFrame frame = ((IAdaptable)object).getAdapter(ICStackFrame.class); - if (frame != null) { - String name = frame.getFile(); - return (name != null && name.trim().length() > 0) ? name : null; - } - } return null; } @@ -87,30 +75,7 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant { // Workaround for cases when the stack frame doesn't contain the source file name String name = null; IBreakpoint breakpoint = null; - if (object instanceof IAdaptable) { - ICStackFrame frame = ((IAdaptable)object).getAdapter(ICStackFrame.class); - if (frame != null) { - name = frame.getFile().trim(); - if (name == null || name.length() == 0) - { - if (object instanceof IDebugElement) - results = new Object[] { new CSourceNotFoundElement((IDebugElement) object, ((IDebugElement) object).getLaunch().getLaunchConfiguration(), name) }; - else - results = new Object[] { gfNoSource }; - fCachedResults.put(object, results); - return results; - } - } - // See if findSourceElements(...) is the result of a Breakpoint Hit Event - ICDebugTarget target = ((IAdaptable)object).getAdapter(ICDebugTarget.class); - if (target != null) { - CBreakpointManager bmanager = target.getAdapter(CBreakpointManager.class); - Object stateInfo = target.getCurrentStateInfo(); - if (bmanager != null && stateInfo instanceof ICDIBreakpointHit) { - breakpoint = bmanager.getBreakpoint(((ICDIBreakpointHit)stateInfo).getBreakpoint()); - } - } - } else if (object instanceof String) { + if (object instanceof String) { name = (String)object; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java index 3d10e11a694..31c34841d96 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java @@ -13,14 +13,11 @@ package org.eclipse.cdt.debug.internal.core.sourcelookup; import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.Disassembly; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.model.IPersistableSourceLocator; @@ -33,7 +30,6 @@ import org.eclipse.debug.core.model.IStackFrame; public class CSourceManager implements ICSourceLocator, IPersistableSourceLocator, IAdaptable { private ISourceLocator fSourceLocator = null; private ILaunch fLaunch = null; - private CDebugTarget fDebugTarget = null; /** * Constructor for CSourceManager. @@ -75,17 +71,6 @@ public class CSourceManager implements ICSourceLocator, IPersistableSourceLocato public void setSourceLocations(ICSourceLocation[] locations) { if (getCSourceLocator() != null) { getCSourceLocator().setSourceLocations(locations); - CDebugTarget target = getDebugTarget(); - if (target != null) { - Disassembly d = null; - try { - d = (Disassembly)target.getDisassembly(); - } catch (DebugException e) { - } - if (d != null) { - d.reset(); - } - } } } @@ -203,14 +188,6 @@ public class CSourceManager implements ICSourceLocator, IPersistableSourceLocato return (getCSourceLocator() != null) ? getCSourceLocator().getProject() : null; } - public void setDebugTarget(CDebugTarget target) { - fDebugTarget = target; - } - - protected CDebugTarget getDebugTarget() { - return fDebugTarget; - } - /* * (non-Javadoc) * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#setSearchForDuplicateFiles(boolean) 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 { - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/.classpath b/debug/org.eclipse.cdt.debug.mi.ui/.classpath deleted file mode 100644 index b277a8ac870..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <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.ui/.cvsignore b/debug/org.eclipse.cdt.debug.mi.ui/.cvsignore deleted file mode 100644 index ba077a4031a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/debug/org.eclipse.cdt.debug.mi.ui/.project b/debug/org.eclipse.cdt.debug.mi.ui/.project deleted file mode 100644 index d5076a230e1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.cdt.debug.mi.ui</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.ui/.settings/org.eclipse.core.resources.prefs b/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index bc6813d787d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Mon Nov 08 18:15:08 EST 2004
-eclipse.preferences.version=1
-encoding//src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties=8859_1
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.jdt.core.prefs b/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d30655563b1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,74 +0,0 @@ -#Wed Apr 08 15:57:04 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.ui/ChangeLog b/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog deleted file mode 100644 index bded9c2603d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog +++ /dev/null @@ -1,370 +0,0 @@ -2006-09-11 Mikhail Khodjaiants
- Bug 156114: GDB options layout problem.
- Applied patch from Vladimir Prus (vladimir@codesourcery.com).
- * StandardGDBDebuggerPage.java
-
-2006-04-16 Mikhail Khodjaiants
- Bug 113107: Make trace logs more readily available.
- * MIUIMessages.properties
- * StandardGDBDebuggerPage.java
-
-2006-04-13 Mikhail Khodjaiants
- Bug 113107: Make trace logs more readily available.
- Implementation of the "Verbose Mode" action.
- * MANIFEST.MF
- * plugin.properties
- * plugin.xml
- + VerboseModeActionDelegate.java
- + icons/obj16/verbose_mode_co.gif
-
-2006-04-11 Mikhail Khodjaiants
- Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for.
- Sort the shared library list.
- * SolibSearchPathBlock.java
-
-2006-04-11 Mikhail Khodjaiants
- Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for.
- Use set instead of list when collecting the shared library names: different libraries can have same soname.
- * SolibSearchPathBlock.java
-
-2006-04-11 Mikhail Khodjaiants
- Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for.
- Use soname instead of shared library name.
- * SolibSearchPathBlock.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.
- * MANIFEST.MF
- * GDBDebuggerPage.java
- * MIUIMessages.properties
- * SolibSearchPathBlock.java
- * StandardGDBDebuggerPage.java
- - IPathProvider.java
- * MIUIUtils.java
-
-2006-03-31 Mikhail Khodjaiants
- Replaced internal org.eclipse.cdt.debug.internal.ui.SWTUtil class.
- + SWTUtil.java
- * ListDialogField.java
- * SelectionButtonDialogField.java
- * StringButtonDialogField.java
-
-2006-03-01 Mikhail Khodjaiants
- Select the first available command factory when a new launch configuration is created.
- * StandardGDBDebuggerPage.java
-
-2006-02-08 Mikhail Khodjaiants
- Bug 114793: Add an extension point to contribute command factories.
- GDBServerDebuggerPage should extend StandardGDBDebuggerPage.
- * GDBServerDebuggerPage.java
-
-2006-02-06 Mikhail Khodjaiants
- Bug 114793: Add an extension point to contribute command factories.
- * MIUIMessages.properties
- + StandardGDBDebuggerPage.java
- * plugin.xml
-
-2006-02-03 Mikhail Khodjaiants
- The "ICDebuggerPage" interface and "AbstractCDebuggerPage" class are added.
- All extensions of the "CDebuggerPage" extension point must implement "ICDebuggerPage".
- * GDBDebuggerPage.java
-
-2005-12-27 Mikhail Khodjaiants
- Cleanup.
- * MIUIPlugin.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
- * GDBDebuggerPage.java
-
-2005-09-06 Mikhail Khodjaiants
- Cleanup: replaced "new Boolean" by the static Boolean objects (Java 1.4).
- * GDBSolibBlock.java
-
-2005-09-06 Mikhail Khodjaiants
- Bug 108636: mi level selection option should be moved to the gdb page.
- * MIUIMessages.properties
- * GDBDebuggerPage.java
-
-2005-09-02 Mikhail Khodjaiants
- Bug 108723: Create a separate tab for gdb server's conection options.
- * GDBDebuggerPage.java
- * GDBServerDebuggerPage.java
- * MIUIMessages.properties
- * SerialPortSettingsBlock.java
- * TCPSettingsBlock.java
- * SolibSearchPathBlock.java
-
-2005-07-22 Alain Magloire
- Fix the copyright.
-
-2005-04-13 Alain Magloire
- Fix PR 91002
- * src/org/eclipse/cdt/debug/mi/internal/preferences/MIPreferencePage.java
-
-2005-04-07 Mikhail Khodjaiants
- Removed unused icons.
- - icons/full/clcl16/auto_solib_co.gif
- - icons/full/dlcl16/auto_solib_co.gif
- - icons/full/elcl16/auto_solib_co.gif
-
-2005-03-09 Mikhail Khodjaiants
- Fix for bug 87546: Obsolete debug MI settings in Preference need to be removed.
- * MIPreferencePage.java
- * PreferenceMessages.properties
- * OptionsPropertyPage.java
- * PropertyMessages.properties
-
-2005-03-03 Mikhail Khodjaiants
- Conflicting methods.
- * SolibSearchPathBlock.java
-
-2005-01-11 Mikhail Khodjaiants
- Replaced deprecated methods and constants.
- * MIPreferencePage.java
-
-2005-01-11 Mikhail Khodjaiants
- Replaced deprecated methods and constants.
- * ListDialogField.java
- * SelectionButtonDialogField.java
- * StringButtonDialogField.java
-
-2004-11-11 Mikhail Khodjaiants
- Fix for bug 75627: Incorrect limit to port numbers.
- * TCPSettingsBlock.java
-
-2004-11-08 Mikhail Khodjaiants
- Added the "Automatically refresh registers" and "Automatically refresh shared libraries"
- preferences and properties.
- * ActionFilterAdapterFactory.java: new
- * GDBTargetActionFilter.java: new
- * PreferenceMessages.properties
- * MIPreferencePage.java
- * org.eclipse.cdt.debug.mi.internal.ui.propertypages: new package
- * PropertyMessages.properties
- * OptionsPropertyPage.java
- * PropertyMessages.java
- * plugin.properties
- * plugin.xml
-
-2004-10-29 Alain Magloire
- Changes to the CDI interface
- * SeAutoSolibActionDelegate.java
-
-2004-08-23 Mikhail Khodjaiants
- Added API to allow the access to the internal MI UI components by client plugins.
- Changed the "Solib search path" component.
- Reformatting and cleanup.
- * MIUIMessages.properties
- * CygwinDebuggerPage.java
- * GDBDebuggerPage.java
- * GDBServerDebuggerPage.java
- * GDBSolibBlock.java
- * IMIHelpContextIds.java
- * IMILaunchConfigurationComponent.java: new
- * IMIUIConstants.java
- * IPathProvider.java: new
- * MIUIUtils.java: new
- * PixelConverter.java
- * SerialPortSettingsBlock.java
- * SolibSearchPathBlock.java
- * TCPSettingsBlock.java
- * SetAutoSolibActionDelegate.java
- * MIPreferencePage.java
-
-2004-07-14 Mikhail Khodjaiants
- Wrong fix. Falling back.
- * GDBSolibBlock.java
-
-2004-07-14 Alain Magloire
-
- Wrong call the to the Button widget it should have been
- setSelection() not setEnabled()
-
- * src/org/eclipse/cdt/debug/mi/internal/ui/GDBSolibBlock.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.
- Removed the "Shared Libraries" tab from the "Debugger" page of the laaunch configuration dialog
- for the "CygWin Debugger" type.
- * CygwinDebuggerPage.java
-
-2004-06-22 Mikhail Khodjaiants
- Replaced global resource bundles by messages.
-
-2004-06-21 Mikhail Khodjaiants
- Fix for bug 60872. Accessibility: Run/Debug configuration dialog has duplicate mnemonics.
- * MIUIMessages.properties
- * MIUIPluginResources.properties
-
-2004-05-21 Mikhail Khodjaiants
- Removed dependencies on the compatibility plugin and replaced deprecated classes and methods.
- Warning cleanup.
- * GDBServerDebuggerPage.java
- * IMIUIConstants.java
- * MIUIPlugin.java
- * SerialPortSettingsBlock.java
- * TCPSettingsBlock.java
- * SelectionButtonDialogFieldGroup.java
- * plugin.xml
-
-2004-04-29 Mikhail Khodjaiants
- Fix for bug 59083: Two short cut keys in one sentence.
- * MIUIPluginResources.properties
-
-2004-03-11 Tanya Wolff
- Externalized strings and marked non translatable as such.
- * CygwinDebuggerPage.java
- * GDBDebuggerPage.java
- * GDBServerDebuggerPage.java
- * GDBSolibBlock.java
- * MIUIPlugin.java
- * SolibSearchPathBlock.java
- * TCPSettingsBlock.java
- * MIUIPluginResources.properties
- * SetAutoSolibActionDelegate.java
- * MIPreferencePage.java
-
-2003-12-17 Mikhail Khodjaiants
- Fix for bug 49061: Different values are used as default for the "Load shared library symbols automatically" option.
- * GDBSolibBlock.java
-
-2003-12-01 Mikhail Khodjaiants
- Fix for PR 47230: Need a shared library search path editing capability for GDBServerDebugger.
- Implemented 'GDBServerDebuggerPage' as an extension of 'GDBDebuggerPage'.
- Added two new control blocks - "TCP Connection" and "Serial Connection".
- * src/org/eclipse/cdt/debug/mi/internal/ui/GDBDebuggerPage.java
- * src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPage.java
- * src/org/eclipse/cdt/debug/mi/internal/ui/SerialPortSettingsBlock.java: new
- * src/org/eclipse/cdt/debug/mi/internal/ui/TCPSettingsBlock.java: new
-
-2003-11-26 Mikhail Khodjaiants
- Cleanup.
- * GDBServerDebuggerPage.java
- * ComboDialogField.java
-
-2003-11-20 Mikhail Khodjaiants
- Removed dependencies on internal packages from other cdt plugins.
- * src/org/eclipse/cdt/debug/mi/internal/ui/PixelConverter.java: added
- * src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.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/internal/ui/preferences/MIPreferencePage.java:
- added a text field for the launch timeout.
-
-2003-11-06 Alain Magloire
-
- Patch from Ashish Karkare(TimeSys)
- *src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPage.java
- Add a new Combo that helps select a reasonable line speed, and storing
- the selected value as a configuration attribute.
-
-2003-09-29 Mikhail Khodjaiants
- Improved the layout of the 'Shared Libraries' component.
- * SolibSearchPathBlock.java
-
-2003-09-11 Mikhail Khodjaiants
- Moving the shared library search paths block to mi UI.
- * SolibSearchPathBlock.java: new
- * GDBSolibBlock.java
-
-2003-09-11 Mikhail Khodjaiants
- Added the 'org.eclipse.cdt.debug.mi.internal.ui.dialogfields' package.
- * CheckedListDialogField.java: new
- * ComboDialogField.java: new
- * DialogField.java: new
- * IDialogFieldListener.java: new
- * IListAdapter.java: new
- * IStringButtonAdapter.java: new
- * LayoutUtil.java: new
- * ListDialogField.java: new
- * SelectionButtonDialogField.java: new
- * SelectionButtonDialogFieldGroup.java: new
- * Separator.java: new
- * StringButtonDialogField.java: new
- * StringButtonStatusDialogField.java: new
- * StringDialogField.java: new
-
-2003-09-09 Mikhail Khodjaiants
- New UI for the 'Debugger' page of launch configuration.
- * CygwinDebuggerPage.java
- * GDBDebuggerPage.java
- * GDBSolibBlock.java
-
-2003-04-07 Mikhail Khodjaiants
- Replaced 'toString()' by 'getMessage()' for CDI exceptions.
- * SetAutoSolibActionDelegate.java
-
-2004-04-04 Alain Magloire
-
- Code from Monta Vista to do a GDBServer launch.
- The GDBServer launch page.
-
- * src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPager.java:
- * plugin.xml
-
-2003-03-26 Mikhail Khodjaiants
- Cosmetic changes in the 'MIPreferencePage' class.
- * MIPreferencePage.java
-
-2003-02-12 Mikhail Khodjaiants
- Changes in the 'Automatically Load Symbols' action because of the removal of the
- 'setAutoSolib' method from ICDISharedLibraryManager.
- * SetAutoSolibActionDelegate.java
- * plugin.xml
-
-2003-02-11 Mikhail Khodjaiants
- The 'Automatically Load Symbols' action is added to the 'Shared Libraries' view.
- * SetAutoSolibActionDelegate.java: new
- * plugin.properties
- * plugin.xml
- * icons/full/clcl16/auto_solib_co.gif: new
- * icons/full/dlcl16/auto_solib_co.gif: new
- * icons/full/elcl16/auto_solib_co.gif: new
-
-2003-02-11 Mikhail Khodjaiants
- New package 'org.eclipse.cdt.debug.mi.internal.ui.actions' is added.
-
-2003-02-06 Alain Magloire
-
- * src/.../internal/ui/CygwinDebuggerPage.java (updateLaunchConfigurationDialog):
- New method to increase visibility for inner classes.
- (getShell): New method to increase visibility for inner classes.
- (fGDBCommandText): Change scope to protected.
- (fGDBInitText) Change scope to protected.
- * src/.../internal/ui/GDBDebuggerPage.java: Ditto.
-
-2003-01-24 David Inglis
-
- * src/.../internal/ui/CDebuggerPage.java (removed)
- * src/.../internal/ui/GDBDebuggerPage.java (added)
- rename class plus small layout fix.
-
- * plugin.xml
- * src/.../internal/ui/CygwinDebuggerPage.java (added)
- make Cywin use its own debug page and remove the auto load solib option.
-
-2003-01-17 David Inglis
- * src/.../internal/ui/CDebuggerPage.java
- Added some browse buttons and new text field for gdbinit file.
-
-2003-01-03 Alain Magloire
-
- * build.properties: Patch from Judy Green.
-
-2003-01-03 Alain Magloire
-
- * src/org/eclipse./cdt/debug/mi/internal/ui/CDebuggerPage.java (setDefaults):
- Set autosolib to true by default.
-
-2002-11-26 Doug Schaefer
-
- * plugin.xml:
- Added new debugPage for Cygwin GDB.
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.mi.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 91a852543f7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,31 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.cdt.debug.mi.ui; singleton:=true -Bundle-Version: 6.2.0.qualifier -Bundle-Activator: org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: org.eclipse.cdt.debug.mi.internal.ui;x-internal:=true, - org.eclipse.cdt.debug.mi.internal.ui.actions;x-internal:=true, - org.eclipse.cdt.debug.mi.internal.ui.dialogfields;x-internal:=true, - org.eclipse.cdt.debug.mi.internal.ui.preferences;x-internal:=true, - org.eclipse.cdt.debug.mi.internal.ui.propertypages;x-internal:=true, - org.eclipse.cdt.debug.mi.ui, - org.eclipse.cdt.debug.mi.ui.console, - org.eclipse.cdt.debug.mi.ui.console.actions -Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.0.0,7.0.0)", - org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.1.0)", - org.eclipse.cdt.debug.mi.core;bundle-version="[7.0.0,8.1.0)", - org.eclipse.cdt.debug.ui;bundle-version="[7.0.0,8.1.0)", - org.eclipse.cdt.ui;bundle-version="[6.0.0,7.0.0)", - org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)", - org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", - org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)", - org.eclipse.ui;bundle-version="[3.2.0,4.0.0)", - org.eclipse.ui.console;bundle-version="[3.1.100,4.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.ui/about.html b/debug/org.eclipse.cdt.debug.mi.ui/about.html deleted file mode 100644 index d7c511887d6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/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.ui/build.properties b/debug/org.eclipse.cdt.debug.mi.ui/build.properties deleted file mode 100644 index bc087cfbc3e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/build.properties +++ /dev/null @@ -1,19 +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 -############################################################################### - -bin.includes = plugin.xml,\ - plugin.properties,\ - about.html,\ - icons/,\ - .,\ - META-INF/ -source.. = src/ -src.includes = about.html diff --git a/debug/org.eclipse.cdt.debug.mi.ui/icons/obj16/save_console.gif b/debug/org.eclipse.cdt.debug.mi.ui/icons/obj16/save_console.gif Binary files differdeleted file mode 100644 index 555182cacd0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/icons/obj16/save_console.gif +++ /dev/null diff --git a/debug/org.eclipse.cdt.debug.mi.ui/icons/obj16/verbose_mode_co.gif b/debug/org.eclipse.cdt.debug.mi.ui/icons/obj16/verbose_mode_co.gif Binary files differdeleted file mode 100644 index ea13622821c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/icons/obj16/verbose_mode_co.gif +++ /dev/null diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties deleted file mode 100644 index ed4e14151ac..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/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 UI -providerName=Eclipse CDT - -MIPreferencePage.name=GDB MI - -SetAutoSolibAction.label=Automatically Load Shared Libraries -SetAutoSolibAction.tooltip=Automatically Load Shared Libraries On/Off - -TargetOptionsPage.label=GDB/MI Options - -VerboseMode.label=Verbose Mode -VerboseMode.tooltip=Verbose Mode For gdb Console diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml deleted file mode 100644 index 6d9b721cda6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin> - - <extension - point="org.eclipse.cdt.debug.ui.CDebuggerPage"> - <debuggerPage - class="org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebugger" - id="org.eclipse.cdt.debug.mi.GDBDebuggerPage"/> - <debuggerPage - class="org.eclipse.cdt.debug.mi.internal.ui.CygwinDebuggerPage" - debuggerID="org.eclipse.cdt.debug.mi.core.CygwinCDebugger" - id="org.eclipse.cdt.debug.mi.CygwinDebuggerPage"/> - <debuggerPage - class="org.eclipse.cdt.debug.mi.internal.ui.GDBServerDebuggerPage" - debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger" - id="org.eclipse.cdt.debug.mi.GDBServerDebuggerPage"/> - <debuggerPage - class="org.eclipse.cdt.debug.mi.internal.ui.StandardGDBDebuggerPage" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - id="org.eclipse.cdt.debug.mi.GDBDebuggerPageNew"/> - <debuggerPage - class="org.eclipse.cdt.debug.mi.internal.ui.MinGWDebuggerPage" - debuggerID="org.eclipse.cdt.debug.mi.core.MinGW" - id="org.eclipse.cdt.debug.mi.MinGWDebuggerPage"> - </debuggerPage> - </extension> - <extension - point="org.eclipse.ui.preferencePages"> - <page - name="%MIPreferencePage.name" - category="org.eclipse.cdt.debug.ui.CDebugPreferencePage" - class="org.eclipse.cdt.debug.mi.internal.ui.preferences.MIPreferencePage" - id="org.eclipse.cdt.debug.mi.ui.MIPreferencePage"> - </page> - </extension> - <extension - point="org.eclipse.ui.propertyPages"> - <page - objectClass="org.eclipse.cdt.debug.core.model.ICDebugTarget" - class="org.eclipse.cdt.debug.mi.internal.ui.propertypages.OptionsPropertyPage" - name="%TargetOptionsPage.label" - id="org.eclipse.cdt.debug.mi.ui.propertypages.target.options"> - <filter - value="isGDBTarget" - name="GDBTargetActionFilter"/> - </page> - </extension> - <extension - point="org.eclipse.core.runtime.adapters"> - <factory - class="org.eclipse.cdt.debug.mi.internal.ui.ActionFilterAdapterFactory" - adaptableType="org.eclipse.cdt.debug.core.model.ICDebugTarget"> - <adapter type="org.eclipse.ui.IActionFilter"/> - </factory> - </extension> - <extension - point="org.eclipse.ui.popupMenus"> - <objectContribution - adaptable="false" - id="org.eclipse.cdt.debug.mi.ui.gdbProcessActions" - objectClass="org.eclipse.cdt.debug.mi.core.GDBProcess"> - <action - class="org.eclipse.cdt.debug.mi.internal.ui.actions.VerboseModeActionDelegate" - enablesFor="1" - helpContextId="verbose_mode_console_action_context" - icon="icons/obj16/verbose_mode_co.gif" - id="org.eclipse.cdt.debug.mi.ui.verboseModeAction" - label="%VerboseMode.label" - menubarPath="renderGroup" - state="false" - style="toggle" - tooltip="%VerboseMode.tooltip"/> - </objectContribution> - </extension> - <extension - point="org.eclipse.ui.console.consolePageParticipants"> - <consolePageParticipant - class="org.eclipse.cdt.debug.mi.ui.console.MiConsolePageParticipant" - id="org.eclipse.cdt.debug.mi.ui.console.miConsolePageParticipant"> - <enablement> - <instanceof value="org.eclipse.debug.internal.ui.views.console.ProcessConsole"/> - </enablement> - </consolePageParticipant> - </extension> - -</plugin> diff --git a/debug/org.eclipse.cdt.debug.mi.ui/pom.xml b/debug/org.eclipse.cdt.debug.mi.ui/pom.xml deleted file mode 100644 index bdfc3635fd1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/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>6.2.0-SNAPSHOT</version> - <artifactId>org.eclipse.cdt.debug.mi.ui</artifactId> - <packaging>eclipse-plugin</packaging> -</project> diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/ActionFilterAdapterFactory.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/ActionFilterAdapterFactory.java deleted file mode 100644 index 15d8fe5b4ca..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/ActionFilterAdapterFactory.java +++ /dev/null @@ -1,47 +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.internal.ui; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.ui.IActionFilter; - -/** - * The UI adapter factory for GDB/MI Debug extensions - */ -public class ActionFilterAdapterFactory implements IAdapterFactory { - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - @Override - public Object getAdapter( Object adaptableObject, Class adapterType ) { - if ( adapterType.isInstance( adaptableObject ) ) { - return adaptableObject; - } - if ( adapterType == IActionFilter.class ) { - if ( adaptableObject instanceof ICDebugTarget ) { - return new GDBTargetActionFilter(); - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - @Override - public Class[] getAdapterList() { - return new Class[] { - IActionFilter.class - }; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CygwinDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CygwinDebuggerPage.java deleted file mode 100644 index b39328b21f2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CygwinDebuggerPage.java +++ /dev/null @@ -1,32 +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.internal.ui; - -import org.eclipse.swt.widgets.TabFolder; - -/** - * CygWin-specific extension of <code>GDBDebuggerPage</code>. - */ -public class CygwinDebuggerPage extends GDBDebuggerPage { - - @Override - public String getName() { - return MIUIMessages.getString( "CygwinDebuggerPage.0" ); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#createTabs(org.eclipse.swt.widgets.TabFolder) - */ - @Override - public void createTabs( TabFolder tabFolder ) { - createMainTab( tabFolder ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBDebuggerPage.java deleted file mode 100644 index 7a73c898dbe..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBDebuggerPage.java +++ /dev/null @@ -1,384 +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.internal.ui; - -import java.io.File; -import java.util.Observable; -import java.util.Observer; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent; -import org.eclipse.cdt.debug.mi.ui.MIUIUtils; -import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Text; - -/** - * The dynamic tab for gdb-based debugger implementations. - */ -public class GDBDebuggerPage extends AbstractCDebuggerPage implements Observer { - - final private static String DEFAULT_MI_PROTOCOL = MIUIMessages.getString( "GDBDebuggerPage.12" ); //$NON-NLS-1$ - final protected String[] protocolItems = new String[] { DEFAULT_MI_PROTOCOL, "mi1", "mi2", "mi3" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - - protected TabFolder fTabFolder; - - protected Text fGDBCommandText; - - protected Text fGDBInitText; - - protected Combo fProtocolCombo; - - private IMILaunchConfigurationComponent fSolibBlock; - - private boolean fIsInitializing = false; - - private Button fBreakpointsFullPath; - - @Override - public void createControl( Composite parent ) { - Composite comp = new Composite( parent, SWT.NONE ); - comp.setLayout( new GridLayout() ); - comp.setLayoutData( new GridData( GridData.FILL_BOTH ) ); - fTabFolder = new TabFolder( comp, SWT.NONE ); - fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) ); - createTabs( fTabFolder ); - fTabFolder.setSelection( 0 ); - setControl( parent ); - } - - @Override - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$ - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi" ); //$NON-NLS-1$ - if ( fSolibBlock != null ) - fSolibBlock.setDefaults( configuration ); - } - - @Override - public boolean isValid( ILaunchConfiguration launchConfig ) { - boolean valid = fGDBCommandText.getText().length() != 0; - if ( valid ) { - setErrorMessage( null ); - setMessage( null ); - } - else { - setErrorMessage( MIUIMessages.getString( "GDBDebuggerPage.0" ) ); //$NON-NLS-1$ - setMessage( null ); - } - return valid; - } - - @Override - public void initializeFrom( ILaunchConfiguration configuration ) { - setInitializing( true ); - String gdbCommand = "gdb"; //$NON-NLS-1$ - String gdbInit = IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT; - try { - gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$ - } - catch( CoreException e ) { - } - try { - gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT ); - } - catch( CoreException e ) { - } - String miVersion = MIPlugin.getMIVersion( configuration ); - if ( miVersion.compareTo( "mi" ) == 0 ) { //$NON-NLS-1$ - miVersion = DEFAULT_MI_PROTOCOL; - } - if ( fSolibBlock != null ) - fSolibBlock.initializeFrom( configuration ); - fGDBCommandText.setText( gdbCommand ); - fGDBInitText.setText( gdbInit ); - int index = 0; - if ( miVersion.length() > 0 ) { - for( int i = 0; i < protocolItems.length; ++i ) { - if ( protocolItems[i].equals( miVersion ) ) { - index = i; - break; - } - } - } - fProtocolCombo.select( index ); - - boolean useFullPath = IMILaunchConfigurationConstants.DEBUGGER_FULLPATH_BREAKPOINTS_DEFAULT; - try { - useFullPath = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, useFullPath); - } - catch (CoreException e) {} - fBreakpointsFullPath.setSelection(useFullPath); - - setInitializing( false ); - } - - @Override - public void performApply( ILaunchConfigurationWorkingCopy configuration ) { - String str = fGDBCommandText.getText(); - str.trim(); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, str ); - str = fGDBInitText.getText(); - str.trim(); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, str ); - str = fProtocolCombo.getText(); - if ( str.compareTo( DEFAULT_MI_PROTOCOL ) == 0 ) { - str = "mi"; //$NON-NLS-1$ - } - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, str ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, fBreakpointsFullPath.getSelection() ); - if ( fSolibBlock != null ) - fSolibBlock.performApply( configuration ); - } - - @Override - public String getName() { - return MIUIMessages.getString( "GDBDebuggerPage.1" ); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell() - */ - @Override - protected Shell getShell() { - return super.getShell(); - } - - /** - * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog() - */ - @Override - protected void updateLaunchConfigurationDialog() { - super.updateLaunchConfigurationDialog(); - } - - /* - * (non-Javadoc) - * - * @see java.util.Observer#update(java.util.Observable, java.lang.Object) - */ - @Override - public void update( Observable o, Object arg ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - - public IMILaunchConfigurationComponent createSolibBlock( Composite parent ) { - IMILaunchConfigurationComponent block = MIUIUtils.createGDBSolibBlock( true, true ); - block.createControl( parent ); - return block; - } - - public void createTabs( TabFolder tabFolder ) { - createMainTab( tabFolder ); - createSolibTab( tabFolder ); - } - - public void createMainTab( TabFolder tabFolder ) { - TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); - tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.2" ) ); //$NON-NLS-1$ - Composite comp = ControlFactory.createCompositeEx( tabFolder, 1, GridData.FILL_BOTH ); - ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; - comp.setFont( tabFolder.getFont() ); - tabItem.setControl( comp ); - Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL ); - ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; - subComp.setFont( tabFolder.getFont() ); - Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.3" ) ); //$NON-NLS-1$ - GridData gd = new GridData(); - // gd.horizontalSpan = 2; - label.setLayoutData( gd ); - fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); - fGDBCommandText.addModifyListener( new ModifyListener() { - - @Override - public void modifyText( ModifyEvent evt ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - Button button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.4" ), null ); //$NON-NLS-1$ - button.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent evt ) { - handleGDBButtonSelected(); - updateLaunchConfigurationDialog(); - } - - private void handleGDBButtonSelected() { - FileDialog dialog = new FileDialog( getShell(), SWT.NONE ); - dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.5" ) ); //$NON-NLS-1$ - String gdbCommand = fGDBCommandText.getText().trim(); - int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator ); - if ( lastSeparatorIndex != -1 ) { - dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) ); - } - String res = dialog.open(); - if ( res == null ) { - return; - } - fGDBCommandText.setText( res ); - } - } ); - label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.6" ) ); //$NON-NLS-1$ - gd = new GridData(); - // gd.horizontalSpan = 2; - label.setLayoutData( gd ); - fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); - gd = new GridData( GridData.FILL_HORIZONTAL ); - fGDBInitText.setLayoutData( gd ); - fGDBInitText.addModifyListener( new ModifyListener() { - - @Override - public void modifyText( ModifyEvent evt ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.7" ), null ); //$NON-NLS-1$ - button.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent evt ) { - handleGDBInitButtonSelected(); - updateLaunchConfigurationDialog(); - } - - private void handleGDBInitButtonSelected() { - FileDialog dialog = new FileDialog( getShell(), SWT.NONE ); - dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.8" ) ); //$NON-NLS-1$ - String gdbCommand = fGDBInitText.getText().trim(); - int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator ); - if ( lastSeparatorIndex != -1 ) { - dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) ); - } - String res = dialog.open(); - if ( res == null ) { - return; - } - fGDBInitText.setText( res ); - } - } ); - label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.9" ), //$NON-NLS-1$ - 200, SWT.DEFAULT, SWT.WRAP ); - gd = new GridData( GridData.FILL_HORIZONTAL ); - gd.horizontalSpan = 3; - gd.widthHint = 200; - label.setLayoutData( gd ); - - createProtocolCombo( subComp ); - - createBreakpointFullPathName(subComp); - GridData gd2 = new GridData(); - gd2.horizontalSpan = 3; - fBreakpointsFullPath.setLayoutData(gd2); - } - - public void createSolibTab( TabFolder tabFolder ) { - TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); - tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.10" ) ); //$NON-NLS-1$ - Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH ); - comp.setFont( tabFolder.getFont() ); - tabItem.setControl( comp ); - fSolibBlock = createSolibBlock( comp ); - if ( fSolibBlock instanceof Observable ) - ((Observable)fSolibBlock).addObserver( this ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose() - */ - @Override - public void dispose() { - if ( fSolibBlock != null ) { - if ( fSolibBlock instanceof Observable ) - ((Observable)fSolibBlock).deleteObserver( this ); - fSolibBlock.dispose(); - } - super.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void activated( ILaunchConfigurationWorkingCopy workingCopy ) { - // Override the default behavior - } - - protected boolean isInitializing() { - return fIsInitializing; - } - - private void setInitializing( boolean isInitializing ) { - fIsInitializing = isInitializing; - } - - protected void createProtocolCombo( Composite parent ) { - Label label = new Label( parent, SWT.NONE ); - label.setText( MIUIMessages.getString( "GDBDebuggerPage.11" ) ); //$NON-NLS-1$ - fProtocolCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN ); - fProtocolCombo.setItems( protocolItems ); - fProtocolCombo.addSelectionListener( new SelectionListener() { - - @Override - public void widgetDefaultSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - - @Override - public void widgetSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - } - - protected void createBreakpointFullPathName( Composite parent ) { - fBreakpointsFullPath = createCheckButton( parent, MIUIMessages.getString( "StandardGDBDebuggerPage.14" ) ); //$NON-NLS-1$ - fBreakpointsFullPath.addSelectionListener( new SelectionListener() { - @Override - public void widgetDefaultSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - @Override - public void widgetSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPage.java deleted file mode 100644 index 74257032824..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPage.java +++ /dev/null @@ -1,203 +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 - * IBM Corporation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui; - -import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ComboDialogField; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IDialogFieldListener; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; - -/** - * The dynamic debugger tab for remote launches using gdb server. - */ -public class GDBServerDebuggerPage extends StandardGDBDebuggerPage { - - private final static String CONNECTION_TCP = MIUIMessages.getString( "GDBServerDebuggerPage.0" ); //$NON-NLS-1$ - - private final static String CONNECTION_SERIAL = MIUIMessages.getString( "GDBServerDebuggerPage.1" ); //$NON-NLS-1$ - - private ComboDialogField fConnectionField; - - private String[] fConnections = new String[]{ CONNECTION_TCP, CONNECTION_SERIAL }; - - private TCPSettingsBlock fTCPBlock; - - private SerialPortSettingsBlock fSerialBlock; - - private Composite fConnectionStack; - - private boolean fIsInitializing = false; - - public GDBServerDebuggerPage() { - super(); - fConnectionField = createConnectionField(); - fTCPBlock = new TCPSettingsBlock(); - fSerialBlock = new SerialPortSettingsBlock(); - fTCPBlock.addObserver( this ); - fSerialBlock.addObserver( this ); - } - - protected void createConnectionTab( TabFolder tabFolder ) { - TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); - tabItem.setText( MIUIMessages.getString( "GDBServerDebuggerPage.10" ) ); //$NON-NLS-1$ - Composite comp1 = ControlFactory.createCompositeEx( tabFolder, 1, GridData.FILL_BOTH ); - ((GridLayout)comp1.getLayout()).makeColumnsEqualWidth = false; - comp1.setFont( tabFolder.getFont() ); - tabItem.setControl( comp1 ); - Composite comp = ControlFactory.createCompositeEx( comp1, 2, GridData.FILL_BOTH ); - ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; - comp.setFont( comp1.getFont() ); - - createConnectionWidgets(comp); - } - - protected void createConnectionWidgets(Composite comp) { - fConnectionField.doFillIntoGrid( comp, 2 ); - ((GridData)fConnectionField.getComboControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING; - fConnectionStack = ControlFactory.createCompositeEx( comp, 1, GridData.FILL_BOTH ); - StackLayout stackLayout = new StackLayout(); - fConnectionStack.setLayout( stackLayout ); - ((GridData)fConnectionStack.getLayoutData()).horizontalSpan = 2; - fTCPBlock.createBlock( fConnectionStack ); - fSerialBlock.createBlock( fConnectionStack ); - } - - private ComboDialogField createConnectionField() { - ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY ); - field.setLabelText( MIUIMessages.getString( "GDBServerDebuggerPage.9" ) ); //$NON-NLS-1$ - field.setItems( fConnections ); - field.setDialogFieldListener( new IDialogFieldListener() { - - @Override - public void dialogFieldChanged( DialogField f ) { - if ( !isInitializing() ) - connectionTypeChanged(); - } - } ); - return field; - } - - protected void connectionTypeChanged() { - connectionTypeChanged0(); - updateLaunchConfigurationDialog(); - } - - private void connectionTypeChanged0() { - ((StackLayout)fConnectionStack.getLayout()).topControl = null; - int index = fConnectionField.getSelectionIndex(); - if ( index >= 0 && index < fConnections.length ) { - String[] connTypes = fConnectionField.getItems(); - if ( CONNECTION_TCP.equals( connTypes[index] ) ) - ((StackLayout)fConnectionStack.getLayout()).topControl = fTCPBlock.getControl(); - else if ( CONNECTION_SERIAL.equals( connTypes[index] ) ) - ((StackLayout)fConnectionStack.getLayout()).topControl = fSerialBlock.getControl(); - } - fConnectionStack.layout(); - } - - @Override - public boolean isValid( ILaunchConfiguration launchConfig ) { - if ( super.isValid( launchConfig ) ) { - setErrorMessage( null ); - setMessage( null ); - int index = fConnectionField.getSelectionIndex(); - if ( index >= 0 && index < fConnections.length ) { - String[] connTypes = fConnectionField.getItems(); - if ( CONNECTION_TCP.equals( connTypes[index] ) ) { - if ( !fTCPBlock.isValid( launchConfig ) ) { - setErrorMessage( fTCPBlock.getErrorMessage() ); - return false; - } - } - else if ( CONNECTION_SERIAL.equals( connTypes[index] ) ) { - if ( !fSerialBlock.isValid( launchConfig ) ) { - setErrorMessage( fSerialBlock.getErrorMessage() ); - return false; - } - } - return true; - } - } - return false; - } - - @Override - public void initializeFrom( ILaunchConfiguration configuration ) { - setInitializing( true ); - super.initializeFrom( configuration ); - boolean isTcp = false; - try { - isTcp = configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false ); - } - catch( CoreException e ) { - } - fTCPBlock.initializeFrom( configuration ); - fSerialBlock.initializeFrom( configuration ); - fConnectionField.selectItem( (isTcp) ? 0 : 1 ); - connectionTypeChanged0(); - setInitializing( false ); - } - - @Override - public void performApply( ILaunchConfigurationWorkingCopy configuration ) { - super.performApply( configuration ); - if ( fConnectionField != null ) - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, fConnectionField.getSelectionIndex() == 0 ); - fTCPBlock.performApply( configuration ); - fSerialBlock.performApply( configuration ); - } - - @Override - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { - super.setDefaults( configuration ); - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false ); - fTCPBlock.setDefaults( configuration ); - fSerialBlock.setDefaults( configuration ); - } - - @Override - protected boolean isInitializing() { - return fIsInitializing; - } - - private void setInitializing( boolean isInitializing ) { - fIsInitializing = isInitializing; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#createTabs(org.eclipse.swt.widgets.TabFolder) - */ - @Override - public void createTabs( TabFolder tabFolder ) { - super.createTabs( tabFolder ); - createConnectionTab( tabFolder ); - } - - public void dispose() { - fTCPBlock.dispose(); - fSerialBlock.dispose(); - fConnectionStack.dispose(); - fConnectionField.dispose(); - super.dispose(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBSolibBlock.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBSolibBlock.java deleted file mode 100644 index 92286fe32f8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBSolibBlock.java +++ /dev/null @@ -1,202 +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.internal.ui; - -import java.util.Map; -import java.util.Observable; -import java.util.Observer; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * The content of the <code>Shared Libraries</code> tab of the <code>GDBDebuggerPage</code>. - */ -public class GDBSolibBlock extends Observable implements IMILaunchConfigurationComponent, Observer { - - private IMILaunchConfigurationComponent fSolibSearchPathBlock; - - private Button fAutoSoLibButton; - - private Button fStopOnSolibEventsButton; - - private Composite fControl; - - private boolean fAutoSolib = false; - - private boolean fStopOnSolibEvents = false; - - public GDBSolibBlock( IMILaunchConfigurationComponent solibSearchBlock, boolean autoSolib, boolean stopOnSolibEvents ) { - super(); - fSolibSearchPathBlock = solibSearchBlock; - fAutoSolib = autoSolib; - fStopOnSolibEvents = stopOnSolibEvents; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#createControl(org.eclipse.swt.widgets.Composite) - */ - @Override - public void createControl( Composite parent ) { - Composite subComp = ControlFactory.createCompositeEx( parent, 1, GridData.FILL_HORIZONTAL ); - ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; - ((GridLayout)subComp.getLayout()).marginHeight = 0; - ((GridLayout)subComp.getLayout()).marginWidth = 0; - if ( fSolibSearchPathBlock != null ) { - fSolibSearchPathBlock.createControl( subComp ); - if ( fSolibSearchPathBlock instanceof Observable ) - ((Observable)fSolibSearchPathBlock).addObserver( this ); - } - if ( fAutoSolib ) { - fAutoSoLibButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.0" ) ); //$NON-NLS-1$ - fAutoSoLibButton.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent e ) { - updateButtons(); - changed(); - } - } ); - } - if ( fStopOnSolibEvents ) { - fStopOnSolibEventsButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.1" ) ); //$NON-NLS-1$ - fStopOnSolibEventsButton.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent e ) { - updateButtons(); - changed(); - } - } ); - } - fControl = subComp; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) - */ - @Override - public void initializeFrom( ILaunchConfiguration configuration ) { - if ( fSolibSearchPathBlock != null ) - fSolibSearchPathBlock.initializeFrom( configuration ); - try { - if ( fAutoSoLibButton != null ) - fAutoSoLibButton.setSelection( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT ) ); - if ( fStopOnSolibEventsButton != null ) - fStopOnSolibEventsButton.setSelection( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, IMILaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT ) ); - initializeButtons( configuration ); - updateButtons(); - } - catch( CoreException e ) { - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void performApply( ILaunchConfigurationWorkingCopy configuration ) { - if ( fSolibSearchPathBlock != null ) - fSolibSearchPathBlock.performApply( configuration ); - try { - Map attrs = configuration.getAttributes(); - if ( fAutoSoLibButton != null ) - attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, Boolean.valueOf( fAutoSoLibButton.getSelection() ) ); - if ( fStopOnSolibEventsButton != null ) - attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, Boolean.valueOf( fStopOnSolibEventsButton.getSelection() ) ); - configuration.setAttributes( attrs ); - } - catch( CoreException e ) { - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { - if ( fSolibSearchPathBlock != null ) - fSolibSearchPathBlock.setDefaults( configuration ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, IMILaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT ); - } - - protected void updateButtons() { - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#dispose() - */ - @Override - public void dispose() { - deleteObservers(); - if ( fSolibSearchPathBlock != null ) { - if ( fSolibSearchPathBlock instanceof Observable ) - ((Observable)fSolibSearchPathBlock).deleteObserver( this ); - fSolibSearchPathBlock.dispose(); - } - } - - /* - * (non-Javadoc) - * - * @see java.util.Observer#update(java.util.Observable, java.lang.Object) - */ - @Override - public void update( Observable o, Object arg ) { - changed(); - } - - protected void changed() { - setChanged(); - notifyObservers(); - } - - protected void initializeButtons( ILaunchConfiguration configuration ) { - try { - boolean enable = !ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, "" ) ); //$NON-NLS-1$ - if ( fAutoSoLibButton != null ) - fAutoSoLibButton.setEnabled( enable ); - if ( fStopOnSolibEventsButton != null ) - fStopOnSolibEventsButton.setEnabled( enable ); - } - catch( CoreException e ) { - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#getControl() - */ - @Override - public Control getControl() { - return fControl; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#isValid(org.eclipse.debug.core.ILaunchConfiguration) - */ - @Override - public boolean isValid( ILaunchConfiguration launchConfig ) { - // TODO Auto-generated method stub - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBTargetActionFilter.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBTargetActionFilter.java deleted file mode 100644 index 7b9d152bc89..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBTargetActionFilter.java +++ /dev/null @@ -1,35 +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.internal.ui; - -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.ui.IActionFilter; - -/** - * Comment for . - */ -public class GDBTargetActionFilter implements IActionFilter { - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String) - */ - @Override - public boolean testAttribute( Object target, String name, String value ) { - if ( target instanceof ICDebugTarget ) { - if ( name.equals( "GDBTargetActionFilter" ) && value.equals( "isGDBTarget" ) ) { //$NON-NLS-1$//$NON-NLS-2$ - return ( ((ICDebugTarget)target).getAdapter( ICDISession.class ) instanceof Session ); - } - } - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIHelpContextIds.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIHelpContextIds.java deleted file mode 100644 index 60f8ed427b8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIHelpContextIds.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.internal.ui; - -/** - * Help context ids for the C/C++ debug ui. - * <p> - * This interface contains constants only; it is not intended to be implemented or extended. - * </p> - */ -public interface IMIHelpContextIds { - - public static final String PREFIX = IMIUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$ - - // Preference pages - public static final String MI_PREFERENCE_PAGE = PREFIX + "mi_preference_page_context"; //$NON-NLS-1$ -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIUIConstants.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIUIConstants.java deleted file mode 100644 index fc8d73d242d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIUIConstants.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.internal.ui; - -/** - * Constant definitions for MI UI plug-in. - */ -public interface IMIUIConstants { - - /** - * Plug-in identifier (value <code>"org.eclipse.cdt.debug.mi.ui"</code>). - */ - public static final String PLUGIN_ID = MIUIPlugin.getUniqueIdentifier(); -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.java deleted file mode 100644 index 9fa393dcd06..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.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.internal.ui; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class MIUIMessages { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.MIUIMessages";//$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); - - private MIUIMessages() { - } - - 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.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties deleted file mode 100644 index 5e7d8234a3c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties +++ /dev/null @@ -1,75 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### - -CygwinDebuggerPage.0=Cygwin GDB Debugger Options -GDBDebuggerPage.0=Debugger executable must be specified. -GDBDebuggerPage.1=GDB Debugger Options -GDBDebuggerPage.2=Main -GDBDebuggerPage.3=GDB debugger: -GDBDebuggerPage.4=&Browse... -GDBDebuggerPage.5=GDB Debugger -GDBDebuggerPage.6=GDB command file: -GDBDebuggerPage.7=B&rowse... -GDBDebuggerPage.8=GDB Command File -GDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".) -GDBDebuggerPage.10=Shared Libraries -GDBDebuggerPage.11=Protocol: -GDBDebuggerPage.12=Default -StandardGDBDebuggerPage.0=Debugger executable must be specified. -StandardGDBDebuggerPage.1=GDB Debugger Options -StandardGDBDebuggerPage.2=Main -StandardGDBDebuggerPage.3=GDB debugger: -StandardGDBDebuggerPage.4=&Browse... -StandardGDBDebuggerPage.5=GDB Debugger -StandardGDBDebuggerPage.6=GDB command file: -StandardGDBDebuggerPage.7=B&rowse... -StandardGDBDebuggerPage.8=GDB Command File -StandardGDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".) -StandardGDBDebuggerPage.10=Shared Libraries -StandardGDBDebuggerPage.11=Protocol: -StandardGDBDebuggerPage.12=GDB command set: -StandardGDBDebuggerPage.13=Verbose console mode -StandardGDBDebuggerPage.14=Use full file path to set breakpoints -GDBServerDebuggerPage.0=TCP -GDBServerDebuggerPage.1=Serial -GDBServerDebuggerPage.10=Connection -GDBServerDebuggerPage.2=Main -GDBServerDebuggerPage.3=GDB debugger -GDBServerDebuggerPage.4=&Browse... -GDBServerDebuggerPage.5=GDB Debugger -GDBServerDebuggerPage.6=GDB command file: -GDBServerDebuggerPage.7=B&rowse... -GDBServerDebuggerPage.8=GDB Command File -GDBServerDebuggerPage.9=Type: -GDBSolibBlock.0=Load shared library symbols automatically -GDBSolibBlock.1=Stop on shared library events -SerialPortSettingsBlock.0=Device: -SerialPortSettingsBlock.1=Speed: -SerialPortSettingsBlock.2=Device must be specified. -SerialPortSettingsBlock.3=Invalid device. -SerialPortSettingsBlock.4=Speed must be specified. -SolibSearchPathBlock.0=Add... -SolibSearchPathBlock.1=Up -SolibSearchPathBlock.2=Down -SolibSearchPathBlock.3=Remove -SolibSearchPathBlock.4=Directories: -SolibSearchPathBlock.5=Select directory that contains shared library. -SolibSearchPathBlock.6=Select From List -SolibSearchPathBlock.7=Select Libraries -SolibSearchPathBlock.8=Select libraries to load symbols automatically. -SolibSearchPathBlock.9=No libraries found. -SolibSearchPathBlock.Add_Directory=Add Directory -TCPSettingsBlock.0=Host name or IP address: -TCPSettingsBlock.1=Port number: -TCPSettingsBlock.2=Host name or IP address must be specified. -TCPSettingsBlock.3=Invalid host name or IP address. -TCPSettingsBlock.4=Port number must be specified. -TCPSettingsBlock.5=Invalid port number. diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIPlugin.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIPlugin.java deleted file mode 100644 index b5de4edd239..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIPlugin.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.internal.ui; - -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * The main plugin class to be used in the desktop. - */ -public class MIUIPlugin extends AbstractUIPlugin { - - /** - * The plug-in identifier (value <code>"org.eclipse.cdt.debug.mi.ui"</code>). - */ - public static final String PLUGIN_ID = "org.eclipse.cdt.debug.mi.ui" ; //$NON-NLS-1$ - - //The shared instance. - private static MIUIPlugin plugin; - - /** - * The constructor. - */ - public MIUIPlugin() { - super(); - plugin = this; - } - - /** - * Returns the shared instance. - */ - public static MIUIPlugin getDefault() { - return plugin; - } - - /** - * Returns the workspace instance. - */ - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - /** - * Convenience method which returns the unique identifier of this plugin. - * - * @return the unique identifier of this plugin - */ - public static String getUniqueIdentifier() { - return PLUGIN_ID; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MinGWDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MinGWDebuggerPage.java deleted file mode 100644 index 6a05e687a99..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MinGWDebuggerPage.java +++ /dev/null @@ -1,67 +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.internal.ui; - -import java.io.File; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -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.Path; -import org.eclipse.debug.core.ILaunchConfiguration; - - - -/** - * @author Doug Schaefer - * - */ -public class MinGWDebuggerPage extends StandardGDBDebuggerPage { - - @Override - protected String defaultGdbCommand(ILaunchConfiguration configuration) { - // Lets look it up in the project - try { - String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$ - if (projectName.length() > 0) { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project); - ICConfigurationDescription configDesc = projDesc.getActiveConfiguration(); - IEnvironmentVariableManager envVarMgr = CCorePlugin.getDefault().getBuildEnvironmentManager(); - IEnvironmentVariable pathvar = envVarMgr.getVariable("PATH", configDesc, true); //$NON-NLS-1$ - if(pathvar != null) - { - String path = pathvar.getValue(); - String[] dirs = path.split(pathvar.getDelimiter()); - for (int i = 0; i < dirs.length; ++i) { - IPath gdbPath = new Path(dirs[i]).append("gdb.exe"); //$NON-NLS-1$ - File gdbFile = gdbPath.toFile(); - if (gdbFile.exists()) - return gdbPath.toOSString(); - } - } - } - } catch (CoreException e) { - } - - return super.defaultGdbCommand(configuration); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SWTUtil.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SWTUtil.java deleted file mode 100644 index 2f9e0c7e837..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SWTUtil.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.layout.PixelConverter; -import org.eclipse.core.runtime.Assert; -import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.DragSource; -import org.eclipse.swt.dnd.DropTarget; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Caret; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.ScrollBar; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Widget; - -/** - * Utility class to simplify access to some SWT resources. - */ -public class SWTUtil { - - /** - * Returns the standard display to be used. The method first checks, if the - * thread calling this method has an associated disaply. If so, this - * display is returned. Otherwise the method returns the default display. - */ - public static Display getStandardDisplay() { - Display display; - display = Display.getCurrent(); - if ( display == null ) - display = Display.getDefault(); - return display; - } - - /** - * Returns the shell for the given widget. If the widget doesn't represent - * a SWT object that manage a shell, <code>null</code> is returned. - * - * @return the shell for the given widget - */ - public static Shell getShell(Widget widget) { - if ( widget instanceof Control ) - return ((Control)widget).getShell(); - if ( widget instanceof Caret ) - return ((Caret)widget).getParent().getShell(); - if ( widget instanceof DragSource ) - return ((DragSource)widget).getControl().getShell(); - if ( widget instanceof DropTarget ) - return ((DropTarget)widget).getControl().getShell(); - if ( widget instanceof Menu ) - return ((Menu)widget).getParent().getShell(); - if ( widget instanceof ScrollBar ) - return ((ScrollBar)widget).getParent().getShell(); - return null; - } - - /** - * Returns a width hint for a button control. - */ - public static int getButtonWidthHint( Button button ) { - PixelConverter converter = new PixelConverter( button ); - int widthHint = converter.convertHorizontalDLUsToPixels( IDialogConstants.BUTTON_WIDTH ); - return Math.max( widthHint, button.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x ); - } - - /** - * Returns a height hint for a button control. - */ -// public static int getButtonHeigthHint( Button button ) { -// PixelConverter converter = new PixelConverter( button ); -// return converter.convertVerticalDLUsToPixels( IDialogConstants.BUTTON_HEIGHT ); -// } - - /** - * Sets width and height hint for the button control. <b>Note:</b> This - * is a NOP if the button's layout data is not an instance of <code>GridData</code>. - * - * @param the button for which to set the dimension hint - */ - public static void setButtonDimensionHint( Button button ) { - Assert.isNotNull( button ); - Object gd = button.getLayoutData(); - if ( gd instanceof GridData ) { - ((GridData)gd).widthHint = getButtonWidthHint( button ); - ((GridData)gd).horizontalAlignment = GridData.FILL; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SerialPortSettingsBlock.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SerialPortSettingsBlock.java deleted file mode 100644 index 6c2b32fc5ca..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SerialPortSettingsBlock.java +++ /dev/null @@ -1,208 +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.internal.ui; - -import java.util.Observable; - -import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ComboDialogField; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IDialogFieldListener; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.LayoutUtil; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.StringDialogField; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.layout.PixelConverter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -public class SerialPortSettingsBlock extends Observable { - - private final static String DEFAULT_ASYNC_DEVICE = "/dev/ttyS0"; //$NON-NLS-1$ - - private final static String DEFAULT_ASYNC_DEVICE_SPEED = "115200"; //$NON-NLS-1$ - - private Shell fShell; - - private StringDialogField fDeviceField; - - private ComboDialogField fSpeedField; - - private String fSpeedChoices[] = { "9600", "19200", "38400", "57600", "115200" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - - private Control fControl; - - private String fErrorMessage = null; - - public SerialPortSettingsBlock() { - super(); - fDeviceField = createDeviceField(); - fSpeedField = createSpeedField(); - } - - public void createBlock( Composite parent ) { - fShell = parent.getShell(); - Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH ); - ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; - ((GridLayout)comp.getLayout()).marginHeight = 0; - ((GridLayout)comp.getLayout()).marginWidth = 0; - comp.setFont( parent.getFont() ); - PixelConverter converter = new PixelConverter( comp ); - fDeviceField.doFillIntoGrid( comp, 2 ); - LayoutUtil.setWidthHint( fDeviceField.getTextControl( null ), converter.convertWidthInCharsToPixels( 20 ) ); - fSpeedField.doFillIntoGrid( comp, 2 ); - ((GridData)fSpeedField.getComboControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING; - setControl( comp ); - } - - protected Shell getShell() { - return fShell; - } - - public void dispose() { - deleteObservers(); - } - - public void initializeFrom( ILaunchConfiguration configuration ) { - initializeDevice( configuration ); - initializeSpeed( configuration ); - } - - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE ); - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED ); - } - - public void performApply( ILaunchConfigurationWorkingCopy configuration ) { - if ( fDeviceField != null ) - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, fDeviceField.getText().trim() ); - if ( fSpeedField != null ) { - int index = fSpeedField.getSelectionIndex(); - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, getSpeedItem( index ) ); - } - } - - private StringDialogField createDeviceField() { - StringDialogField field = new StringDialogField(); - field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.0" ) ); //$NON-NLS-1$ - field.setDialogFieldListener( new IDialogFieldListener() { - - @Override - public void dialogFieldChanged( DialogField f ) { - deviceFieldChanged(); - } - } ); - return field; - } - - private ComboDialogField createSpeedField() { - ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY ); - field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.1" ) ); //$NON-NLS-1$ - field.setItems( fSpeedChoices ); - field.setDialogFieldListener( new IDialogFieldListener() { - - @Override - public void dialogFieldChanged( DialogField f ) { - speedFieldChanged(); - } - } ); - return field; - } - - protected void deviceFieldChanged() { - updateErrorMessage(); - setChanged(); - notifyObservers(); - } - - protected void speedFieldChanged() { - updateErrorMessage(); - setChanged(); - notifyObservers(); - } - - private void initializeDevice( ILaunchConfiguration configuration ) { - if ( fDeviceField != null ) { - try { - fDeviceField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE ) ); - } - catch( CoreException e ) { - } - } - } - - private void initializeSpeed( ILaunchConfiguration configuration ) { - if ( fSpeedField != null ) { - int index = 0; - try { - index = getSpeedItemIndex( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED ) ); - } - catch( CoreException e ) { - } - fSpeedField.selectItem( index ); - } - } - - private String getSpeedItem( int index ) { - return (index >= 0 && index < fSpeedChoices.length) ? fSpeedChoices[index] : null; - } - - private int getSpeedItemIndex( String item ) { - for( int i = 0; i < fSpeedChoices.length; ++i ) - if ( fSpeedChoices[i].equals( item ) ) - return i; - return 0; - } - - public Control getControl() { - return fControl; - } - - protected void setControl( Control control ) { - fControl = control; - } - - public boolean isValid( ILaunchConfiguration configuration ) { - updateErrorMessage(); - return (getErrorMessage() == null); - } - - private void updateErrorMessage() { - setErrorMessage( null ); - if ( fDeviceField != null && fSpeedField != null ) { - if ( fDeviceField.getText().trim().length() == 0 ) - setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.2" ) ); //$NON-NLS-1$ - else if ( !deviceIsValid( fDeviceField.getText().trim() ) ) - setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.3" ) ); //$NON-NLS-1$ - else if ( fSpeedField.getSelectionIndex() < 0 ) - setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.4" ) ); //$NON-NLS-1$ - } - } - - public String getErrorMessage() { - return fErrorMessage; - } - - private void setErrorMessage( String string ) { - fErrorMessage = string; - } - - private boolean deviceIsValid( String hostName ) { - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.java deleted file mode 100644 index 82adc381f1a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.java +++ /dev/null @@ -1,622 +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 - * IBM Corporation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Observable; -import java.util.Set; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; -import org.eclipse.cdt.core.IBinaryParser.IBinaryShared; -import org.eclipse.cdt.core.model.CoreModelUtil; -import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.MICoreUtils; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IDialogFieldListener; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IListAdapter; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.LayoutUtil; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ListDialogField; -import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -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.Path; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.layout.PixelConverter; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog; - -/** - * The UI component to access the shared libraries search path. - */ -public class SolibSearchPathBlock extends Observable implements IMILaunchConfigurationComponent, IDialogFieldListener { - - class AddDirectoryDialog extends Dialog { - - protected Text fText; - - private Button fBrowseButton; - - private IPath fValue; - - /** - * Constructor for AddDirectoryDialog. - */ - public AddDirectoryDialog( Shell parentShell ) { - super( parentShell ); - } - - @Override - protected Control createDialogArea( Composite parent ) { - Composite composite = (Composite)super.createDialogArea( parent ); - - Composite subComp = ControlFactory.createCompositeEx( composite, 2, GridData.FILL_HORIZONTAL ); - ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; - GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER ); - data.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); - subComp.setLayoutData( data ); - subComp.setFont( parent.getFont() ); - - fText = new Text( subComp, SWT.SINGLE | SWT.BORDER ); - fText.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ) ); - fText.addModifyListener( new ModifyListener() { - - @Override - public void modifyText( ModifyEvent e ) { - updateOKButton(); - } - } ); - - fBrowseButton = ControlFactory.createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.7" ) ); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - fBrowseButton.setLayoutData( data ); - fBrowseButton.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent evt ) { - DirectoryDialog dialog = new DirectoryDialog( AddDirectoryDialog.this.getShell() ); - dialog.setMessage( MIUIMessages.getString( "SolibSearchPathBlock.5" ) ); //$NON-NLS-1$ - String res = dialog.open(); - if ( res != null ) { - fText.setText( res ); - } - } - } ); - - applyDialogFont( composite ); - return composite; - } - - @Override - protected void configureShell( Shell newShell ) { - super.configureShell( newShell ); - newShell.setText( MIUIMessages.getString( "SolibSearchPathBlock.Add_Directory" ) ); //$NON-NLS-1$ - } - - public IPath getValue() { - return fValue; - } - - private void setValue( String value ) { - fValue = ( value != null ) ? new Path( value ) : null; - } - - @Override - protected void buttonPressed( int buttonId ) { - if ( buttonId == IDialogConstants.OK_ID ) { - setValue( fText.getText() ); - } - else { - setValue( null ); - } - super.buttonPressed( buttonId ); - } - - protected void updateOKButton() { - Button okButton = getButton( IDialogConstants.OK_ID ); - String text = fText.getText(); - okButton.setEnabled( isValid( text ) ); - } - - protected boolean isValid( String text ) { - return ( text.trim().length() > 0 ); - } - - @Override - protected Control createButtonBar( Composite parent ) { - Control control = super.createButtonBar( parent ); - updateOKButton(); - return control; - } - } - - private Composite fControl; - - public class SolibSearchPathListDialogField extends ListDialogField { - - public SolibSearchPathListDialogField( IListAdapter adapter, String[] buttonLabels, ILabelProvider lprovider ) { - super( adapter, buttonLabels, lprovider ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField#managedButtonPressed(int) - */ - @Override - protected boolean managedButtonPressed( int index ) { - boolean result = super.managedButtonPressed( index ); - if ( result ) - buttonPressed( index ); - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ListDialogField#getManagedButtonState(org.eclipse.jface.viewers.ISelection, int) - */ - @Override - protected boolean getManagedButtonState( ISelection sel, int index ) { - if ( index > 3 ) - return getButtonState( sel, index ); - return super.getManagedButtonState( sel, index ); - } - } - - private static String[] fgStaticButtonLabels = new String[] { - MIUIMessages.getString( "SolibSearchPathBlock.0" ), //$NON-NLS-1$ - MIUIMessages.getString( "SolibSearchPathBlock.1" ), //$NON-NLS-1$ - MIUIMessages.getString( "SolibSearchPathBlock.2" ), //$NON-NLS-1$ - MIUIMessages.getString( "SolibSearchPathBlock.3" ), //$NON-NLS-1$ - MIUIMessages.getString( "SolibSearchPathBlock.6" ), //$NON-NLS-1$ - null, // separator - }; - - private IProject fProject; - - private Shell fShell; - - private SolibSearchPathListDialogField fDirList; - - private IListAdapter fCustomListAdapter; - - private File[] fAutoSolibs = new File[0]; - - public SolibSearchPathBlock() { - this( new String[0], null ); - } - - public SolibSearchPathBlock( String[] customButtonLabels, IListAdapter customListAdapter ) { - super(); - fCustomListAdapter = customListAdapter; - int length = fgStaticButtonLabels.length; - if ( customButtonLabels.length > 0 ) - length += customButtonLabels.length; - String[] buttonLabels = new String[length]; - System.arraycopy( fgStaticButtonLabels, 0, buttonLabels, 0, fgStaticButtonLabels.length ); - if ( length > fgStaticButtonLabels.length ) { - for ( int i = fgStaticButtonLabels.length; i < length; ++i ) - buttonLabels[i] = customButtonLabels[i - fgStaticButtonLabels.length]; - } - IListAdapter listAdapter = new IListAdapter() { - @Override - public void customButtonPressed( DialogField field, int index ) { - buttonPressed( index ); - } - @Override - public void selectionChanged( DialogField field ) { - } - }; - ILabelProvider lp = new LabelProvider() { - @Override - public String getText( Object element ) { - if ( element instanceof IPath ) - return ((IPath)element).toOSString(); - return super.getText( element ); - } - }; - fDirList = new SolibSearchPathListDialogField( listAdapter, buttonLabels, lp ); - fDirList.setLabelText( MIUIMessages.getString( "SolibSearchPathBlock.4" ) ); //$NON-NLS-1$ - fDirList.setUpButtonIndex( 1 ); - fDirList.setDownButtonIndex( 2 ); - fDirList.setRemoveButtonIndex( 3 ); - - fDirList.setDialogFieldListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#createControl(org.eclipse.swt.widgets.Composite) - */ - @Override - public void createControl( Composite parent ) { - fShell = parent.getShell(); - Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH ); - ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; - ((GridLayout)comp.getLayout()).marginHeight = 0; - ((GridLayout)comp.getLayout()).marginWidth = 0; - comp.setFont( parent.getFont() ); - PixelConverter converter = new PixelConverter( comp ); - fDirList.doFillIntoGrid( comp, 3 ); - LayoutUtil.setHorizontalSpan( fDirList.getLabelControl( null ), 2 ); - LayoutUtil.setWidthHint( fDirList.getLabelControl( null ), converter.convertWidthInCharsToPixels( 30 ) ); - LayoutUtil.setHorizontalGrabbing( fDirList.getListControl( null ) ); - fControl = comp; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) - */ - @Override - public void initializeFrom( ILaunchConfiguration configuration ) { - IProject project = null; - try { - String projectName = configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null ); - if ( projectName != null ) { - projectName = projectName.trim(); - if ( projectName.length() > 0 ) { - project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName ); - } - } - } - catch( CoreException e ) { - } - setProject( project ); - - if ( fDirList != null ) { - try { - List values = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST ); - ArrayList paths = new ArrayList( values.size() ); - Iterator it = values.iterator(); - while( it.hasNext() ) { - paths.add( new Path( (String)it.next() ) ); - } - fDirList.addElements( paths ); - } - catch( CoreException e ) { - } - } - - try { - fAutoSolibs = MICoreUtils.getAutoSolibs( configuration ); - } - catch( CoreException e ) { - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void performApply( ILaunchConfigurationWorkingCopy configuration ) { - if ( fDirList != null ) { - List elements = fDirList.getElements(); - ArrayList values = new ArrayList( elements.size() ); - Iterator it = elements.iterator(); - while( it.hasNext() ) { - values.add( ((IPath)it.next()).toOSString() ); - } - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, values ); - } - ArrayList autoLibs = new ArrayList( fAutoSolibs.length ); - for ( int i = 0; i < fAutoSolibs.length; ++i ) - autoLibs.add( fAutoSolibs[i].getPath() ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, autoLibs ); - } - - protected void buttonPressed( int index ) { - boolean changed = false; - if ( index == 0 ) { // Add button - changed = addDirectory(); - } - else if ( index == 4 ) { //Select from list - changed = selectFromList(); - } - else if ( index >= fgStaticButtonLabels.length && fCustomListAdapter != null ) { - fCustomListAdapter.customButtonPressed( fDirList, index ); - changed = true; - } - if ( changed ) { - setChanged(); - notifyObservers(); - } - } - - protected boolean getButtonState( ISelection sel, int index ) { - if ( index == 4 ) { // select from list - return ( !sel.isEmpty() ); - } - return true; - } - - protected Shell getShell() { - return fShell; - } - - protected DialogField getDirList(){ - return fDirList; - } - protected boolean addDirectory() { - boolean changed = false; - AddDirectoryDialog dialog = new AddDirectoryDialog( getShell() ); - dialog.open(); - IPath result = dialog.getValue(); - if ( result != null && !contains( result ) ) { - fDirList.addElement( result ); - changed = true; - } - return changed; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#dispose() - */ - @Override - public void dispose() { - deleteObservers(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#getControl() - */ - @Override - public Control getControl() { - return fControl; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#isValid(org.eclipse.debug.core.ILaunchConfiguration) - */ - @Override - public boolean isValid( ILaunchConfiguration launchConfig ) { - // TODO Auto-generated method stub - return false; - } - - protected boolean contains( IPath path ) { - List list = fDirList.getElements(); - Iterator it = list.iterator(); - while( it.hasNext() ) { - IPath p = (IPath)it.next(); - if ( p.toFile().equals( path.toFile() ) ) - return true; - } - return false; - } - - protected IProject getProject() { - return fProject; - } - - private void setProject( IProject project ) { - fProject = project; - } - - protected boolean selectFromList() { - boolean changed = false; - List dirList = fDirList.getSelectedElements(); - final HashSet libs = new HashSet( 10 ); - if ( generateLibraryList( (IPath[])dirList.toArray( new IPath[dirList.size()] ), libs ) ) { - ITreeContentProvider cp = new ITreeContentProvider() { - - @Override - public Object[] getChildren( Object parentElement ) { - return getElements( parentElement ); - } - - @Override - public Object getParent( Object element ) { - if ( libs.contains( element ) ) - return libs; - return null; - } - - @Override - public boolean hasChildren( Object element ) { - return false; - } - - @Override - public Object[] getElements( Object inputElement ) { - if ( inputElement instanceof Set ) { - return ((Set)inputElement).toArray(); - } - return new Object[0]; - } - - @Override - public void dispose() { - } - - @Override - public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) { - } - }; - - LabelProvider lp = new LabelProvider() { - - @Override - public String getText( Object element ) { - if ( element instanceof File ) - return ((File)element).getName(); - return super.getText( element ); - } - }; - CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog( getShell(), lp, cp ); - dialog.setTitle( MIUIMessages.getString( "SolibSearchPathBlock.7" ) ); //$NON-NLS-1$ - dialog.setMessage( MIUIMessages.getString( "SolibSearchPathBlock.8" ) ); //$NON-NLS-1$ - dialog.setEmptyListMessage( MIUIMessages.getString( "SolibSearchPathBlock.9" ) ); //$NON-NLS-1$ - dialog.setSorter( new ViewerSorter() ); - dialog.setInput( libs ); - dialog.setInitialElementSelections( Arrays.asList( fAutoSolibs ) ); - if ( dialog.open() == Window.OK ) { - Object[] result = dialog.getResult(); - fAutoSolibs = Arrays.asList( result ).toArray( new File[result.length] ); - changed = true; - } - } - return changed; - } - - private boolean generateLibraryList( final IPath[] paths, final Set libs ) { - boolean result = true; - - IRunnableWithProgress runnable = new IRunnableWithProgress() { - @Override - public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { - - for ( int i = 0; i < paths.length; ++i ) { - File dir = paths[i].toFile(); - if ( dir.exists() && dir.isDirectory() ) { - File[] all = dir.listFiles(); - for ( int j = 0; j < all.length; ++j ) { - if ( monitor.isCanceled() ) { - throw new InterruptedException(); - } - monitor.subTask( all[j].getPath() ); - String libName = getSharedLibraryName( all[j] ); - if ( libName != null ) { - libs.add( new File( libName ) ); - } - } - } - } - } - }; - try { - IRunnableContext context = new ProgressMonitorDialog( getShell() ); - context.run( true, true, runnable ); - } - catch( InvocationTargetException e ) { - } - catch( InterruptedException e ) { - result = false; - } - return result; - } - - protected String getSharedLibraryName( File file ) { - if ( !file.isFile() ) - return null; - IProject project = getProject(); - if ( project != null ) { - IPath fullPath = new Path( file.getPath() ); - try { - ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( project ); - for( int i = 0; i < binaryParsersExt.length; i++ ) { - IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); - try { - IBinaryFile bin = parser.getBinary( fullPath ); - if ( bin instanceof IBinaryShared ) { - String soname = ((IBinaryShared)bin).getSoName(); - return ( soname.length() != 0 ) ? soname : file.getName(); - } - } - catch( IOException e ) { - } - } - } - catch( CoreException e ) { - } - return null; - } - // no project: for now - IPath path = new Path( file.getPath() ); - String name = path.lastSegment(); - String extension = path.getFileExtension(); - if ( extension != null && (extension.compareTo( "so" ) == 0 || extension.compareToIgnoreCase( "dll" ) == 0) ) //$NON-NLS-1$ //$NON-NLS-2$ - return name; - return ( name.indexOf( ".so." ) >= 0 ) ? name : null; //$NON-NLS-1$ - } - - protected boolean isSharedLibrary( File file ) { - if ( !file.isFile() ) - return false; - IProject project = getProject(); - if ( project != null ) { - IPath fullPath = new Path( file.getPath() ); - try { - ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( project ); - for( int i = 0; i < binaryParsersExt.length; i++ ) { - IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); - try { - IBinaryFile bin = parser.getBinary( fullPath ); - return ( bin instanceof IBinaryShared ); - } - catch( IOException e ) { - } - } - } - catch( CoreException e ) { - } - return false; - } - // no project: for now - IPath path = new Path( file.getPath() ); - String extension = path.getFileExtension(); - if ( extension != null && (extension.compareTo( "so" ) == 0 || extension.compareToIgnoreCase( "dll" ) == 0) ) //$NON-NLS-1$ //$NON-NLS-2$ - return true; - String name = path.lastSegment(); - return ( name.indexOf( ".so." ) >= 0 ); //$NON-NLS-1$ - } - - @Override - public void dialogFieldChanged(DialogField field) { - setChanged(); - notifyObservers(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java deleted file mode 100644 index 9d8c36387e4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java +++ /dev/null @@ -1,558 +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 - * Vladimir Prus (vladimir@codesourcery.com) - bug 156114: GDB options layout - * problem - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Observable; -import java.util.Observer; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor; -import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent; -import org.eclipse.cdt.debug.mi.ui.MIUIUtils; -import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.cdt.utils.Platform; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Text; - -/** - * The dynamic tab for gdb-based debugger implementations. - */ -public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Observer { - - private final static String DEFAULT_MI_VERSION = "mi"; //$NON-NLS-1$ - - protected TabFolder fTabFolder; - - protected Text fGDBCommandText; - - protected Text fGDBInitText; - - protected Combo fCommandFactoryCombo; - - protected Combo fProtocolCombo; - - protected Button fVerboseModeButton; - protected Button fBreakpointsFullPath; - - private IMILaunchConfigurationComponent fSolibBlock; - - private CommandFactoryDescriptor[] fCommandFactoryDescriptors; - - private boolean fIsInitializing = false; - - private static boolean gdb64ExistsIsCached = false; - - private static boolean cachedGdb64Exists; - - @Override - public void createControl( Composite parent ) { - Composite comp = new Composite( parent, SWT.NONE ); - comp.setLayout( new GridLayout() ); - comp.setLayoutData( new GridData( GridData.FILL_BOTH ) ); - fTabFolder = new TabFolder( comp, SWT.NONE ); - fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) ); - createTabs( fTabFolder ); - fTabFolder.setSelection( 0 ); - setControl( parent ); - } - - @Override - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand(configuration)); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, MIPlugin.getDefault().getCommandFactoryManager().getDefaultDescriptor( getDebuggerIdentifier() ).getIdentifier() ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT ); - if ( fSolibBlock != null ) - fSolibBlock.setDefaults( configuration ); - } - - protected String defaultGdbCommand(ILaunchConfiguration configuration) { - String gdbCommand = null; - - if (Platform.getOS().equals(Platform.OS_LINUX) && - Platform.getOSArch().equals("ppc64")) { //$NON-NLS-1$ - // On SLES 9 and 10 for ppc64 arch, there is a separate - // 64-bit capable gdb called gdb64. It can - // also debug 32-bit executables, so let's see if it exists. - if (!gdb64ExistsIsCached) { - Process unameProcess; - int interruptedRetryCount = 5; - - String cmd[] = {"gdb64", "--version"}; //$NON-NLS-1$ //$NON-NLS-2$ - - gdb64ExistsIsCached = true; - - while (interruptedRetryCount >= 0) { - try { - unameProcess = Runtime.getRuntime().exec(cmd); - int exitStatus = unameProcess.waitFor(); - - cachedGdb64Exists = (exitStatus == 0); - break; - } catch (IOException e) { - cachedGdb64Exists = false; - break; - } catch (InterruptedException e) { - // Never should get here, really. The chances of the command being interrupted - // are very small - cachedGdb64Exists = false; - interruptedRetryCount--; - } - } - } - if (cachedGdb64Exists) { - gdbCommand = "gdb64"; //$NON-NLS-1$ - } else { - gdbCommand = IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT; - } - } else { - gdbCommand = IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT; - } - return gdbCommand; - } - - - @Override - public boolean isValid( ILaunchConfiguration launchConfig ) { - boolean valid = fGDBCommandText.getText().length() != 0; - if ( valid ) { - setErrorMessage( null ); - setMessage( null ); - } - else { - setErrorMessage( MIUIMessages.getString( "StandardGDBDebuggerPage.0" ) ); //$NON-NLS-1$ - setMessage( null ); - } - return valid; - } - - @Override - public void initializeFrom( ILaunchConfiguration configuration ) { - setInitializing( true ); - String gdbCommand = defaultGdbCommand(configuration); - String gdbInit = IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT; - try { - gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand(configuration)); - } - catch( CoreException e ) { - } - try { - gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT ); - } - catch( CoreException e ) { - } - if ( fSolibBlock != null ) - fSolibBlock.initializeFrom( configuration ); - fGDBCommandText.setText( gdbCommand ); - fGDBInitText.setText( gdbInit ); - - String debuggerID = getDebuggerIdentifier(); - fCommandFactoryDescriptors = MIPlugin.getDefault().getCommandFactoryManager().getDescriptors( debuggerID ); - Arrays.sort( fCommandFactoryDescriptors, - new Comparator() { - @Override - public int compare( Object arg0, Object arg1 ) { - return ((CommandFactoryDescriptor)arg0).getName().compareTo( ((CommandFactoryDescriptor)arg1).getName() ); - } - } ); - String[] descLabels = new String[fCommandFactoryDescriptors.length]; - String commandFactoryId = MIPlugin.getCommandFactory( configuration ); - int index = -1; - for( int i = 0; i < fCommandFactoryDescriptors.length; ++i ) { - descLabels[i] = fCommandFactoryDescriptors[i].getName(); - if ( fCommandFactoryDescriptors[i].getIdentifier().equals( commandFactoryId ) ) - index = i; - } - fCommandFactoryCombo.setItems( descLabels ); - if ( index < 0 ) { - index = 0; - } - - //It may be the case that we can't match up any identifier with any installed debuggers associated - //with this debuggerID (ie fCommandFactoryDescriptors.length == 0) for example when importing a - //launch from different environments that use CDT debugging. In this case we try and soldier on - //using the defaults as much as is realistic. - String[] miVersions = new String[0]; - if(index < fCommandFactoryDescriptors.length) { - fCommandFactoryCombo.select( index ); - miVersions = fCommandFactoryDescriptors[index].getMIVersions(); - } - fProtocolCombo.setItems( miVersions ); - if ( miVersions.length == 0 ) { - miVersions = new String[] { DEFAULT_MI_VERSION }; - } - String mi = DEFAULT_MI_VERSION; - try { - mi = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, DEFAULT_MI_VERSION ); - } - catch( CoreException e ) { - // use default - } - int miIndex = 0; - for ( int i = 0; i < miVersions.length; ++i ) { - if ( miVersions[i].equals( mi ) ) { - miIndex = i; - break; - } - } - fProtocolCombo.select( miIndex ); - boolean verboseMode = IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT; - try { - verboseMode = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT ); - } - catch( CoreException e ) { - // use default - } - fVerboseModeButton.setSelection( verboseMode ); - fBreakpointsFullPath.setSelection(getBreakpointsWithFullNameAttribute(configuration)); - // We've populated combos, which affects their preferred size, and so must relayout things. - Control changed[] = { fCommandFactoryCombo, fProtocolCombo }; - ((Composite) getControl()).layout( changed ); - - setInitializing( false ); - } - 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; - } - @Override - public void performApply( ILaunchConfigurationWorkingCopy configuration ) { - String str = fGDBCommandText.getText(); - str.trim(); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, str ); - str = fGDBInitText.getText(); - str.trim(); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, str ); - str = fCommandFactoryCombo.getText(); - int index = fCommandFactoryCombo.indexOf( str ); - str = ( index < 0 ) ? "" : fCommandFactoryDescriptors[index].getIdentifier(); //$NON-NLS-1$ - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, str ); - str = fProtocolCombo.getText(); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, str ); - if ( fSolibBlock != null ) - fSolibBlock.performApply( configuration ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, fVerboseModeButton.getSelection() ); - configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, fBreakpointsFullPath.getSelection() ); - } - - @Override - public String getName() { - return MIUIMessages.getString( "StandardGDBDebuggerPage.1" ); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell() - */ - @Override - protected Shell getShell() { - return super.getShell(); - } - - /** - * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog() - */ - @Override - protected void updateLaunchConfigurationDialog() { - super.updateLaunchConfigurationDialog(); - } - - /* - * (non-Javadoc) - * - * @see java.util.Observer#update(java.util.Observable, java.lang.Object) - */ - @Override - public void update( Observable o, Object arg ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - - public IMILaunchConfigurationComponent createSolibBlock( Composite parent ) { - IMILaunchConfigurationComponent block = MIUIUtils.createGDBSolibBlock( true, true ); - block.createControl( parent ); - return block; - } - - public void createTabs( TabFolder tabFolder ) { - createMainTab( tabFolder ); - createSolibTab( tabFolder ); - } - - public void createMainTab( TabFolder tabFolder ) { - TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); - tabItem.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.2" ) ); //$NON-NLS-1$ - Composite comp = ControlFactory.createCompositeEx( tabFolder, 1, GridData.FILL_BOTH ); - ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; - comp.setFont( tabFolder.getFont() ); - tabItem.setControl( comp ); - Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL ); - ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; - subComp.setFont( tabFolder.getFont() ); - Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.3" ) ); //$NON-NLS-1$ - GridData gd = new GridData(); -// gd.horizontalSpan = 2; - label.setLayoutData( gd ); - fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); - fGDBCommandText.addModifyListener( new ModifyListener() { - - @Override - public void modifyText( ModifyEvent evt ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - Button button = createPushButton( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.4" ), null ); //$NON-NLS-1$ - button.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent evt ) { - handleGDBButtonSelected(); - updateLaunchConfigurationDialog(); - } - - private void handleGDBButtonSelected() { - FileDialog dialog = new FileDialog( getShell(), SWT.NONE ); - dialog.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.5" ) ); //$NON-NLS-1$ - String gdbCommand = fGDBCommandText.getText().trim(); - int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator ); - if ( lastSeparatorIndex != -1 ) { - dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) ); - } - String res = dialog.open(); - if ( res == null ) { - return; - } - fGDBCommandText.setText( res ); - } - } ); - label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.6" ) ); //$NON-NLS-1$ - gd = new GridData(); -// gd.horizontalSpan = 2; - label.setLayoutData( gd ); - fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); - gd = new GridData( GridData.FILL_HORIZONTAL ); - fGDBInitText.setLayoutData( gd ); - fGDBInitText.addModifyListener( new ModifyListener() { - - @Override - public void modifyText( ModifyEvent evt ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - button = createPushButton( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.7" ), null ); //$NON-NLS-1$ - button.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent evt ) { - handleGDBInitButtonSelected(); - updateLaunchConfigurationDialog(); - } - - private void handleGDBInitButtonSelected() { - FileDialog dialog = new FileDialog( getShell(), SWT.NONE ); - dialog.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.8" ) ); //$NON-NLS-1$ - String gdbCommand = fGDBInitText.getText().trim(); - int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator ); - if ( lastSeparatorIndex != -1 ) { - dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) ); - } - String res = dialog.open(); - if ( res == null ) { - return; - } - fGDBInitText.setText( res ); - } - } ); - label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.9" ), //$NON-NLS-1$ - 200, SWT.DEFAULT, SWT.WRAP ); - gd = new GridData( GridData.FILL_HORIZONTAL ); - gd.horizontalSpan = 3; - gd.widthHint = 200; - label.setLayoutData( gd ); - - Composite options = ControlFactory.createCompositeEx( subComp, 2, GridData.FILL_HORIZONTAL ); - gd = new GridData( GridData.FILL_HORIZONTAL ); - gd.horizontalSpan = 3; - options.setLayoutData( gd ); - createCommandFactoryCombo( options ); - createProtocolCombo( options ); - createVerboseModeButton( subComp ); - createBreakpointFullPathName(subComp); - // fit options into 3-grid one per line - GridData gd1 = new GridData(); - gd1.horizontalSpan = 3; - fVerboseModeButton.setLayoutData(gd1); - GridData gd2 = new GridData(); - gd2.horizontalSpan = 3; - fBreakpointsFullPath.setLayoutData(gd2); - } - - public void createSolibTab( TabFolder tabFolder ) { - TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); - tabItem.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.10" ) ); //$NON-NLS-1$ - Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH ); - comp.setFont( tabFolder.getFont() ); - tabItem.setControl( comp ); - fSolibBlock = createSolibBlock( comp ); - if ( fSolibBlock instanceof Observable ) - ((Observable)fSolibBlock).addObserver( this ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose() - */ - @Override - public void dispose() { - if ( fSolibBlock != null ) { - if ( fSolibBlock instanceof Observable ) - ((Observable)fSolibBlock).deleteObserver( this ); - fSolibBlock.dispose(); - } - super.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void activated( ILaunchConfigurationWorkingCopy workingCopy ) { - // Override the default behavior - } - - protected boolean isInitializing() { - return fIsInitializing; - } - - private void setInitializing( boolean isInitializing ) { - fIsInitializing = isInitializing; - } - - protected void createCommandFactoryCombo( Composite parent ) { - Label label = new Label( parent, SWT.NONE ); - label.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.12" ) ); //$NON-NLS-1$ - fCommandFactoryCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN ); - fCommandFactoryCombo.addSelectionListener( new SelectionListener() { - - @Override - public void widgetDefaultSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - - @Override - public void widgetSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - } - - protected void createProtocolCombo( Composite parent ) { - Label label = new Label( parent, SWT.NONE ); - label.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.11" ) ); //$NON-NLS-1$ - fProtocolCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN ); - fProtocolCombo.addSelectionListener( new SelectionListener() { - - @Override - public void widgetDefaultSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - - @Override - public void widgetSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - } - - protected String getCurrentCommandFactoryID() { - String name = fCommandFactoryCombo.getText(); - for ( int i = 0; i < fCommandFactoryDescriptors.length; ++i ) { - if ( fCommandFactoryDescriptors[i].getName().equals( name ) ) { - return fCommandFactoryDescriptors[i].getIdentifier(); - } - } - return ""; //$NON-NLS-1$ - } - - protected void createVerboseModeButton( Composite parent ) { - fVerboseModeButton = createCheckButton( parent, MIUIMessages.getString( "StandardGDBDebuggerPage.13" ) ); //$NON-NLS-1$ - fVerboseModeButton.addSelectionListener( new SelectionListener() { - - @Override - public void widgetDefaultSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - - @Override - public void widgetSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - } - protected void createBreakpointFullPathName( Composite parent ) { - fBreakpointsFullPath = createCheckButton( parent, MIUIMessages.getString( "StandardGDBDebuggerPage.14" ) ); //$NON-NLS-1$ - - fBreakpointsFullPath.addSelectionListener( new SelectionListener() { - - @Override - public void widgetDefaultSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - - @Override - public void widgetSelected( SelectionEvent e ) { - if ( !isInitializing() ) - updateLaunchConfigurationDialog(); - } - } ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/TCPSettingsBlock.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/TCPSettingsBlock.java deleted file mode 100644 index 8f664a1fa5d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/TCPSettingsBlock.java +++ /dev/null @@ -1,201 +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.internal.ui; - -import java.util.Observable; - -import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IDialogFieldListener; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.LayoutUtil; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.StringDialogField; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.layout.PixelConverter; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -public class TCPSettingsBlock extends Observable { - - private final static String DEFAULT_HOST_NAME = "localhost"; //$NON-NLS-1$ - - private final static String DEFAULT_PORT_NUMBER = "10000"; //$NON-NLS-1$ - - private Shell fShell; - - private StringDialogField fHostNameField; - - private StringDialogField fPortNumberField; - - private Control fControl; - - private String fErrorMessage = null; - - public TCPSettingsBlock() { - super(); - fHostNameField = createHostNameField(); - fPortNumberField = createPortNumberField(); - } - - public void createBlock( Composite parent ) { - fShell = parent.getShell(); - Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH ); - ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; - ((GridLayout)comp.getLayout()).marginHeight = 0; - ((GridLayout)comp.getLayout()).marginWidth = 0; - comp.setFont( parent.getFont() ); - PixelConverter converter = new PixelConverter( comp ); - fHostNameField.doFillIntoGrid( comp, 2 ); - LayoutUtil.setWidthHint( fHostNameField.getTextControl( null ), converter.convertWidthInCharsToPixels( 20 ) ); - fPortNumberField.doFillIntoGrid( comp, 2 ); - ((GridData)fPortNumberField.getTextControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING; - LayoutUtil.setWidthHint( fPortNumberField.getTextControl( null ), converter.convertWidthInCharsToPixels( 10 ) ); - setControl( comp ); - } - - protected Shell getShell() { - return fShell; - } - - public void dispose() { - deleteObservers(); - } - - public void initializeFrom( ILaunchConfiguration configuration ) { - initializeHostName( configuration ); - initializePortNumber( configuration ); - } - - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME ); - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER ); - } - - public void performApply( ILaunchConfigurationWorkingCopy configuration ) { - if ( fHostNameField != null ) - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, fHostNameField.getText().trim() ); - if ( fPortNumberField != null ) - configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, fPortNumberField.getText().trim() ); - } - - private StringDialogField createHostNameField() { - StringDialogField field = new StringDialogField(); - field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.0" ) ); //$NON-NLS-1$ - field.setDialogFieldListener( new IDialogFieldListener() { - - @Override - public void dialogFieldChanged( DialogField f ) { - hostNameFieldChanged(); - } - } ); - return field; - } - - private StringDialogField createPortNumberField() { - StringDialogField field = new StringDialogField(); - field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.1" ) ); //$NON-NLS-1$ - field.setDialogFieldListener( new IDialogFieldListener() { - - @Override - public void dialogFieldChanged( DialogField f ) { - portNumberFieldChanged(); - } - } ); - return field; - } - - protected void hostNameFieldChanged() { - updateErrorMessage(); - setChanged(); - notifyObservers(); - } - - protected void portNumberFieldChanged() { - updateErrorMessage(); - setChanged(); - notifyObservers(); - } - - private void initializeHostName( ILaunchConfiguration configuration ) { - if ( fHostNameField != null ) { - try { - fHostNameField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME ) ); - } - catch( CoreException e ) { - } - } - } - - private void initializePortNumber( ILaunchConfiguration configuration ) { - if ( fPortNumberField != null ) { - try { - fPortNumberField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER ) ); - } - catch( CoreException e ) { - } - } - } - - public Control getControl() { - return fControl; - } - - protected void setControl( Control control ) { - fControl = control; - } - - public boolean isValid( ILaunchConfiguration configuration ) { - updateErrorMessage(); - return (getErrorMessage() == null); - } - - private void updateErrorMessage() { - setErrorMessage( null ); - if ( fHostNameField != null && fPortNumberField != null ) { - if ( fHostNameField.getText().trim().length() == 0 ) - setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.2" ) ); //$NON-NLS-1$ - else if ( !hostNameIsValid( fHostNameField.getText().trim() ) ) - setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.3" ) ); //$NON-NLS-1$ - else if ( fPortNumberField.getText().trim().length() == 0 ) - setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.4" ) ); //$NON-NLS-1$ - else if ( !portNumberIsValid( fPortNumberField.getText().trim() ) ) - setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.5" ) ); //$NON-NLS-1$ - } - } - - public String getErrorMessage() { - return fErrorMessage; - } - - private void setErrorMessage( String string ) { - fErrorMessage = string; - } - - private boolean hostNameIsValid( String hostName ) { - return true; - } - - private boolean portNumberIsValid( String portNumber ) { - try { - int port = Integer.parseInt( portNumber ); - return ( port > 0 && port <= 0xFFFF ); - } - catch( NumberFormatException e ) { - return false; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/ActionMessages.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/ActionMessages.java deleted file mode 100644 index 88b4e5ba22b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/ActionMessages.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.internal.ui.actions; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class ActionMessages { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.actions.ActionMessages";//$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); - - private ActionMessages() { - } - - 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.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/ActionMessages.properties deleted file mode 100644 index 5dd0f84d4fe..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/ActionMessages.properties +++ /dev/null @@ -1,13 +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 -############################################################################### - -SetAutoSolibActionDelegate.0=Exceptions occurred attempting to set 'Automatically Load Symbols' mode. -SetAutoSolibActionDelegate.1=Set 'Automatically Load Symbols' mode failed. diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/SetAutoSolibActionDelegate.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/SetAutoSolibActionDelegate.java deleted file mode 100644 index edb3e38cbdd..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/SetAutoSolibActionDelegate.java +++ /dev/null @@ -1,271 +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.internal.ui.actions; - -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.MIPlugin; -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.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; - -/** - * The delegate for the "Automatically Load Symbols" action. - */ -public class SetAutoSolibActionDelegate implements IViewActionDelegate, ISelectionListener, IPartListener { - - private IViewPart fView = null; - - private IAction fAction; - - private IStatus fStatus = null; - - /** - * Constructor for SetAutoSolibActionDelegate. - */ - public SetAutoSolibActionDelegate() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) - */ - @Override - public void init( IViewPart view ) { - fView = view; - view.getSite().getPage().addPartListener( this ); - view.getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection) - */ - @Override - public void selectionChanged( IWorkbenchPart part, ISelection selection ) { - if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) ) { - update( getAction() ); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(IAction) - */ - @Override - public void run( IAction action ) { - BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { - - @Override - public void run() { - try { - doAction( DebugUITools.getDebugContext() ); - setStatus( null ); - } - catch( DebugException e ) { - setStatus( e.getStatus() ); - } - } - } ); - if ( getStatus() != null && !getStatus().isOK() ) { - IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); - if ( window != null ) { - CDebugUIPlugin.errorDialog( getErrorDialogMessage(), getStatus() ); - } - else { - CDebugUIPlugin.log( getStatus() ); - } - } - update( action ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) - */ - @Override - public void selectionChanged( IAction action, ISelection selection ) { - setAction( action ); - if ( getView() != null ) { - update( action ); - } - } - - protected void update( IAction action ) { - if ( action != null ) { - IAdaptable element = DebugUITools.getDebugContext(); - action.setEnabled( getEnableStateForSelection( element ) ); - action.setChecked( getCheckStateForSelection( element ) ); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart) - */ - @Override - public void partActivated( IWorkbenchPart part ) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart) - */ - @Override - public void partBroughtToTop( IWorkbenchPart part ) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart) - */ - @Override - public void partClosed( IWorkbenchPart part ) { - if ( part.equals( getView() ) ) { - dispose(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart) - */ - @Override - public void partDeactivated( IWorkbenchPart part ) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart) - */ - @Override - public void partOpened( IWorkbenchPart part ) { - } - - protected IViewPart getView() { - return fView; - } - - protected void setView( IViewPart viewPart ) { - fView = viewPart; - } - - protected void setAction( IAction action ) { - fAction = action; - } - - protected IAction getAction() { - return fAction; - } - - protected void dispose() { - if ( getView() != null ) { - getView().getViewSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - getView().getViewSite().getPage().removePartListener( this ); - } - } - - protected boolean getCheckStateForSelection( IAdaptable element ) { - SharedLibraryManager slm = getSharedLibraryManager( element ); - Target target = getTarget(element); - if ( slm != null && target != null) { - try { - return slm.isAutoLoadSymbols(target); - } catch( CDIException e ) { - } - } - return false; - } - - protected boolean getEnableStateForSelection( IAdaptable element ) { - return (element instanceof IDebugElement && ((IDebugElement)element).getDebugTarget().isSuspended() && getSharedLibraryManager( element ) != null); - } - - protected String getStatusMessage() { - return ActionMessages.getString( "SetAutoSolibActionDelegate.0" ); //$NON-NLS-1$ - } - - protected String getErrorDialogMessage() { - return ActionMessages.getString( "SetAutoSolibActionDelegate.1" ); //$NON-NLS-1$ - } - - protected void setStatus( IStatus status ) { - fStatus = status; - } - - protected IStatus getStatus() { - return fStatus; - } - - protected void doAction( IAdaptable element ) throws DebugException { - if ( getView() == null ) - return; - SharedLibraryManager slm = getSharedLibraryManager( element ); - Target target = getTarget(element); - if ( slm != null && target != null && getAction() != null ) { - try { - slm.setAutoLoadSymbols( target, getAction().isChecked() ); - } - catch( CDIException e ) { - getAction().setChecked( !getAction().isChecked() ); - throw new DebugException( new Status( IStatus.ERROR, MIPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null ) ); - } - } - } - - private SharedLibraryManager getSharedLibraryManager( IAdaptable element ) { - if ( element != null ) { - ICDISession session = element.getAdapter( ICDISession.class ); - if ( session instanceof Session ) - return ((Session)session).getSharedLibraryManager(); - } - return null; - } - - private Target getTarget( IAdaptable element ) { - if (element != null) { - ICDITarget target = element.getAdapter( ICDITarget.class ); - if (target instanceof Target) { - return (Target)target; - } - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/VerboseModeActionDelegate.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/VerboseModeActionDelegate.java deleted file mode 100644 index c625d6157e8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/VerboseModeActionDelegate.java +++ /dev/null @@ -1,56 +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.internal.ui.actions; - -import org.eclipse.cdt.debug.mi.core.GDBProcess; -import org.eclipse.cdt.debug.mi.ui.console.VerboseModeChangedEvent; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.actions.ActionDelegate; - -public class VerboseModeActionDelegate extends ActionDelegate implements IObjectActionDelegate { - - private GDBProcess fProcess; - - /* (non-Javadoc) - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - @Override - public void setActivePart( IAction action, IWorkbenchPart targetPart ) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public void run( IAction action ) { - if ( fProcess != null ) { - boolean enabled = fProcess.getTarget().isVerboseModeEnabled(); - fProcess.getTarget().enableVerboseMode( !enabled ); - fProcess.getTarget().getMISession().notifyObservers(new VerboseModeChangedEvent(fProcess.getTarget().getMISession(),0)); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - @Override - public void selectionChanged( IAction action, ISelection selection ) { - IStructuredSelection s = (IStructuredSelection)selection; - fProcess = ( !s.isEmpty() ) ? (GDBProcess)s.getFirstElement() : null; - action.setEnabled( fProcess != null && !fProcess.isTerminated()); - action.setChecked( fProcess != null && fProcess.getTarget().isVerboseModeEnabled() ); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/CheckedListDialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/CheckedListDialogField.java deleted file mode 100644 index a618c15d9dc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/CheckedListDialogField.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Table; - -/** - * A list with checkboxes and a button bar. Typical buttons are 'Check All' and 'Uncheck All'. - * List model is independend of widget creation. - * DialogFields controls are: Label, List and Composite containing buttons. - */ -public class CheckedListDialogField extends ListDialogField { - - private int fCheckAllButtonIndex; - private int fUncheckAllButtonIndex; - - private List fCheckElements; - - public CheckedListDialogField(IListAdapter adapter, String[] customButtonLabels, ILabelProvider lprovider) { - super(adapter, customButtonLabels, lprovider); - fCheckElements= new ArrayList(); - - fCheckAllButtonIndex= -1; - fUncheckAllButtonIndex= -1; - } - - /** - * Sets the index of the 'check' button in the button label array passed in the constructor. - * The behaviour of the button marked as the check button will then be handled internally. - * (enable state, button invocation behaviour) - */ - public void setCheckAllButtonIndex(int checkButtonIndex) { - Assert.isTrue(checkButtonIndex < fButtonLabels.length); - fCheckAllButtonIndex= checkButtonIndex; - } - - /** - * Sets the index of the 'uncheck' button in the button label array passed in the constructor. - * The behaviour of the button marked as the uncheck button will then be handled internally. - * (enable state, button invocation behaviour) - */ - public void setUncheckAllButtonIndex(int uncheckButtonIndex) { - Assert.isTrue(uncheckButtonIndex < fButtonLabels.length); - fUncheckAllButtonIndex= uncheckButtonIndex; - } - - - /* - * @see ListDialogField#createTableViewer - */ - @Override - protected TableViewer createTableViewer(Composite parent) { - Table table= new Table(parent, SWT.CHECK + getListStyle()); - CheckboxTableViewer tableViewer= new CheckboxTableViewer(table); - tableViewer.addCheckStateListener(new ICheckStateListener() { - @Override - public void checkStateChanged(CheckStateChangedEvent e) { - doCheckStateChanged(e); - } - }); - return tableViewer; - } - - - /* - * @see ListDialogField#getListControl - */ - @Override - public Control getListControl(Composite parent) { - Control control= super.getListControl(parent); - if (parent != null) { - ((CheckboxTableViewer)fTable).setCheckedElements(fCheckElements.toArray()); - } - return control; - } - - /* - * @see DialogField#dialogFieldChanged - * Hooks in to get element changes to update check model. - */ - @Override - public void dialogFieldChanged() { - for (int i= fCheckElements.size() -1; i >= 0; i--) { - if (!fElements.contains(fCheckElements.get(i))) { - fCheckElements.remove(i); - } - } - super.dialogFieldChanged(); - } - - private void checkStateChanged() { - //call super and do not update check model - super.dialogFieldChanged(); - } - - /** - * Gets the checked elements. - */ - public List getCheckedElements() { - return new ArrayList(fCheckElements); - } - - /** - * Returns true if the element is checked. - */ - public boolean isChecked(Object obj) { - return fCheckElements.contains(obj); - } - - /** - * Sets the checked elements. - */ - public void setCheckedElements(List list) { - fCheckElements= new ArrayList(list); - if (fTable != null) { - ((CheckboxTableViewer)fTable).setCheckedElements(list.toArray()); - } - checkStateChanged(); - } - - /** - * Sets the checked state of an element. - */ - public void setChecked(Object object, boolean state) { - setCheckedWithoutUpdate(object, state); - checkStateChanged(); - } - - /** - * Sets the checked state of an element. no dialog changed listener informed - */ - public void setCheckedWithoutUpdate(Object object, boolean state) { - if (state) { - if (!fCheckElements.contains(object)) { - fCheckElements.add(object); - } - } - else { - if (fCheckElements.contains(object)) { - fCheckElements.remove(object); - } - } - if (fTable != null) { - ((CheckboxTableViewer)fTable).setChecked(object, state); - } - } - - /** - * Sets the check state of all elements - */ - public void checkAll(boolean state) { - if (state) { - fCheckElements= getElements(); - } else { - fCheckElements.clear(); - } - if (fTable != null) { - ((CheckboxTableViewer)fTable).setAllChecked(state); - } - checkStateChanged(); - } - - - protected void doCheckStateChanged(CheckStateChangedEvent e) { - if (e.getChecked()) { - fCheckElements.add(e.getElement()); - } else { - fCheckElements.remove(e.getElement()); - } - checkStateChanged(); - } - - // ------ enable / disable management - - /* - * @see ListDialogField#getManagedButtonState - */ - @Override - protected boolean getManagedButtonState(ISelection sel, int index) { - if (index == fCheckAllButtonIndex) { - return !fElements.isEmpty(); - } else if (index == fUncheckAllButtonIndex) { - return !fElements.isEmpty(); - } - return super.getManagedButtonState(sel, index); - } - - /* - * @see ListDialogField#extraButtonPressed - */ - @Override - protected boolean managedButtonPressed(int index) { - if (index == fCheckAllButtonIndex) { - checkAll(true); - } else if (index == fUncheckAllButtonIndex) { - checkAll(false); - } else { - return super.managedButtonPressed(index); - } - return true; - } - - - - - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/ComboDialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/ComboDialogField.java deleted file mode 100644 index 3fe817d9405..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/ComboDialogField.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; - -/** - * Dialog field containing a label and a combo control. - */ -public class ComboDialogField extends DialogField { - - private String fText; - private int fSelectionIndex; - private String[] fItems; - private Combo fComboControl; - private ModifyListener fModifyListener; - private int fFlags; - - public ComboDialogField(int flags) { - super(); - fText= ""; //$NON-NLS-1$ - fItems= new String[0]; - fFlags= flags; - fSelectionIndex= -1; - } - - // ------- layout helpers - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - assertEnoughColumns(nColumns); - - Label label= getLabelControl(parent); - label.setLayoutData(gridDataForLabel(1)); - Combo combo= getComboControl(parent); - combo.setLayoutData(gridDataForCombo(nColumns - 1)); - - return new Control[] { label, combo }; - } - - /* - * @see DialogField#getNumberOfControls - */ - @Override - public int getNumberOfControls() { - return 2; - } - - protected static GridData gridDataForCombo(int span) { - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= false; - gd.horizontalSpan= span; - return gd; - } - - // ------- focus methods - - /* - * @see DialogField#setFocus - */ - @Override - public boolean setFocus() { - if (isOkToUse(fComboControl)) { - fComboControl.setFocus(); - } - return true; - } - - // ------- ui creation - - /** - * Creates or returns the created combo control. - * @param parent The parent composite or <code>null</code> when the widget has - * already been created. - */ - public Combo getComboControl(Composite parent) { - if (fComboControl == null) { - assertCompositeNotNull(parent); - fModifyListener= new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - doModifyText(e); - } - }; - SelectionListener selectionListener= new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - doSelectionChanged(e); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }; - - fComboControl= new Combo(parent, fFlags); - // moved up due to 1GEUNW2 - fComboControl.setItems(fItems); - if (fSelectionIndex != -1) { - fComboControl.select(fSelectionIndex); - } else { - fComboControl.setText(fText); - } - fComboControl.setFont(parent.getFont()); - fComboControl.addModifyListener(fModifyListener); - fComboControl.addSelectionListener(selectionListener); - fComboControl.setEnabled(isEnabled()); - } - return fComboControl; - } - - protected void doModifyText(ModifyEvent e) { - if (isOkToUse(fComboControl)) { - fText= fComboControl.getText(); - fSelectionIndex= fComboControl.getSelectionIndex(); - } - dialogFieldChanged(); - } - - protected void doSelectionChanged(SelectionEvent e) { - if (isOkToUse(fComboControl)) { - fItems= fComboControl.getItems(); - fText= fComboControl.getText(); - fSelectionIndex= fComboControl.getSelectionIndex(); - } - dialogFieldChanged(); - } - - // ------ enable / disable management - - /* - * @see DialogField#updateEnableState - */ - @Override - protected void updateEnableState() { - super.updateEnableState(); - if (isOkToUse(fComboControl)) { - fComboControl.setEnabled(isEnabled()); - } - } - - // ------ text access - - /** - * Gets the combo items. - */ - public String[] getItems() { - return fItems; - } - - /** - * Sets the combo items. Triggers a dialog-changed event. - */ - public void setItems(String[] items) { - fItems= items; - if (isOkToUse(fComboControl)) { - fComboControl.setItems(items); - } - dialogFieldChanged(); - } - - /** - * Gets the text. - */ - public String getText() { - return fText; - } - - /** - * Sets the text. Triggers a dialog-changed event. - */ - public void setText(String text) { - fText= text; - if (isOkToUse(fComboControl)) { - fComboControl.setText(text); - } else { - dialogFieldChanged(); - } - } - - /** - * Selects an item. - */ - public void selectItem(int index) { - if (isOkToUse(fComboControl)) { - fComboControl.select(index); - fSelectionIndex= index; - } else { - if (index >= 0 && index < fItems.length) { - fText= fItems[index]; - fSelectionIndex= index; - } - } - dialogFieldChanged(); - } - - public int getSelectionIndex() { - return fSelectionIndex; - } - - - /** - * Sets the text without triggering a dialog-changed event. - */ - public void setTextWithoutUpdate(String text) { - fText= text; - if (isOkToUse(fComboControl)) { - fComboControl.removeModifyListener(fModifyListener); - fComboControl.setText(text); - fComboControl.addModifyListener(fModifyListener); - } - } - - public void dispose() { - if (fComboControl != null) fComboControl.dispose(); - if (fItems != null) fItems = null; - if (fModifyListener != null) fModifyListener = null; - super.dispose(); - } - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/DialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/DialogField.java deleted file mode 100644 index 9d5f4ca51ad..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/DialogField.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2014 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 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -/** - * Base class of all dialog fields. - * Dialog fields manage controls together with the model, independed - * from the creation time of the widgets. - * - support for automated layouting. - * - enable / disable, set focus a concept of the base class. - * - * DialogField have a label. - */ -public class DialogField { - - private Label fLabel; - protected String fLabelText; - - private IDialogFieldListener fDialogFieldListener; - - private boolean fEnabled; - - public DialogField() { - fEnabled= true; - fLabel= null; - fLabelText= ""; //$NON-NLS-1$ - } - - /** - * Sets the label of the dialog field. - */ - public void setLabelText(String labeltext) { - fLabelText= labeltext; - } - - // ------ change listener - - /** - * Defines the listener for this dialog field. - */ - public final void setDialogFieldListener(IDialogFieldListener listener) { - fDialogFieldListener= listener; - } - - /** - * Programatical invocation of a dialog field change. - */ - public void dialogFieldChanged() { - if (fDialogFieldListener != null) { - fDialogFieldListener.dialogFieldChanged(this); - } - } - - // ------- focus management - - /** - * Tries to set the focus to the dialog field. - * Returns <code>true</code> if the dialog field can take focus. - * To be reimplemented by dialog field implementors. - */ - public boolean setFocus() { - return false; - } - - /** - * Posts <code>setFocus</code> to the display event queue. - */ - public void postSetFocusOnDialogField(Display display) { - if (display != null) { - display.asyncExec( - new Runnable() { - @Override - public void run() { - setFocus(); - } - } - ); - } - } - - // ------- layout helpers - - /** - * Creates all controls of the dialog field and fills it to a composite. - * The composite is assumed to have <code>MGridLayout</code> as - * layout. - * The dialog field will adjust its controls' spans to the number of columns given. - * To be reimplemented by dialog field implementors. - */ - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - assertEnoughColumns(nColumns); - - Label label= getLabelControl(parent); - label.setLayoutData(gridDataForLabel(nColumns)); - - return new Control[] { label }; - } - - /** - * Returns the number of columns of the dialog field. - * To be reimplemented by dialog field implementors. - */ - public int getNumberOfControls() { - return 1; - } - - protected static GridData gridDataForLabel(int span) { - GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan= span; - return gd; - } - - // ------- ui creation - - /** - * Creates or returns the created label widget. - * @param parent The parent composite or <code>null</code> if the widget has - * already been created. - */ - public Label getLabelControl(Composite parent) { - if (fLabel == null) { - assertCompositeNotNull(parent); - - fLabel= new Label(parent, SWT.LEFT | SWT.WRAP); - fLabel.setFont(parent.getFont()); - fLabel.setEnabled(fEnabled); - if (fLabelText != null && !"".equals(fLabelText)) { //$NON-NLS-1$ - fLabel.setText(fLabelText); - } else { - // XXX: to avoid a 16 pixel wide empty label - revisit - fLabel.setText("."); //$NON-NLS-1$ - fLabel.setVisible(false); - } - } - return fLabel; - } - - /** - * Creates a spacer control. - * - * @param parent The parent composite - */ - public static Control createEmptySpace(Composite parent) { - return createEmptySpace(parent, 1); - } - - /** - * Creates a spacer control with the given span. - * The composite is assumed to have {@link GridLayout} as layout. - * - * @param parent The parent composite - */ - public static Control createEmptySpace(Composite parent, int span) { - Label label= new Label(parent, SWT.LEFT); - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.BEGINNING; - gd.grabExcessHorizontalSpace= false; - gd.horizontalSpan= span; - gd.horizontalIndent= 0; - gd.widthHint= 0; - gd.heightHint= 0; - label.setLayoutData(gd); - return label; - } - - /** - * Tests is the control is not <code>null</code> and not disposed. - */ - protected final boolean isOkToUse(Control control) { - return (control != null) && !(control.isDisposed()); - } - - // --------- enable / disable management - - /** - * Sets the enable state of the dialog field. - */ - public final void setEnabled(boolean enabled) { - if (enabled != fEnabled) { - fEnabled= enabled; - updateEnableState(); - } - } - - /** - * Called when the enable state changed. - * To be extended by dialog field implementors. - */ - protected void updateEnableState() { - if (fLabel != null) { - fLabel.setEnabled(fEnabled); - } - } - - /** - * Gets the enable state of the dialog field. - */ - public final boolean isEnabled() { - return fEnabled; - } - - protected final void assertCompositeNotNull(Composite comp) { - Assert.isNotNull(comp, "uncreated control requested with composite null"); //$NON-NLS-1$ - } - - protected final void assertEnoughColumns(int nColumns) { - Assert.isTrue(nColumns >= getNumberOfControls(), "given number of columns is too small"); //$NON-NLS-1$ - } - - public void dispose() { - if (fLabel != null) fLabel.dispose(); - if (fDialogFieldListener != null) fDialogFieldListener = null; - } - - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IDialogFieldListener.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IDialogFieldListener.java deleted file mode 100644 index f170d4ca469..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IDialogFieldListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -/** - * Change listener used by <code>DialogField</code> - */ -public interface IDialogFieldListener { - - /** - * The dialog field has changed. - */ - void dialogFieldChanged(DialogField field); - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IListAdapter.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IListAdapter.java deleted file mode 100644 index 7f7a841a6fc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IListAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -/** - * Change listener used by <code>ListDialogField</code> and <code>CheckedListDialogField</code> - */ -public interface IListAdapter { - - /** - * A button from the button bar has been pressed. - */ - void customButtonPressed(DialogField field, int index); - - /** - * The selection of the list has changed. - */ - void selectionChanged(DialogField field); - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IStringButtonAdapter.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IStringButtonAdapter.java deleted file mode 100644 index b65936e45d9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/IStringButtonAdapter.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -/** - * Change listener used by <code>StringButtonDialogField</code> - */ -public interface IStringButtonAdapter { - - void changeControlPressed(DialogField field); - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/LayoutUtil.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/LayoutUtil.java deleted file mode 100644 index 155b57d79b2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/LayoutUtil.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public class LayoutUtil { - - /** - * Calculates the number of columns needed by field editors - */ - public static int getNumberOfColumns(DialogField[] editors) { - int nCulumns= 0; - for (int i= 0; i < editors.length; i++) { - nCulumns= Math.max(editors[i].getNumberOfControls(), nCulumns); - } - return nCulumns; - } - - /** - * Creates a composite and fills in the given editors. - * @param labelOnTop Defines if the label of all fields should be on top of the fields - */ - public static void doDefaultLayout(Composite parent, DialogField[] editors, boolean labelOnTop) { - doDefaultLayout(parent, editors, labelOnTop, 0, 0, 0, 0); - } - - /** - * Creates a composite and fills in the given editors. - * @param labelOnTop Defines if the label of all fields should be on top of the fields - * @param minWidth The minimal width of the composite - * @param minHeight The minimal height of the composite - */ - public static void doDefaultLayout(Composite parent, DialogField[] editors, boolean labelOnTop, int minWidth, int minHeight) { - doDefaultLayout(parent, editors, labelOnTop, minWidth, minHeight, 0, 0); - } - - /** - * Creates a composite and fills in the given editors. - * @param labelOnTop Defines if the label of all fields should be on top of the fields - * @param minWidth The minimal width of the composite - * @param minHeight The minimal height of the composite - * @param marginWidth The margin width to be used by the composite - * @param marginHeight The margin height to be used by the composite - * @deprecated - */ - @Deprecated - public static void doDefaultLayout(Composite parent, DialogField[] editors, boolean labelOnTop, int minWidth, int minHeight, int marginWidth, int marginHeight) { - int nCulumns= getNumberOfColumns(editors); - Control[][] controls= new Control[editors.length][]; - for (int i= 0; i < editors.length; i++) { - controls[i]= editors[i].doFillIntoGrid(parent, nCulumns); - } - if (labelOnTop) { - nCulumns--; - modifyLabelSpans(controls, nCulumns); - } - GridLayout layout= new GridLayout(); - if (marginWidth != SWT.DEFAULT) { - layout.marginWidth= marginWidth; - } - if (marginHeight != SWT.DEFAULT) { - layout.marginHeight= marginHeight; - } - layout.numColumns= nCulumns; - parent.setLayout(layout); - } - - private static void modifyLabelSpans(Control[][] controls, int nCulumns) { - for (int i= 0; i < controls.length; i++) { - setHorizontalSpan(controls[i][0], nCulumns); - } - } - - /** - * Sets the span of a control. Assumes that GridData is used. - */ - public static void setHorizontalSpan(Control control, int span) { - Object ld= control.getLayoutData(); - if (ld instanceof GridData) { - ((GridData)ld).horizontalSpan= span; - } else if (span != 1) { - GridData gd= new GridData(); - gd.horizontalSpan= span; - control.setLayoutData(gd); - } - } - - /** - * Sets the width hint of a control. Assumes that GridData is used. - */ - public static void setWidthHint(Control control, int widthHint) { - Object ld= control.getLayoutData(); - if (ld instanceof GridData) { - ((GridData)ld).widthHint= widthHint; - } - } - - /** - * Sets the heigthHint hint of a control. Assumes that GridData is used. - */ - public static void setHeigthHint(Control control, int heigthHint) { - Object ld= control.getLayoutData(); - if (ld instanceof GridData) { - ((GridData)ld).heightHint= heigthHint; - } - } - - /** - * Sets the horizontal indent of a control. Assumes that GridData is used. - */ - public static void setHorizontalIndent(Control control, int horizontalIndent) { - Object ld= control.getLayoutData(); - if (ld instanceof GridData) { - ((GridData)ld).horizontalIndent= horizontalIndent; - } - } - - /** - * Sets the horizontal indent of a control. Assumes that GridData is used. - */ - public static void setHorizontalGrabbing(Control control) { - Object ld= control.getLayoutData(); - if (ld instanceof GridData) { - ((GridData)ld).grabExcessHorizontalSpace= true; - } - } - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/ListDialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/ListDialogField.java deleted file mode 100644 index e1d8dc168b9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/ListDialogField.java +++ /dev/null @@ -1,783 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.debug.mi.internal.ui.SWTUtil; -import org.eclipse.jface.layout.PixelConverter; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; - -/** - * A list with a button bar. - * Typical buttons are 'Add', 'Remove', 'Up' and 'Down'. - * List model is independend of widget creation. - * DialogFields controls are: Label, List and Composite containing buttons. - */ -public class ListDialogField extends DialogField { - - protected TableViewer fTable; - protected ILabelProvider fLabelProvider; - protected ListViewerAdapter fListViewerAdapter; - protected List fElements; - protected ViewerSorter fViewerSorter; - - protected String[] fButtonLabels; - private Button[] fButtonControls; - - private boolean[] fButtonsEnabled; - - private int fRemoveButtonIndex; - private int fUpButtonIndex; - private int fDownButtonIndex; - - private Label fLastSeparator; - - protected Table fTableControl; - private Composite fButtonsControl; - private ISelection fSelectionWhenEnabled; - - private IListAdapter fListAdapter; - - private Object fParentElement; - - /** - * Creates the <code>ListDialogField</code>. - * @param adapter A listener for button invocation, selection changes. - * @param buttonLabels The labels of all buttons: <code>null</code> is a valid array entry and - * marks a separator. - * @param lprovider The label provider to render the table entries - */ - public ListDialogField(IListAdapter adapter, String[] buttonLabels, ILabelProvider lprovider) { - super(); - fListAdapter= adapter; - - fLabelProvider= lprovider; - fListViewerAdapter= new ListViewerAdapter(); - fParentElement= this; - - fElements= new ArrayList(10); - - fButtonLabels= buttonLabels; - if (fButtonLabels != null) { - int nButtons= fButtonLabels.length; - fButtonsEnabled= new boolean[nButtons]; - for (int i= 0; i < nButtons; i++) { - fButtonsEnabled[i]= true; - } - } - - fTable= null; - fTableControl= null; - fButtonsControl= null; - - fRemoveButtonIndex= -1; - fUpButtonIndex= -1; - fDownButtonIndex= -1; - } - - /** - * Sets the index of the 'remove' button in the button label array passed in the constructor. - * The behaviour of the button marked as the 'remove' button will then be handled internally. - * (enable state, button invocation behaviour) - */ - public void setRemoveButtonIndex(int removeButtonIndex) { - Assert.isTrue(removeButtonIndex < fButtonLabels.length); - fRemoveButtonIndex= removeButtonIndex; - } - - /** - * Sets the index of the 'up' button in the button label array passed in the constructor. - * The behaviour of the button marked as the 'up' button will then be handled internally. - * (enable state, button invocation behaviour) - */ - public void setUpButtonIndex(int upButtonIndex) { - Assert.isTrue(upButtonIndex < fButtonLabels.length); - fUpButtonIndex= upButtonIndex; - } - - /** - * Sets the index of the 'down' button in the button label array passed in the constructor. - * The behaviour of the button marked as the 'down' button will then be handled internally. - * (enable state, button invocation behaviour) - */ - public void setDownButtonIndex(int downButtonIndex) { - Assert.isTrue(downButtonIndex < fButtonLabels.length); - fDownButtonIndex= downButtonIndex; - } - - /** - * Sets the viewerSorter. - * @param viewerSorter The viewerSorter to set - */ - public void setViewerSorter(ViewerSorter viewerSorter) { - fViewerSorter= viewerSorter; - } - - // ------ adapter communication - - private void buttonPressed(int index) { - if (!managedButtonPressed(index)) { - fListAdapter.customButtonPressed(this, index); - } - } - - /** - * Checks if the button pressed is handled internally - * @return Returns true if button has been handled. - */ - protected boolean managedButtonPressed(int index) { - if (index == fRemoveButtonIndex) { - remove(); - } else if (index == fUpButtonIndex) { - up(); - } else if (index == fDownButtonIndex) { - down(); - } else { - return false; - } - return true; - } - - - // ------ layout helpers - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - PixelConverter converter= new PixelConverter(parent); - - assertEnoughColumns(nColumns); - - Label label= getLabelControl(parent); - GridData gd= gridDataForLabel(1); - gd.verticalAlignment= GridData.BEGINNING; - label.setLayoutData(gd); - - Control list= getListControl(parent); - gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= false; - gd.verticalAlignment= GridData.FILL; - gd.grabExcessVerticalSpace= true; - gd.horizontalSpan= nColumns - 2; - gd.widthHint= converter.convertWidthInCharsToPixels(50); - gd.heightHint= converter.convertHeightInCharsToPixels(6); - - list.setLayoutData(gd); - - Composite buttons= getButtonBox(parent); - gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= false; - gd.verticalAlignment= GridData.FILL; - gd.grabExcessVerticalSpace= true; - gd.horizontalSpan= 1; - buttons.setLayoutData(gd); - - return new Control[] { label, list, buttons }; - } - - /* - * @see DialogField#getNumberOfControls - */ - @Override - public int getNumberOfControls() { - return 3; - } - - /** - * Sets the minimal width of the buttons. Must be called after widget creation. - */ - public void setButtonsMinWidth(int minWidth) { - if (fLastSeparator != null) { - ((GridData)fLastSeparator.getLayoutData()).widthHint= minWidth; - } - } - - - // ------ ui creation - - /** - * Returns the list control. When called the first time, the control will be created. - * @param The parent composite when called the first time, or <code>null</code> - * after. - */ - public Control getListControl(Composite parent) { - if (fTableControl == null) { - assertCompositeNotNull(parent); - - fTable= createTableViewer(parent); - fTable.setContentProvider(fListViewerAdapter); - fTable.setLabelProvider(fLabelProvider); - fTable.addSelectionChangedListener(fListViewerAdapter); - - fTableControl= (Table)fTable.getControl(); - - fTable.setInput(fParentElement); - - if (fViewerSorter != null) { - fTable.setSorter(fViewerSorter); - } - - fTableControl.setEnabled(isEnabled()); - if (fSelectionWhenEnabled != null) { - postSetSelection(fSelectionWhenEnabled); - } - } - return fTableControl; - } - - /** - * Returns the internally used table viewer. - */ - public TableViewer getTableViewer() { - return fTable; - } - - /* - * Subclasses may override to specify a different style. - */ - protected int getListStyle(){ - return SWT.BORDER + SWT.MULTI + SWT.H_SCROLL + SWT.V_SCROLL; - } - - protected TableViewer createTableViewer(Composite parent) { - Table table= new Table(parent, getListStyle()); - return new TableViewer(table); - } - - protected Button createButton(Composite parent, String label, SelectionListener listener) { - Button button= new Button(parent, SWT.PUSH); - button.setText(label); - button.addSelectionListener(listener); - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= true; - gd.verticalAlignment= GridData.BEGINNING; - gd.widthHint = SWTUtil.getButtonWidthHint(button); - - button.setLayoutData(gd); - return button; - } - - private Label createSeparator(Composite parent) { - Label separator= new Label(parent, SWT.NONE); - separator.setVisible(false); - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.verticalAlignment= GridData.BEGINNING; - gd.heightHint= 4; - separator.setLayoutData(gd); - return separator; - } - - /** - * Returns the composite containing the buttons. When called the first time, the control - * will be created. - * @param The parent composite when called the first time, or <code>null</code> - * after. - */ - public Composite getButtonBox(Composite parent) { - if (fButtonsControl == null) { - assertCompositeNotNull(parent); - - SelectionListener listener= new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - doButtonSelected(e); - } - @Override - public void widgetSelected(SelectionEvent e) { - doButtonSelected(e); - } - }; - - Composite contents= new Composite(parent, SWT.NULL); - GridLayout layout= new GridLayout(); - layout.marginWidth= 0; - layout.marginHeight= 0; - contents.setLayout(layout); - - if (fButtonLabels != null) { - fButtonControls= new Button[fButtonLabels.length]; - for (int i= 0; i < fButtonLabels.length; i++) { - String currLabel= fButtonLabels[i]; - if (currLabel != null) { - fButtonControls[i]= createButton(contents, currLabel, listener); - fButtonControls[i].setEnabled(isEnabled() && fButtonsEnabled[i]); - } else { - fButtonControls[i]= null; - createSeparator(contents); - } - } - } - - fLastSeparator= createSeparator(contents); - - updateButtonState(); - fButtonsControl= contents; - } - - return fButtonsControl; - } - - protected void doButtonSelected(SelectionEvent e) { - if (fButtonControls != null) { - for (int i= 0; i < fButtonControls.length; i++) { - if (e.widget == fButtonControls[i]) { - buttonPressed(i); - return; - } - } - } - } - - // ------ enable / disable management - - /* - * @see DialogField#dialogFieldChanged - */ - @Override - public void dialogFieldChanged() { - super.dialogFieldChanged(); - updateButtonState(); - } - - /* - * Updates the enable state of the all buttons - */ - protected void updateButtonState() { - if (fButtonControls != null) { - ISelection sel= fTable.getSelection(); - for (int i= 0; i < fButtonControls.length; i++) { - Button button= fButtonControls[i]; - if (isOkToUse(button)) { - boolean extraState= getManagedButtonState(sel, i); - button.setEnabled(isEnabled() && extraState && fButtonsEnabled[i]); - } - } - } - } - - protected boolean getManagedButtonState(ISelection sel, int index) { - if (index == fRemoveButtonIndex) { - return !sel.isEmpty(); - } else if (index == fUpButtonIndex) { - return !sel.isEmpty() && canMoveUp(); - } else if (index == fDownButtonIndex) { - return !sel.isEmpty() && canMoveDown(); - } - return true; - } - - /* - * @see DialogField#updateEnableState - */ - @Override - protected void updateEnableState() { - super.updateEnableState(); - - boolean enabled= isEnabled(); - if (isOkToUse(fTableControl)) { - if (!enabled) { - fSelectionWhenEnabled= fTable.getSelection(); - selectElements(null); - } else { - selectElements(fSelectionWhenEnabled); - fSelectionWhenEnabled= null; - } - fTableControl.setEnabled(enabled); - } - updateButtonState(); - } - - /** - * Sets a button enabled or disabled. - */ - public void enableButton(int index, boolean enable) { - if (fButtonsEnabled != null && index < fButtonsEnabled.length) { - fButtonsEnabled[index]= enable; - updateButtonState(); - } - } - - // ------ model access - - /** - * Sets the elements shown in the list. - */ - public void setElements(List elements) { - fElements= new ArrayList(elements); - if (fTable != null) { - fTable.refresh(); - } - dialogFieldChanged(); - } - - /** - * Gets the elements shown in the list. - * The list returned is a copy, so it can be modified by the user. - */ - public List getElements() { - return new ArrayList(fElements); - } - - /** - * Gets the elements shown at the given index. - */ - public Object getElement(int index) { - return fElements.get(index); - } - - /** - * Replace an element. - */ - public void replaceElement(Object oldElement, Object newElement) throws IllegalArgumentException { - int idx= fElements.indexOf(oldElement); - if (idx != -1) { - if (oldElement.equals(newElement) || fElements.contains(newElement)) { - return; - } - fElements.set(idx, newElement); - if (fTable != null) { - List selected= getSelectedElements(); - if (selected.remove(oldElement)) { - selected.add(newElement); - } - fTable.refresh(); - selectElements(new StructuredSelection(selected)); - } - dialogFieldChanged(); - } else { - throw new IllegalArgumentException(); - } - } - - /** - * Adds an element at the end of the list. - */ - public void addElement(Object element) { - if (fElements.contains(element)) { - return; - } - fElements.add(element); - if (fTable != null) { - fTable.add(element); - } - dialogFieldChanged(); - } - - /** - * Adds elements at the end of the list. - */ - public void addElements(List elements) { - int nElements= elements.size(); - - if (nElements > 0) { - // filter duplicated - ArrayList elementsToAdd= new ArrayList(nElements); - - for (int i= 0; i < nElements; i++) { - Object elem= elements.get(i); - if (!fElements.contains(elem)) { - elementsToAdd.add(elem); - } - } - fElements.addAll(elementsToAdd); - if (fTable != null) { - fTable.add(elementsToAdd.toArray()); - } - dialogFieldChanged(); - } - } - - /** - * Adds an element at a position. - */ - public void insertElementAt(Object element, int index) { - if (fElements.contains(element)) { - return; - } - fElements.add(index, element); - if (fTable != null) { - fTable.add(element); - } - - dialogFieldChanged(); - } - - - /** - * Adds an element at a position. - */ - public void removeAllElements() { - if (fElements.size() > 0) { - fElements.clear(); - if (fTable != null) { - fTable.refresh(); - } - dialogFieldChanged(); - } - } - - /** - * Removes an element from the list. - */ - public void removeElement(Object element) throws IllegalArgumentException { - if (fElements.remove(element)) { - if (fTable != null) { - fTable.remove(element); - } - dialogFieldChanged(); - } else { - throw new IllegalArgumentException(); - } - } - - /** - * Removes elements from the list. - */ - public void removeElements(List elements) { - if (elements.size() > 0) { - fElements.removeAll(elements); - if (fTable != null) { - fTable.remove(elements.toArray()); - } - dialogFieldChanged(); - } - } - - /** - * Gets the number of elements - */ - public int getSize() { - return fElements.size(); - } - - - public void selectElements(ISelection selection) { - fSelectionWhenEnabled= selection; - if (fTable != null) { - fTable.setSelection(selection, true); - } - } - - public void selectFirstElement() { - Object element= null; - if (fViewerSorter != null) { - Object[] arr= fElements.toArray(); - fViewerSorter.sort(fTable, arr); - if (arr.length > 0) { - element= arr[0]; - } - } else { - if (fElements.size() > 0) { - element= fElements.get(0); - } - } - if (element != null) { - selectElements(new StructuredSelection(element)); - } - } - - - public void postSetSelection(final ISelection selection) { - if (isOkToUse(fTableControl)) { - Display d= fTableControl.getDisplay(); - d.asyncExec(new Runnable() { - @Override - public void run() { - if (isOkToUse(fTableControl)) { - selectElements(selection); - } - } - }); - } - } - - /** - * Refreshes the table. - */ - public void refresh() { - fTable.refresh(); - } - - // ------- list maintenance - - private List moveUp(List elements, List move) { - int nElements= elements.size(); - List res= new ArrayList(nElements); - Object floating= null; - for (int i= 0; i < nElements; i++) { - Object curr= elements.get(i); - if (move.contains(curr)) { - res.add(curr); - } else { - if (floating != null) { - res.add(floating); - } - floating= curr; - } - } - if (floating != null) { - res.add(floating); - } - return res; - } - - private void moveUp(List toMoveUp) { - if (toMoveUp.size() > 0) { - setElements(moveUp(fElements, toMoveUp)); - fTable.reveal(toMoveUp.get(0)); - } - } - - private void moveDown(List toMoveDown) { - if (toMoveDown.size() > 0) { - setElements(reverse(moveUp(reverse(fElements), toMoveDown))); - fTable.reveal(toMoveDown.get(toMoveDown.size() - 1)); - } - } - - private List reverse(List p) { - List reverse= new ArrayList(p.size()); - for (int i= p.size()-1; i >= 0; i--) { - reverse.add(p.get(i)); - } - return reverse; - } - - - private void remove() { - removeElements(getSelectedElements()); - } - - private void up() { - moveUp(getSelectedElements()); - } - - private void down() { - moveDown(getSelectedElements()); - } - - private boolean canMoveUp() { - if (isOkToUse(fTableControl)) { - int[] indc= fTableControl.getSelectionIndices(); - for (int i= 0; i < indc.length; i++) { - if (indc[i] != i) { - return true; - } - } - } - return false; - } - - private boolean canMoveDown() { - if (isOkToUse(fTableControl)) { - int[] indc= fTableControl.getSelectionIndices(); - int k= fElements.size() - 1; - for (int i= indc.length - 1; i >= 0 ; i--, k--) { - if (indc[i] != k) { - return true; - } - } - } - return false; - } - - /** - * Returns the selected elements. - */ - public List getSelectedElements() { - List result= new ArrayList(); - if (fTable != null) { - ISelection selection= fTable.getSelection(); - if (selection instanceof IStructuredSelection) { - Iterator iter= ((IStructuredSelection)selection).iterator(); - while (iter.hasNext()) { - result.add(iter.next()); - } - } - } - return result; - } - - // ------- ListViewerAdapter - - private class ListViewerAdapter implements IStructuredContentProvider, ISelectionChangedListener { - - // ------- ITableContentProvider Interface ------------ - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // will never happen - } - - public boolean isDeleted(Object element) { - return false; - } - - @Override - public void dispose() { - } - - @Override - public Object[] getElements(Object obj) { - return fElements.toArray(); - } - - // ------- ISelectionChangedListener Interface ------------ - - @Override - public void selectionChanged(SelectionChangedEvent event) { - doListSelected(event); - } - - } - - - protected void doListSelected(SelectionChangedEvent event) { - updateButtonState(); - if (fListAdapter != null) { - fListAdapter.selectionChanged(this); - } - } - - - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/SelectionButtonDialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/SelectionButtonDialogField.java deleted file mode 100644 index ccc1841b784..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/SelectionButtonDialogField.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.cdt.debug.mi.internal.ui.SWTUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * Dialog Field containing a single button: e.g. radio or checkbox button. - */ -public class SelectionButtonDialogField extends DialogField { - - private Button fButton; - private boolean fIsSelected; - private DialogField[] fAttachedDialogFields; - private int fButtonStyle; - - /** - * Creates a selection button. - * Allowed button styles: SWT.RADIO, SWT.CHECK, SWT.TOGGLE, SWT.PUSH - */ - public SelectionButtonDialogField(int buttonStyle) { - super(); - fIsSelected= false; - fAttachedDialogFields= null; - fButtonStyle= buttonStyle; - } - - /** - * Attaches a field to the selection state of the selection button. - * The attached field will be disabled if the selection button is not selected. - */ - public void attachDialogField(DialogField dialogField) { - attachDialogFields(new DialogField[] { dialogField }); - } - - /** - * Attaches fields to the selection state of the selection button. - * The attached fields will be disabled if the selection button is not selected. - */ - public void attachDialogFields(DialogField[] dialogFields) { - fAttachedDialogFields= dialogFields; - for (int i= 0; i < dialogFields.length; i++) { - dialogFields[i].setEnabled(fIsSelected); - } - } - - /** - * Returns <code>true</code> is teh gived field is attached to the selection button. - */ - public boolean isAttached(DialogField editor) { - if (fAttachedDialogFields != null) { - for (int i=0; i < fAttachedDialogFields.length; i++) { - if (fAttachedDialogFields[i] == editor) { - return true; - } - } - } - return false; - } - - // ------- layout helpers - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - assertEnoughColumns(nColumns); - - Button button= getSelectionButton(parent); - GridData gd= new GridData(); - gd.horizontalSpan= nColumns; - gd.horizontalAlignment= GridData.FILL; - if (fButtonStyle == SWT.PUSH) { - gd.widthHint = SWTUtil.getButtonWidthHint(button); - } - - button.setLayoutData(gd); - - return new Control[] { button }; - } - - /* - * @see DialogField#getNumberOfControls - */ - @Override - public int getNumberOfControls() { - return 1; - } - - // ------- ui creation - - /** - * Returns the selection button widget. When called the first time, the widget will be created. - * @param The parent composite when called the first time, or <code>null</code> - * after. - */ - public Button getSelectionButton(Composite group) { - if (fButton == null) { - assertCompositeNotNull(group); - - fButton= new Button(group, fButtonStyle); - fButton.setFont(group.getFont()); - fButton.setText(fLabelText); - fButton.setEnabled(isEnabled()); - fButton.setSelection(fIsSelected); - fButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - doWidgetSelected(e); - } - @Override - public void widgetSelected(SelectionEvent e) { - doWidgetSelected(e); - } - }); - } - return fButton; - } - - protected void doWidgetSelected(SelectionEvent e) { - if (isOkToUse(fButton)) { - changeValue(fButton.getSelection()); - } - } - - private void changeValue(boolean newState) { - if (fIsSelected != newState) { - fIsSelected= newState; - if (fAttachedDialogFields != null) { - boolean focusSet= false; - for (int i= 0; i < fAttachedDialogFields.length; i++) { - fAttachedDialogFields[i].setEnabled(fIsSelected); - if (fIsSelected && !focusSet) { - focusSet= fAttachedDialogFields[i].setFocus(); - } - } - } - dialogFieldChanged(); - } else if (fButtonStyle == SWT.PUSH) { - dialogFieldChanged(); - } - } - - // ------ model access - - /** - * Returns the selection state of the button. - */ - public boolean isSelected() { - return fIsSelected; - } - - /** - * Sets the selection state of the button. - */ - public void setSelection(boolean selected) { - changeValue(selected); - if (isOkToUse(fButton)) { - fButton.setSelection(selected); - } - } - - // ------ enable / disable management - - /* - * @see DialogField#updateEnableState - */ - @Override - protected void updateEnableState() { - super.updateEnableState(); - if (isOkToUse(fButton)) { - fButton.setEnabled(isEnabled()); - } - } - - - - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/SelectionButtonDialogFieldGroup.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/SelectionButtonDialogFieldGroup.java deleted file mode 100644 index 75f30fc0ed1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/SelectionButtonDialogFieldGroup.java +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.jface.util.Assert; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; - -/** - * Dialog field describing a group with buttons (Checkboxes, radio buttons..) - */ -public class SelectionButtonDialogFieldGroup extends DialogField { - - private Composite fButtonComposite; - - private Button[] fButtons; - private String[] fButtonNames; - private boolean[] fButtonsSelected; - private boolean[] fButtonsEnabled; - - private int fGroupBorderStyle; - private int fGroupNumberOfColumns; - private int fButtonsStyle; - - /** - * Creates a group without border. - */ - public SelectionButtonDialogFieldGroup(int buttonsStyle, String[] buttonNames, int nColumns) { - this(buttonsStyle, buttonNames, nColumns, SWT.NONE); - } - - - /** - * Creates a group with border (label in border). - * Accepted button styles are: SWT.RADIO, SWT.CHECK, SWT.TOGGLE - * For border styles see <code>Group</code> - */ - public SelectionButtonDialogFieldGroup(int buttonsStyle, String[] buttonNames, int nColumns, int borderStyle) { - super(); - - Assert.isTrue(buttonsStyle == SWT.RADIO || buttonsStyle == SWT.CHECK || buttonsStyle == SWT.TOGGLE); - fButtonNames= buttonNames; - - int nButtons= buttonNames.length; - fButtonsSelected= new boolean[nButtons]; - fButtonsEnabled= new boolean[nButtons]; - for (int i= 0; i < nButtons; i++) { - fButtonsSelected[i]= false; - fButtonsEnabled[i]= true; - } - if (fButtonsStyle == SWT.RADIO) { - fButtonsSelected[0]= true; - } - - fGroupBorderStyle= borderStyle; - fGroupNumberOfColumns= (nColumns <= 0) ? nButtons : nColumns; - - fButtonsStyle= buttonsStyle; - - } - - // ------- layout helpers - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - assertEnoughColumns(nColumns); - - if (fGroupBorderStyle == SWT.NONE) { - Label label= getLabelControl(parent); - label.setLayoutData(gridDataForLabel(1)); - - Composite buttonsgroup= getSelectionButtonsGroup(parent); - GridData gd= new GridData(); - gd.horizontalSpan= nColumns - 1; - buttonsgroup.setLayoutData(gd); - - return new Control[] { label, buttonsgroup }; - } - Composite buttonsgroup= getSelectionButtonsGroup(parent); - GridData gd= new GridData(); - gd.horizontalSpan= nColumns; - buttonsgroup.setLayoutData(gd); - - return new Control[] { buttonsgroup }; - } - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public int getNumberOfControls() { - return (fGroupBorderStyle == SWT.NONE) ? 2 : 1; - } - - // ------- ui creation - - private Button createSelectionButton(int index, Composite group, SelectionListener listener) { - Button button= new Button(group, fButtonsStyle | SWT.LEFT); - button.setFont(group.getFont()); - button.setText(fButtonNames[index]); - button.setEnabled(isEnabled() && fButtonsEnabled[index]); - button.setSelection(fButtonsSelected[index]); - button.addSelectionListener(listener); - button.setLayoutData(new GridData()); - return button; - } - - /** - * Returns the group widget. When called the first time, the widget will be created. - * @param The parent composite when called the first time, or <code>null</code> - * after. - */ - public Composite getSelectionButtonsGroup(Composite parent) { - if (fButtonComposite == null) { - assertCompositeNotNull(parent); - - GridLayout layout= new GridLayout(); - layout.makeColumnsEqualWidth= true; - layout.numColumns= fGroupNumberOfColumns; - - if (fGroupBorderStyle != SWT.NONE) { - Group group= new Group(parent, fGroupBorderStyle); - if (fLabelText != null && fLabelText.length() > 0) { - group.setText(fLabelText); - } - fButtonComposite= group; - } else { - fButtonComposite= new Composite(parent, SWT.NULL); - layout.marginHeight= 0; - layout.marginWidth= 0; - } - - fButtonComposite.setLayout(layout); - - SelectionListener listener= new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - doWidgetSelected(e); - } - @Override - public void widgetSelected(SelectionEvent e) { - doWidgetSelected(e); - } - }; - int nButtons= fButtonNames.length; - fButtons= new Button[nButtons]; - for (int i= 0; i < nButtons; i++) { - fButtons[i]= createSelectionButton(i, fButtonComposite, listener); - } - int nRows= nButtons / fGroupNumberOfColumns; - int nFillElements= nRows * fGroupNumberOfColumns - nButtons; - for (int i= 0; i < nFillElements; i++) { - createEmptySpace(fButtonComposite); - } - } - return fButtonComposite; - } - - /** - * Returns a button from the group or <code>null</code> if not yet created. - */ - public Button getSelectionButton(int index) { - if (index >= 0 && index < fButtons.length) { - return fButtons[index]; - } - return null; - } - - protected void doWidgetSelected(SelectionEvent e) { - Button button= (Button)e.widget; - for (int i= 0; i < fButtons.length; i++) { - if (fButtons[i] == button) { - fButtonsSelected[i]= button.getSelection(); - dialogFieldChanged(); - return; - } - } - } - - // ------ model access - - /** - * Returns the selection state of a button contained in the group. - * @param The index of the button - */ - public boolean isSelected(int index) { - if (index >= 0 && index < fButtonsSelected.length) { - return fButtonsSelected[index]; - } - return false; - } - - /** - * Sets the selection state of a button contained in the group. - */ - public void setSelection(int index, boolean selected) { - if (index >= 0 && index < fButtonsSelected.length) { - if (fButtonsSelected[index] != selected) { - fButtonsSelected[index]= selected; - if (fButtons != null) { - Button button= fButtons[index]; - if (isOkToUse(button)) { - button.setSelection(selected); - } - } - } - } - } - - // ------ enable / disable management - - @Override - protected void updateEnableState() { - super.updateEnableState(); - if (fButtons != null) { - boolean enabled= isEnabled(); - for (int i= 0; i < fButtons.length; i++) { - Button button= fButtons[i]; - if (isOkToUse(button)) { - button.setEnabled(enabled && fButtonsEnabled[i]); - } - } - } - } - - /** - * Sets the enable state of a button contained in the group. - */ - public void enableSelectionButton(int index, boolean enable) { - if (index >= 0 && index < fButtonsEnabled.length) { - fButtonsEnabled[index]= enable; - if (fButtons != null) { - Button button= fButtons[index]; - if (isOkToUse(button)) { - button.setEnabled(isEnabled() && enable); - } - } - } - } -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/Separator.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/Separator.java deleted file mode 100644 index 83c2ff67e03..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/Separator.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; - -/** - * Dialog field describing a separator. - */ -public class Separator extends DialogField { - - private Label fSeparator; - private int fStyle; - - public Separator() { - this(SWT.NONE); - } - - /** - * @param style of the separator. See <code>Label</code> for possible - * styles. - */ - public Separator(int style) { - super(); - fStyle= style; - } - - // ------- layout helpers - - /** - * Creates the separator and fills it in a MGridLayout. - * @param height The heigth of the separator - */ - public Control[] doFillIntoGrid(Composite parent, int nColumns, int height) { - assertEnoughColumns(nColumns); - - Control separator= getSeparator(parent); - separator.setLayoutData(gridDataForSeperator(nColumns, height)); - - return new Control[] { separator }; - } - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - return doFillIntoGrid(parent, nColumns, 4); - } - - /* - * @see DialogField#getNumberOfControls - */ - @Override - public int getNumberOfControls() { - return 1; - } - - protected static GridData gridDataForSeperator(int span, int height) { - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.verticalAlignment= GridData.BEGINNING; - gd.heightHint= height; - gd.horizontalSpan= span; - return gd; - } - - // ------- ui creation - - /** - * Creates or returns the created separator. - * @param parent The parent composite or <code>null</code> if the widget has - * already been created. - */ - public Control getSeparator(Composite parent) { - if (fSeparator == null) { - assertCompositeNotNull(parent); - fSeparator= new Label(parent, fStyle); - } - return fSeparator; - } - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringButtonDialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringButtonDialogField.java deleted file mode 100644 index 000c76c4d88..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringButtonDialogField.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.cdt.debug.mi.internal.ui.SWTUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * Dialog field containing a label, text control and a button control. - */ -public class StringButtonDialogField extends StringDialogField { - - private Button fBrowseButton; - private String fBrowseButtonLabel; - private IStringButtonAdapter fStringButtonAdapter; - - private boolean fButtonEnabled; - - public StringButtonDialogField(IStringButtonAdapter adapter) { - super(); - fStringButtonAdapter= adapter; - fBrowseButtonLabel= "!Browse...!"; //$NON-NLS-1$ - fButtonEnabled= true; - } - - /** - * Sets the label of the button. - */ - public void setButtonLabel(String label) { - fBrowseButtonLabel= label; - } - - // ------ adapter communication - - /** - * Programmatical pressing of the button - */ - public void changeControlPressed() { - fStringButtonAdapter.changeControlPressed(this); - } - - // ------- layout helpers - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - assertEnoughColumns(nColumns); - - Label label= getLabelControl(parent); - label.setLayoutData(gridDataForLabel(1)); - Text text= getTextControl(parent); - text.setLayoutData(gridDataForText(nColumns - 2)); - Button button= getChangeControl(parent); - button.setLayoutData(gridDataForButton(button, 1)); - - return new Control[] { label, text, button }; - } - - /* - * @see DialogField#getNumberOfControls - */ - @Override - public int getNumberOfControls() { - return 3; - } - - protected static GridData gridDataForButton(Button button, int span) { - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= false; - gd.horizontalSpan= span; - gd.widthHint = SWTUtil.getButtonWidthHint(button); - return gd; - } - - // ------- ui creation - - /** - * Creates or returns the created buttom widget. - * @param parent The parent composite or <code>null</code> if the widget has - * already been created. - */ - public Button getChangeControl(Composite parent) { - if (fBrowseButton == null) { - assertCompositeNotNull(parent); - - fBrowseButton= new Button(parent, SWT.PUSH); - fBrowseButton.setText(fBrowseButtonLabel); - fBrowseButton.setEnabled(isEnabled() && fButtonEnabled); - fBrowseButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent e) { - changeControlPressed(); - } - @Override - public void widgetSelected(SelectionEvent e) { - changeControlPressed(); - } - }); - - } - return fBrowseButton; - } - - // ------ enable / disable management - - /** - * Sets the enable state of the button. - */ - public void enableButton(boolean enable) { - if (isOkToUse(fBrowseButton)) { - fBrowseButton.setEnabled(isEnabled() && enable); - } - fButtonEnabled= enable; - } - - /* - * @see DialogField#updateEnableState - */ - @Override - protected void updateEnableState() { - super.updateEnableState(); - if (isOkToUse(fBrowseButton)) { - fBrowseButton.setEnabled(isEnabled() && fButtonEnabled); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringButtonStatusDialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringButtonStatusDialogField.java deleted file mode 100644 index 1513758478d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringButtonStatusDialogField.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * Dialog field containing a label, text control, status label and a button control. - * The status label can be either a image or text label, and can be usd to give - * additional information about the current element chosen. - */ -public class StringButtonStatusDialogField extends StringButtonDialogField { - - private Label fStatusLabelControl; - private Object fStatus; // String or ImageDescriptor - - private String fWidthHintString; - private int fWidthHint; - - public StringButtonStatusDialogField(IStringButtonAdapter adapter) { - super(adapter); - fStatus= null; - fWidthHintString= null; - fWidthHint= -1; - } - - // ------ set status - - /** - * Sets the status string. - */ - public void setStatus(String status) { - if (isOkToUse(fStatusLabelControl)) { - fStatusLabelControl.setText(status); - } - fStatus= status; - } - - /** - * Sets the status image. - * Caller is responsible to dispose image - */ - public void setStatus(Image image) { - if (isOkToUse(fStatusLabelControl)) { - if (image == null) { - fStatusLabelControl.setImage(null); - } else { - fStatusLabelControl.setImage(image); - } - } - fStatus= image; - } - - /** - * Sets the staus string hint of the status label. - * The string is used to calculate the size of the status label. - */ - public void setStatusWidthHint(String widthHintString) { - fWidthHintString= widthHintString; - fWidthHint= -1; - } - - /** - * Sets the width hint of the status label. - */ - public void setStatusWidthHint(int widthHint) { - fWidthHint= widthHint; - fWidthHintString= null; - } - - // ------- layout helpers - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - assertEnoughColumns(nColumns); - - Label label= getLabelControl(parent); - label.setLayoutData(gridDataForLabel(1)); - Text text= getTextControl(parent); - text.setLayoutData(gridDataForText(nColumns - 3)); - Label status= getStatusLabelControl(parent); - status.setLayoutData(gridDataForStatusLabel(parent, 1)); - Button button= getChangeControl(parent); - button.setLayoutData(gridDataForButton(button, 1)); - - return new Control[] { label, text, status, button }; - } - - /* - * @see DialogField#getNumberOfControls - */ - @Override - public int getNumberOfControls() { - return 4; - } - - protected GridData gridDataForStatusLabel(Control aControl, int span) { - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.BEGINNING; - gd.grabExcessHorizontalSpace= false; - gd.horizontalIndent= 0; - if (fWidthHintString != null) { - GC gc= new GC(aControl); - gd.widthHint= gc.textExtent(fWidthHintString).x; - gc.dispose(); - } else if (fWidthHint != -1) { - gd.widthHint= fWidthHint; - } else { - gd.widthHint= SWT.DEFAULT; - } - return gd; - } - - // ------- ui creation - - /** - * Creates or returns the created status label widget. - * @param parent The parent composite or <code>null</code> when the widget has - * already been created. - */ - public Label getStatusLabelControl(Composite parent) { - if (fStatusLabelControl == null) { - assertCompositeNotNull(parent); - fStatusLabelControl= new Label(parent, SWT.LEFT); - fStatusLabelControl.setFont(parent.getFont()); - fStatusLabelControl.setEnabled(isEnabled()); - if (fStatus instanceof Image) { - fStatusLabelControl.setImage((Image)fStatus); - } else if (fStatus instanceof String) { - fStatusLabelControl.setText((String)fStatus); - } else { - // must be null - } - } - return fStatusLabelControl; - } - - // ------ enable / disable management - - /* - * @see DialogField#updateEnableState - */ - @Override - protected void updateEnableState() { - super.updateEnableState(); - if (isOkToUse(fStatusLabelControl)) { - fStatusLabelControl.setEnabled(isEnabled()); - } - } -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringDialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringDialogField.java deleted file mode 100644 index ff320aa36c6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/StringDialogField.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * Dialog field containing a label and a text control. - */ -public class StringDialogField extends DialogField { - - private String fText; - private Text fTextControl; - private ModifyListener fModifyListener; - - public StringDialogField() { - super(); - fText= ""; //$NON-NLS-1$ - } - - // ------- layout helpers - - /* - * @see DialogField#doFillIntoGrid - */ - @Override - public Control[] doFillIntoGrid(Composite parent, int nColumns) { - assertEnoughColumns(nColumns); - - Label label= getLabelControl(parent); - label.setLayoutData(gridDataForLabel(1)); - Text text= getTextControl(parent); - text.setLayoutData(gridDataForText(nColumns - 1)); - - return new Control[] { label, text }; - } - - /* - * @see DialogField#getNumberOfControls - */ - @Override - public int getNumberOfControls() { - return 2; - } - - protected static GridData gridDataForText(int span) { - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= false; - gd.horizontalSpan= span; - return gd; - } - - // ------- focus methods - - /* - * @see DialogField#setFocus - */ - @Override - public boolean setFocus() { - if (isOkToUse(fTextControl)) { - fTextControl.setFocus(); - fTextControl.setSelection(0, fTextControl.getText().length()); - } - return true; - } - - // ------- ui creation - - /** - * Creates or returns the created text control. - * @param parent The parent composite or <code>null</code> when the widget has - * already been created. - */ - public Text getTextControl(Composite parent) { - if (fTextControl == null) { - assertCompositeNotNull(parent); - fModifyListener= new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - doModifyText(e); - } - }; - - fTextControl= new Text(parent, SWT.SINGLE | SWT.BORDER); - // moved up due to 1GEUNW2 - fTextControl.setText(fText); - fTextControl.setFont(parent.getFont()); - fTextControl.addModifyListener(fModifyListener); - - fTextControl.setEnabled(isEnabled()); - } - return fTextControl; - } - - protected void doModifyText(ModifyEvent e) { - if (isOkToUse(fTextControl)) { - fText= fTextControl.getText(); - } - dialogFieldChanged(); - } - - // ------ enable / disable management - - /* - * @see DialogField#updateEnableState - */ - @Override - protected void updateEnableState() { - super.updateEnableState(); - if (isOkToUse(fTextControl)) { - fTextControl.setEnabled(isEnabled()); - } - } - - // ------ text access - - /** - * Gets the text. Can not be <code>null</code> - */ - public String getText() { - return fText; - } - - /** - * Sets the text. Triggers a dialog-changed event. - */ - public void setText(String text) { - fText= text; - if (isOkToUse(fTextControl)) { - fTextControl.setText(text); - } else { - dialogFieldChanged(); - } - } - - /** - * Sets the text without triggering a dialog-changed event. - */ - public void setTextWithoutUpdate(String text) { - fText= text; - if (isOkToUse(fTextControl)) { - fTextControl.removeModifyListener(fModifyListener); - fTextControl.setText(text); - fTextControl.addModifyListener(fModifyListener); - } - } - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java deleted file mode 100644 index ba805ebc8e4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java +++ /dev/null @@ -1,574 +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.internal.ui.preferences; - -import com.ibm.icu.text.MessageFormat; -import java.util.HashMap; -import java.util.Iterator; -import org.eclipse.cdt.debug.mi.core.IMIConstants; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.internal.ui.IMIHelpContextIds; -import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * Page for preferences that apply specifically to GDB MI. - */ -public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IPropertyChangeListener { - - /** - * This class exists to provide visibility to the - * <code>refreshValidState</code> method and to perform more intelligent - * clearing of the error message. - */ - protected class MIIntegerFieldEditor extends IntegerFieldEditor { - - public MIIntegerFieldEditor(String name, String labelText, Composite parent) { - super(name, labelText, parent); - } - - /** - * @see org.eclipse.jface.preference.FieldEditor#refreshValidState() - */ - @Override - protected void refreshValidState() { - super.refreshValidState(); - } - - /** - * Clears the error message from the message line if the error - * message is the error message from this field editor. - */ - @Override - protected void clearErrorMessage() { - if (canClearErrorMessage()) { - super.clearErrorMessage(); - } - } - } - public class MIPreferenceStore implements IPreferenceStore { - - private Preferences fPreferences; - - private HashMap fListeners = new HashMap(); - - public MIPreferenceStore( Preferences pref ) { - fPreferences = pref; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - @Override - public void addPropertyChangeListener( final IPropertyChangeListener listener ) { - Preferences.IPropertyChangeListener l = new Preferences.IPropertyChangeListener() { - - @Override - public void propertyChange( org.eclipse.core.runtime.Preferences.PropertyChangeEvent event ) { - listener.propertyChange( new PropertyChangeEvent( MIPreferenceStore.this, event.getProperty(), event.getNewValue(), event.getOldValue() ) ); - } - }; - fListeners.put( listener, l ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String) - */ - @Override - public boolean contains( String name ) { - return getPreferences().contains( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String, java.lang.Object, java.lang.Object) - */ - @Override - public void firePropertyChangeEvent( String name, Object oldValue, Object newValue ) { - Iterator it = fListeners.keySet().iterator(); - while( it.hasNext() ) { - ((IPropertyChangeListener)it.next()).propertyChange( new PropertyChangeEvent( this, name, oldValue, newValue ) ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String) - */ - @Override - public boolean getBoolean( String name ) { - return fPreferences.getBoolean( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String) - */ - @Override - public boolean getDefaultBoolean( String name ) { - return fPreferences.getDefaultBoolean( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String) - */ - @Override - public double getDefaultDouble( String name ) { - return fPreferences.getDefaultDouble( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String) - */ - @Override - public float getDefaultFloat( String name ) { - return fPreferences.getDefaultFloat( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String) - */ - @Override - public int getDefaultInt( String name ) { - return fPreferences.getDefaultInt( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String) - */ - @Override - public long getDefaultLong( String name ) { - return fPreferences.getDefaultLong( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String) - */ - @Override - public String getDefaultString( String name ) { - return fPreferences.getDefaultString( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String) - */ - @Override - public double getDouble( String name ) { - return fPreferences.getDouble( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String) - */ - @Override - public float getFloat( String name ) { - return fPreferences.getFloat( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String) - */ - @Override - public int getInt( String name ) { - return fPreferences.getInt( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String) - */ - @Override - public long getLong( String name ) { - return fPreferences.getLong( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String) - */ - @Override - public String getString( String name ) { - return fPreferences.getString( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String) - */ - @Override - public boolean isDefault( String name ) { - return fPreferences.isDefault( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#needsSaving() - */ - @Override - public boolean needsSaving() { - return getPreferences().needsSaving(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, java.lang.String) - */ - @Override - public void putValue( String name, String value ) { - getPreferences().setValue( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - @Override - public void removePropertyChangeListener( IPropertyChangeListener listener ) { - fListeners.remove( listener ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, double) - */ - @Override - public void setDefault( String name, double value ) { - getPreferences().setDefault( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, float) - */ - @Override - public void setDefault( String name, float value ) { - getPreferences().setDefault( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, int) - */ - @Override - public void setDefault( String name, int value ) { - getPreferences().setDefault( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, long) - */ - @Override - public void setDefault( String name, long value ) { - getPreferences().setDefault( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, java.lang.String) - */ - @Override - public void setDefault( String name, String defaultObject ) { - getPreferences().setDefault( name, defaultObject ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, boolean) - */ - @Override - public void setDefault( String name, boolean value ) { - getPreferences().setDefault( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String) - */ - @Override - public void setToDefault( String name ) { - getPreferences().setToDefault( name ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, double) - */ - @Override - public void setValue( String name, double value ) { - getPreferences().setValue( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, float) - */ - @Override - public void setValue( String name, float value ) { - getPreferences().setValue( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, int) - */ - @Override - public void setValue( String name, int value ) { - getPreferences().setValue( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, long) - */ - @Override - public void setValue( String name, long value ) { - getPreferences().setValue( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, java.lang.String) - */ - @Override - public void setValue( String name, String value ) { - getPreferences().setValue( name, value ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, boolean) - */ - @Override - public void setValue( String name, boolean value ) { - getPreferences().setValue( name, value ); - } - - protected Preferences getPreferences() { - return fPreferences; - } - } - - private IWorkbench fWorkbench; - - // Debugger timeout preference widgets - private MIIntegerFieldEditor fDebugTimeoutText; - - // Launch timeout preference widgets - private MIIntegerFieldEditor fLaunchTimeoutText; - - private BooleanFieldEditor fRefreshSolibsButton; - - private MIPreferenceStore fMICorePreferenceStore = new MIPreferenceStore( MIPlugin.getDefault().getPluginPreferences() ); - - /** - * Constructor for MIPreferencePage. - */ - public MIPreferencePage() { - super(); - setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() ); - setDescription( PreferenceMessages.getString( "MIPreferencePage.0" ) ); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) - */ - @Override - protected Control createContents( Composite parent ) { - getWorkbench().getHelpSystem().setHelp( getControl(), IMIHelpContextIds.MI_PREFERENCE_PAGE ); - //The main composite - Composite composite = new Composite( parent, SWT.NULL ); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout( layout ); - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData( data ); - createSpacer( composite, 1 ); - createCommunicationPreferences( composite ); - return composite; - } - - /** - * Creates composite group and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @param labelText the text label of the new composite - * @return the newly-created composite - */ - private Composite createGroupComposite( Composite parent, int numColumns, String labelText ) { - return ControlFactory.createGroup( parent, labelText, numColumns ); - } - - /** - * @see IPreferencePage#performOk() - */ - @Override - public boolean performOk() { - boolean result = super.performOk(); - storeValues(); - MIUIPlugin.getDefault().savePluginPreferences(); - MIPlugin.getDefault().savePluginPreferences(); - return result; - } - - /** - * Sets the default preferences. - * - * @see PreferencePage#performDefaults() - */ - @Override - protected void performDefaults() { - setDefaultValues(); - super.performDefaults(); - } - - private void setDefaultValues() { - fDebugTimeoutText.loadDefault(); - fLaunchTimeoutText.loadDefault(); - fRefreshSolibsButton.loadDefault(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench) - */ - @Override - public void init( IWorkbench workbench ) { - fWorkbench = workbench; - } - - protected void createSpacer( Composite composite, int columnSpan ) { - Label label = new Label( composite, SWT.NONE ); - GridData gd = new GridData(); - gd.horizontalSpan = columnSpan; - label.setLayoutData( gd ); - } - - private void createCommunicationPreferences( Composite composite ) { - Composite comp = createGroupComposite( composite, 1, PreferenceMessages.getString( "MIPreferencePage.1" ) ); //$NON-NLS-1$ - //Add in an intermediate composite to allow for spacing - Composite spacingComposite = new Composite( comp, SWT.NONE ); - GridLayout layout = new GridLayout(); - spacingComposite.setLayout( layout ); - GridData data = new GridData(); - data.horizontalSpan = 2; - spacingComposite.setLayoutData( data ); - fDebugTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.2" ), spacingComposite ); //$NON-NLS-1$ - fDebugTimeoutText.setPropertyChangeListener( this ); - fLaunchTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.3" ), spacingComposite ); //$NON-NLS-1$ - fLaunchTimeoutText.setPropertyChangeListener( this ); - fRefreshSolibsButton = createCheckbox( IMIConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, PreferenceMessages.getString( "MIPreferencePage.6" ), spacingComposite ); //$NON-NLS-1$ - } - - /** - * Store the preference values based on the state of the component widgets - */ - private void storeValues() { - fDebugTimeoutText.store(); - fLaunchTimeoutText.store(); - fRefreshSolibsButton.store(); - } - - private MIIntegerFieldEditor createTimeoutField( String preference, String label, Composite parent ) { - MIIntegerFieldEditor toText = new MIIntegerFieldEditor( preference, label, parent ); - GridData data = new GridData(); - data.widthHint = convertWidthInCharsToPixels( 10 ); - toText.getTextControl( parent ).setLayoutData( data ); - toText.setPreferenceStore( getMICorePreferenceStore() ); - toText.setPage( this ); - toText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE ); - toText.setValidRange( IMIConstants.MIN_REQUEST_TIMEOUT, IMIConstants.MAX_REQUEST_TIMEOUT ); - String minValue = Integer.toString( IMIConstants.MIN_REQUEST_TIMEOUT ); - String maxValue = Integer.toString( IMIConstants.MAX_REQUEST_TIMEOUT ); - toText.setErrorMessage( MessageFormat.format( PreferenceMessages.getString( "MIPreferencePage.4" ), new String[]{ minValue, maxValue } ) ); //$NON-NLS-1$ - toText.load(); - return toText; - } - - private BooleanFieldEditor createCheckbox( String preference, String label, Composite parent ) { - BooleanFieldEditor field = new BooleanFieldEditor( preference, label, parent ); - field.setPage( this ); - field.setPreferenceStore( new MIPreferenceStore( MIPlugin.getDefault().getPluginPreferences() ) ); - field.load(); - return field; - } - - protected MIPreferenceStore getMICorePreferenceStore() { - return fMICorePreferenceStore; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#dispose() - */ - @Override - public void dispose() { - fDebugTimeoutText.dispose(); - fLaunchTimeoutText.dispose(); - fRefreshSolibsButton.dispose(); - super.dispose(); - } - - protected MIIntegerFieldEditor getLaunchTimeoutText() { - return fLaunchTimeoutText; - } - - protected MIIntegerFieldEditor getDebugTimeoutText() { - return fDebugTimeoutText; - } - - /** - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - @Override - public void propertyChange(PropertyChangeEvent event) { - - if (event.getProperty().equals(FieldEditor.IS_VALID)) { - boolean newValue = ((Boolean) event.getNewValue()).booleanValue(); - // If the new value is true then we must check all field editors. - // If it is false, then the page is invalid in any case. - MIIntegerFieldEditor launchTimeout = getLaunchTimeoutText(); - MIIntegerFieldEditor debugTimeout = getDebugTimeoutText(); - if (newValue) { - if (launchTimeout != null && event.getSource() != launchTimeout) { - launchTimeout.refreshValidState(); - } - if (debugTimeout != null && event.getSource() != debugTimeout) { - debugTimeout.refreshValidState(); - } - } - setValid(launchTimeout.isValid() && debugTimeout.isValid()); - getContainer().updateButtons(); - updateApplyButton(); - } - } - - protected boolean canClearErrorMessage() { - MIIntegerFieldEditor launchTimeout = getLaunchTimeoutText(); - MIIntegerFieldEditor debugTimeout = getDebugTimeoutText(); - boolean validLaunch = false; - boolean validDebug = false; - if (launchTimeout != null) { - validLaunch = launchTimeout.isValid(); - } - if (debugTimeout != null) { - validDebug = debugTimeout.isValid(); - } - return validLaunch && validDebug; - } - - private IWorkbench getWorkbench() { - return fWorkbench; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.java deleted file mode 100644 index 2ae2b0266b4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.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.internal.ui.preferences; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class PreferenceMessages { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.preferences.PreferenceMessages";//$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); - - private PreferenceMessages() { - } - - 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.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties deleted file mode 100644 index 52edd439374..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### - -MIPreferencePage.0=General settings for GDB MI. -MIPreferencePage.1=Communication -MIPreferencePage.2=&Debugger timeout (ms): -MIPreferencePage.3=&Launch timeout (ms): -MIPreferencePage.4=Value must be an integer between {0} and {1}. -MIPreferencePage.6=Automatically refresh modules - diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/OptionsPropertyPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/OptionsPropertyPage.java deleted file mode 100644 index 1eba323ba53..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/OptionsPropertyPage.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.internal.ui.propertypages; - -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.utils.ui.controls.ControlFactory; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.dialogs.PropertyPage; - -/** - * The property page for the gdb/mi-based debugger options. - */ -public class OptionsPropertyPage extends PropertyPage { - - private Button fRefreshSolibsButton; - - /** - * Constructor for OptionsPropertyPage. - */ - public OptionsPropertyPage() { - noDefaultAndApplyButton(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createContents( Composite parent ) { - Composite comp = ControlFactory.createComposite( parent, 1 ); - fRefreshSolibsButton = createCheckButton( comp, PropertyMessages.getString( "OptionsPropertyPage.1" ) ); //$NON-NLS-1$ - initialize(); - return comp; - } - - private Button createCheckButton( Composite parent, String label ) { - Button button = new Button( parent, SWT.CHECK | SWT.LEFT ); - button.setText( label ); - // FieldEditor GridData - GridData data = new GridData(); - button.setLayoutData( data ); - return button; - } - - private void initialize() { - boolean solibUpdate = true; - ICDISession session = getElement().getAdapter( ICDISession.class ); - if ( session instanceof Session ) { - solibUpdate = ((Session)session).getSharedLibraryManager().isAutoUpdate(); - } - fRefreshSolibsButton.setSelection( solibUpdate ); - - } - - @Override - protected void performApply() { - storeValues(); - super.performApply(); - } - - @Override - public boolean performOk() { - storeValues(); - return super.performOk(); - } - - private void storeValues() { - ICDISession session = getElement().getAdapter( ICDISession.class ); - final ICDITarget target = getElement().getAdapter( ICDITarget.class ); - if ( session instanceof Session ) { - final boolean solibUpdate = fRefreshSolibsButton.getSelection(); - final Session miSession = ((Session)session); - miSession.getSharedLibraryManager().setAutoUpdate( solibUpdate ); - if ( target.isSuspended() && solibUpdate ) { - DebugPlugin.getDefault().asyncExec( new Runnable() { - - @Override - public void run() { - if ( target.isSuspended() ) { - if ( solibUpdate ) { - try { - miSession.getSharedLibraryManager().update(); - } - catch( CDIException e ) { - } - } - } - } - } ); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.java deleted file mode 100644 index eabe4d9dce6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.java +++ /dev/null @@ -1,37 +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.internal.ui.propertypages; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Comment for . - */ -public class PropertyMessages { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.propertypages.PropertyMessages";//$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); - - private PropertyMessages() { - } - - 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.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties deleted file mode 100644 index d47a940b7d7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties +++ /dev/null @@ -1,11 +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 -############################################################################### -OptionsPropertyPage.1=Automatically refresh modules diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/IMILaunchConfigurationComponent.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/IMILaunchConfigurationComponent.java deleted file mode 100644 index c363b9eeaf0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/IMILaunchConfigurationComponent.java +++ /dev/null @@ -1,84 +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.ui; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * The common interface for UI components of the launch configuration tabs. - */ -public interface IMILaunchConfigurationComponent { - - /** - * Creates the top level control for this component under the given parent composite. - * <p> - * Implementors are responsible for ensuring that the created control can be accessed via <code>getControl</code> - * </p> - * - * @param parent the parent composite - */ - public void createControl( Composite parent ); - - /** - * Returns the top level control for this component. - * <p> - * May return <code>null</code> if the control has not been created yet. - * </p> - * - * @return the top level control or <code>null</code> - */ - public Control getControl(); - - /** - * Initializes the given component with default values. - * This method may be called before this tab's control is created. - * - * @param configuration launch configuration - */ - public void setDefaults( ILaunchConfigurationWorkingCopy configuration ); - - /** - * Initializes this component's controls with values from the given - * launch configuration. - * - * @param configuration launch configuration - */ - public void initializeFrom( ILaunchConfiguration configuration ); - - /** - * Notifies this component that it has been disposed. - * Marks the end of this component's lifecycle, allowing - * to perform any cleanup required. - */ - public void dispose(); - - /** - * Copies values from this component into the given launch configuration. - * - * @param configuration launch configuration - */ - public void performApply( ILaunchConfigurationWorkingCopy configuration ); - - /** - * Returns whether this component is in a valid state in the context - * of the specified launch configuration. - * - * @param launchConfig launch configuration which provides context - * for validating this component. - * This value must not be <code>null</code>. - * - * @return whether this component is in a valid state - */ - public boolean isValid(ILaunchConfiguration launchConfig); -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/MIUIUtils.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/MIUIUtils.java deleted file mode 100644 index b0277bba31d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/MIUIUtils.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.ui; - -import org.eclipse.cdt.debug.mi.internal.ui.GDBSolibBlock; -import org.eclipse.cdt.debug.mi.internal.ui.SolibSearchPathBlock; -import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IListAdapter; - -/** - * This class provides utilities for clients of the MI UI. - */ -public class MIUIUtils { - - public static IMILaunchConfigurationComponent createGDBSolibBlock( IMILaunchConfigurationComponent solibSearchBlock, boolean autoSolib, boolean stopOnSolibEvents ) { - return new GDBSolibBlock( solibSearchBlock, autoSolib, stopOnSolibEvents ); - } - - public static IMILaunchConfigurationComponent createGDBSolibBlock( boolean autoSolib, boolean stopOnSolibEvents ) { - return new GDBSolibBlock( new SolibSearchPathBlock(), autoSolib, stopOnSolibEvents ); - } - - public static IMILaunchConfigurationComponent createSolibSearchPathBlock( String[] customButtonLabels, IListAdapter listAdapter ) { - return new SolibSearchPathBlock( customButtonLabels, listAdapter ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java deleted file mode 100644 index 98a30180bb5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2012 STMicroelectronics and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * STMicroelectronics - Process console enhancements - * Alena Laskavaia (QNX) - Fix for 186172 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.ui.console; - -import java.util.Observable; -import java.util.Observer; - -import org.eclipse.cdt.debug.mi.core.GDBProcess; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleSaveAction; -import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleVerboseModeAction; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.jface.action.Separator; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.console.IConsoleConstants; -import org.eclipse.ui.console.IConsolePageParticipant; -import org.eclipse.ui.part.IPageBookViewPage; -import org.eclipse.ui.console.IConsole; - -/** - * Enhances ProcessConsole when the process attached is a GDBProcess - * @since 6.1 - * - */ -public class MiConsolePageParticipant implements IConsolePageParticipant, IDebugEventSetListener, Observer { - - private MiConsoleSaveAction fSaveConsole = null; - private MiConsoleVerboseModeAction fVerboseMode = null; - private org.eclipse.debug.ui.console.IConsole fConsole = null; - private org.eclipse.cdt.debug.mi.core.GDBProcess GDBProcess = null; - - @Override - public void activated() { - } - - @Override - public void deactivated() { - } - - @Override - public void dispose() { - if (GDBProcess != null) { - DebugPlugin.getDefault().removeDebugEventListener(this); - } - fSaveConsole = null; - fVerboseMode = null; - GDBProcess = null; - fConsole = null; - } - - @Override - public void init(IPageBookViewPage page, IConsole console) { - - if(console instanceof org.eclipse.debug.ui.console.IConsole) - { - fConsole = (org.eclipse.debug.ui.console.IConsole) console; - if(fConsole.getProcess() instanceof GDBProcess) { - - GDBProcess = (GDBProcess) fConsole.getProcess(); - - // add two new actions: save console content and verbose console mode switcher - IActionBars bars = page.getSite().getActionBars(); - bars.getToolBarManager().appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator()); - fSaveConsole = new MiConsoleSaveAction(fConsole); - bars.getToolBarManager().appendToGroup(IConsoleConstants.OUTPUT_GROUP, fSaveConsole); - fVerboseMode = new MiConsoleVerboseModeAction(fConsole); - bars.getToolBarManager().appendToGroup(IConsoleConstants.OUTPUT_GROUP, fVerboseMode); - bars.getToolBarManager().appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator()); - - // add a debug event listener - DebugPlugin.getDefault().addDebugEventListener(this); - // if we miss change event update enablement manually - fVerboseMode.updateStateAndEnablement(); - Target target = GDBProcess.getTarget(); - if (target != null) { - // register this object as MISession observer - target.getMISession().addObserver(this); - } - } - } - } - - @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - return null; - } - - @Override - public void handleDebugEvents(DebugEvent[] events) { - for (int i = 0; i < events.length; i++) { - DebugEvent event = events[i]; - if (event.getSource().equals(GDBProcess)) { - if (fVerboseMode != null) { - fVerboseMode.updateStateAndEnablement(); - Target target = GDBProcess.getTarget(); - if (target != null) { - // register this object as MISession observer - target.getMISession().addObserver(this); - } - } - } - } - } - - /** - * Handle MISession notification - */ - @Override - public void update(Observable arg0, Object arg1) { - if((arg1!=null) && (arg1 instanceof VerboseModeChangedEvent) && (fVerboseMode != null)) { - try { - fVerboseMode.updateStateAndEnablement(); - } catch (Exception e) { - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/VerboseModeChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/VerboseModeChangedEvent.java deleted file mode 100644 index 3db6cb4c84a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/VerboseModeChangedEvent.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 STMicroelectronics. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * STMicroelectronics - Process console enhancements - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.ui.console; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; - -/** - * MISession event, verbose console mode changed - * @since 6.1 - * - */ -public class VerboseModeChangedEvent extends MIEvent { - - private static final long serialVersionUID = 1L; - - public VerboseModeChangedEvent(MISession session, int token) { - super(session, token); - setPropagate(false); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/IMiConsoleImagesConst.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/IMiConsoleImagesConst.java deleted file mode 100644 index 5459ce6312d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/IMiConsoleImagesConst.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2014 STMicroelectronics. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * STMicroelectronics - Process console enhancements - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.ui.console.actions; - -/** @since 6.2 */ -public interface IMiConsoleImagesConst { - - public static final String IMG_SAVE_CONSOLE = "icons/obj16/save_console.gif"; //$NON-NLS-1$ - public static final String IMG_VERBOSE_CONSOLE = "icons/obj16/verbose_mode_co.gif"; //$NON-NLS-1$ -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleMessages.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleMessages.java deleted file mode 100644 index 37f1157cd4b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleMessages.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2014 STMicroelectronics. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * STMicroelectronics - Process console enhancements - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.ui.console.actions; - -import org.eclipse.osgi.util.NLS; - -/** @since 6.2 */ -public class MiConsoleMessages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleMessages"; //$NON-NLS-1$ - - public static String saveActionTooltip; - public static String verboseActionTooltip; - - public static String confirmOverWrite; - public static String infoIOError; - - static { - // load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, MiConsoleMessages.class); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleMessages.properties deleted file mode 100644 index 4ac24931069..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleMessages.properties +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2006 STMicroelectronics -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# STMicroelectronics - initial API and implementation -############################################################################### -saveActionTooltip=Save console content -verboseActionTooltip=Verbose console mode -confirmOverWrite=File exists, do you want overwrite it? -infoIOError=Error during save console content. Task failed. diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleSaveAction.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleSaveAction.java deleted file mode 100644 index 1a226d9516e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleSaveAction.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2014 STMicroelectronics. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * STMicroelectronics - Process console enhancements - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.ui.console.actions; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin; -import org.eclipse.debug.ui.console.IConsole; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.FileDialog; - -/** - * Save console content - * @since 6.2 - */ -public class MiConsoleSaveAction extends Action{ - - private IConsole fConsole; - private String fileName; - - public MiConsoleSaveAction(IConsole console) { - super(); - setToolTipText(MiConsoleMessages.saveActionTooltip); - setImageDescriptor(MIUIPlugin.imageDescriptorFromPlugin(MIUIPlugin.PLUGIN_ID,IMiConsoleImagesConst.IMG_SAVE_CONSOLE)); - fConsole = console; - } - - @Override - public void run() { - - FileDialog fileDialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE); - fileName = fileDialog.open(); - if(fileName==null) { - return; - } - - Runnable saveJob = new Runnable() { - @Override - public void run() { - saveContent(); - } - }; - BusyIndicator.showWhile(Display.getCurrent(), saveJob); - - } - - protected void saveContent() { - boolean confirmed = true; - - try { - File f = new File(fileName); - if(f.exists()) { - confirmed = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Confirm overwrite", MiConsoleMessages.confirmOverWrite); - } - if(confirmed) { - BufferedWriter out = new BufferedWriter(new FileWriter(fileName)); - out.write(fConsole.getDocument().get()); - out.close(); - } - } catch (IOException e) { - MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error",MiConsoleMessages.infoIOError); - } - - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java deleted file mode 100644 index 43861f18aa4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2014 STMicroelectronics and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * STMicroelectronics - Process console enhancements - * Alena Laskavaia (QNX) - Fix for 186172 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.ui.console.actions; - -import org.eclipse.cdt.debug.mi.core.GDBProcess; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin; -import org.eclipse.debug.ui.console.IConsole; -import org.eclipse.jface.action.Action; - -/** - * Verbose console mode switcher - * @since 6.2 - */ -public class MiConsoleVerboseModeAction extends Action { - private IConsole fConsole; - - public MiConsoleVerboseModeAction(IConsole console) { - super(); - setToolTipText(MiConsoleMessages.verboseActionTooltip); - setImageDescriptor(MIUIPlugin.imageDescriptorFromPlugin(MIUIPlugin.PLUGIN_ID, IMiConsoleImagesConst.IMG_VERBOSE_CONSOLE)); - fConsole = console; - } - - public void updateStateAndEnablement() { - // initialize button - GDBProcess gdbProcess = (GDBProcess) fConsole.getProcess(); - setEnabled(!gdbProcess.isTerminated()); - Target target = gdbProcess.getTarget(); - if (target != null) { - setChecked(target.isVerboseModeEnabled()); - } else { - setChecked(false); - } - } - - @Override - public void run() { - GDBProcess fProcess = (GDBProcess) fConsole.getProcess(); - fProcess.getTarget().enableVerboseMode(isChecked()); - } - -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/.classpath b/debug/org.eclipse.cdt.debug.ui.tests/.classpath deleted file mode 100644 index 008f088c0bc..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="core"/> - <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.ui.tests/.cvsignore b/debug/org.eclipse.cdt.debug.ui.tests/.cvsignore deleted file mode 100644 index ba077a4031a..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/debug/org.eclipse.cdt.debug.ui.tests/.project b/debug/org.eclipse.cdt.debug.ui.tests/.project deleted file mode 100644 index 05c3409f881..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.cdt.debug.ui.tests</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> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - </natures> -</projectDescription> diff --git a/debug/org.eclipse.cdt.debug.ui.tests/.settings/org.eclipse.jdt.core.prefs b/debug/org.eclipse.cdt.debug.ui.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f1a5b0952d1..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,57 +0,0 @@ -#Mon Jan 28 09:57:10 CST 2008 -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.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=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=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=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/debug/org.eclipse.cdt.debug.ui.tests/Changelog b/debug/org.eclipse.cdt.debug.ui.tests/Changelog deleted file mode 100644 index 89f305af7cf..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/Changelog +++ /dev/null @@ -1,69 +0,0 @@ -2005-07-22 Alain Magloire
- Fix to Copyright.
-
-2004-10-17 Alain Magloire
- Remove deprecated method in CDI adjust the implementation.
- * core/org/eclipse/cdt/debug/core/tests/BreakpointTests.java
- * core/org/eclipse/cdt/debug/core/tests/DebugTests.java
- * core/org/eclipse/cdt/debug/core/tests/LocationTests.java
-
-2004-10-15 Alain Magloire
- Adjust to the change in the CDI
- * core/org/eclipse/cdt/debug/core/tests/BreakpointTests.java
- * core/org/eclipse/cdt/debug/core/tests/DebugTests.java
- * core/org/eclipse/cdt/debug/core/tests/LocationTests.java
-
-2004-09-07 Mikhail Khodjaiants
- Moved to the new breakpoint management API.
- * core/org/eclipse/cdt/debug/core/tests/BreakpointTests.java
- * core/org/eclipse/cdt/debug/core/tests/DebugTests.java
- * core/org/eclipse/cdt/debug/core/tests/LocationTests.java
-
-2003-07-03 Peter Graves
-
- Major cleanup. Pulled all resouces out of the source tree, and fixed the
- tests to get them from the new location.
- Made sure the debug sessions were all terminated before we try to delete the
- the projects (if the tests failed, the session would not be terminated, and
- then we would not be able to remove the projects.)
- Also updated the breakpoint tests to only create and build the test project
- once per run, not once per test method.
-
-2003-04-04 Alain Magloire
-
- * src/org/eclipse/cdt/debug/testplugin/util/VeryfyDialog.java:
- Get rig of some warnings.
-
-2003-03-27 Alain Magloire
-
- Adjust the code because of refactoring.
- ICFolder and ICResource are removed.
-
-2003-01-29 Peter Graves
-
- Fixed warnings when accessing static methods
- * src/org/eclipse/cdt/debug/testplugin/util/DialogCheck.java:
- * src/org/eclipse/cdt/debug/testplugin/CTestPlugin.java:
- * src/org/eclipse/cdt/debug/testplugin/TestWorkbench.java:
- * ChangeLog: Make all the entries have the same formatting
-
-2003-01-22 Judy N. Green
-
- * /home/tools/org.eclipse.cdt.debug.ui.tests/.project
- * /home/tools/org.eclipse.cdt.debug.ui.tests/.classpath
- updated classpath and .project to reflect classpath changes.
-
-2003-01-21 Peter Graves
-
- * src/org/eclipse/cdt/debug/testplugin/CDebugHelper.java: Updated to use new parameters to
- ICDISession.createCSession
-
-2002-12-17 Peter Graves
-
- * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and
- to move closer to automated running.
-
-2002-10-30 Alain Magloire
-
- * core/org/eclipse/cdt/debug/core/tests/TargetTests.java: Test number
- 24183 is no longer valid, the method was remove from the CDI API.
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui.tests/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui.tests/META-INF/MANIFEST.MF deleted file mode 100644 index 822f1872118..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,22 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: org.eclipse.cdt.debug.ui.tests -Bundle-SymbolicName: org.eclipse.cdt.debug.ui.tests;singleton:=true -Bundle-Version: 6.0.0.qualifier -Bundle-Activator: org.eclipse.core.internal.compatibility.PluginActivator -Export-Package: org.eclipse.cdt.debug.core.tests, - org.eclipse.cdt.debug.testplugin, - org.eclipse.cdt.debug.testplugin.util -Require-Bundle: org.eclipse.ui.ide, - org.eclipse.core.resources, - org.junit, - org.eclipse.cdt.debug.core, - org.eclipse.cdt.debug.mi.core, - org.eclipse.cdt.core, - org.eclipse.ui, - org.eclipse.core.runtime.compatibility, - org.eclipse.cdt.gdb;bundle-version="7.0.0" -Bundle-ActivationPolicy: lazy -Plugin-Class: org.eclipse.cdt.debug.testplugin.CTestPlugin -Bundle-Vendor: Eclipse CDT -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/debug/org.eclipse.cdt.debug.ui.tests/about.html b/debug/org.eclipse.cdt.debug.ui.tests/about.html deleted file mode 100644 index 9c7ba0a57bc..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/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>May 2, 2006</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.ui.tests/build.properties b/debug/org.eclipse.cdt.debug.ui.tests/build.properties deleted file mode 100644 index 643f886aac7..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2008 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 -############################################################################### -source.. = src/,\ - core/ -bin.includes = about.html,\ - plugin.xml,\ - resources/,\ - .,\ - test.xml,\ - META-INF/ diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/.cvsignore b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/.cvsignore deleted file mode 100644 index e69de29bb2d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/.cvsignore +++ /dev/null diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AbstractDebugTest.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AbstractDebugTest.java deleted file mode 100644 index d2117d8784b..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AbstractDebugTest.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.core.tests; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -import junit.extensions.TestSetup; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.testplugin.CDebugHelper; -import org.eclipse.cdt.debug.testplugin.CProjectHelper; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; - -public abstract class AbstractDebugTest extends TestCase { - IWorkspace workspace; - IWorkspaceRoot root; - NullProgressMonitor monitor; - static ICProject testProject = null; - static ICDISession session = null; - static ICDITarget targets[] = null; - ICDITarget currentTarget; - static boolean oneTimeSetupDone = false; - - @Override - protected void setUp() throws Exception { - super.setUp(); - if (oneTimeSetupDone == false) { - oneTimeSetUp(); // this can happened when run junit failed test from UI, without invoking suite() - oneTimeSetupDone = false; // re-set it back so tarDownOnes will run - } - /*********************************************************************** - * The tests assume that they have a working workspace and workspace - * root object to use to create projects/files in, so we need to get - * them setup first. - */ - workspace = ResourcesPlugin.getWorkspace(); - root = workspace.getRoot(); - monitor = new NullProgressMonitor(); - if (workspace == null) - fail("Workspace was not setup"); //$NON-NLS-1$ - if (root == null) - fail("Workspace root was not setup"); //$NON-NLS-1$ - } - - void createDebugSession() throws IOException, MIException, CModelException { - session = CDebugHelper.createSession(getProjectBinary(), testProject); - assertNotNull(session); - targets = session.getTargets(); - assertNotNull(targets); - assertTrue(targets.length > 0); - currentTarget = targets[0]; - } - - /** - * Sets up the test fixture. - * - * Called before every test case method. - * - * Example code test the packages in the project - * "com.qnx.tools.ide.cdt.core" - */ - protected void oneTimeSetUp() throws CoreException, InvocationTargetException, IOException { - ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false); - /*********************************************************************** - * Create a new project and import the test source. - */ - Path imputFile = new Path(getProjectZip()); - testProject = CProjectHelper.createCProjectWithImport(getProjectName(), imputFile); - if (testProject == null) - fail("Unable to create project"); //$NON-NLS-1$ - /* Build the test project.. */ - - testProject.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); - oneTimeSetupDone = true; - } - - protected String getProjectName() { - return "filetest"; - } - - protected String getProjectZip() { - return "resources/debugTest.zip"; - } - - protected String getProjectBinary() { - return "main"; - } - - - public static Display getDisplay() { - return PlatformUI.getWorkbench().getDisplay(); - } - /** - * Dispatch ui events for at least msec - milliseconds - * - * @param msec - - * milliseconds delay - */ - public static void uimsleep(int msec) { - long cur = System.currentTimeMillis(); - long pass = 0; - Display display = getDisplay(); - while (pass < msec) { - if (!display.readAndDispatch()) - display.sleep(); - pass = System.currentTimeMillis() - cur; - } - } - /** - * Tears down the test fixture. - * - * Called after every test case method. - */ - protected void oneTimeTearDown() throws CoreException { - if (targets != null) { - try { - targets[0].terminate(); - } catch (CDIException e) { - } - } - if (session != null) { - try { - session.terminate(); - } catch (CDIException e) { - } - } - CProjectHelper.delete(testProject); - if (oneTimeSetupDone == false) { - oneTimeTearDown(); // this can happened when run junit failed test from UI, without invoking suite() - } - - } - - static class DebugTestWrapper extends TestSetup { - private AbstractDebugTest newInstance; - - public DebugTestWrapper(Class clazz) { - super(new TestSuite(clazz)); - /*********************************************************************** - * Create a wrapper suite around the test suite we created above to - * allow us to only do the general setup once for all the tests. This is - * needed because the creation of the source and target projects takes a - * long time and we really only need to do it once. We could do the - * setup in the constructor, but we need to be able to remove everything - * when we are done. - */ - try { - newInstance = (AbstractDebugTest) clazz.newInstance(); - } catch (Exception e) { - throw new IllegalArgumentException(e); - } - } - - @Override - protected void setUp() throws FileNotFoundException, IOException, InterruptedException, - InvocationTargetException, CoreException { - newInstance.oneTimeSetUp(); - } - - @Override - protected void tearDown() throws FileNotFoundException, IOException, CoreException { - newInstance.oneTimeTearDown(); - } - } - - void pause() { - uimsleep(200); - } - - public ICDILocator getCurrentLocator() throws CDIException { - return getCurrentFrame().getLocator(); - } - - public ICDIStackFrame getCurrentFrame() throws CDIException { - return currentTarget.getCurrentThread().getStackFrames()[0]; - } - - void waitSuspend(ICDITarget currentTarget) { - int loop; - loop = 0; - while ((currentTarget.isSuspended() == false) && (currentTarget.isTerminated() == false) && (loop < 20)) { - uimsleep(500); - loop++; - } - assertFalse("Target should be suspended, but it is terminated " + currentTarget.isTerminated(), currentTarget - .isTerminated()); - assertTrue("Target should be suspended but it is not", currentTarget.isSuspended()); - - } - - public void resumeCurrentTarget() throws CDIException{ - currentTarget.resume(false); - } - - void setBreakOnMain() throws CDIException { - ICDILocation location = null; - location = currentTarget.createFunctionLocation("", "main"); //$NON-NLS-1$ - currentTarget.setFunctionBreakpoint(ICBreakpointType.TEMPORARY, (ICDIFunctionLocation) location, null, false); - } - - @Override - protected void tearDown() throws Exception { - /* clean up the session */ - if (session == null) { - session.terminate(); - session = null; - } - super.tearDown(); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java deleted file mode 100644 index b6e11c85928..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java +++ /dev/null @@ -1,41 +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.core.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - - -/** - * - * AllDedbugTests.java - * This is the main entry point for running this suite of JUnit tests - * for all tests within the package "org.eclipse.cdt.debug.core" - * - * @author Judy N. Green - * @since Jul 19, 2002 - */ -public class AllDebugTests extends TestSuite { - - public static Test suite() { - TestSuite suite = new AllDebugTests(); - - // Just add more test cases here as you create them for - // each class being tested - - suite.addTest(DebugTests.suite()); - suite.addTest(BreakpointTests.suite()); - suite.addTest(LocationTests.suite()); - suite.addTest(EventBreakpointTests.suite()); - return suite; - } -} // End of AllDebugTests.java - diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/BreakpointTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/BreakpointTests.java deleted file mode 100644 index d7acdc6bded..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/BreakpointTests.java +++ /dev/null @@ -1,616 +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.core.tests; - -import java.io.IOException; -import java.math.BigInteger; - -import junit.framework.Test; - -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.ICDIBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.core.runtime.CoreException; - -/** - * @author Peter Graves - * - * This file contains a set of generic tests for the CDI break point interfaces. - * It will currenly use the mi implementation. - * - */ -public class BreakpointTests extends AbstractDebugTest { - - - public static Test suite() { - return new DebugTestWrapper(BreakpointTests.class) {}; - } - @Override - protected void setUp() throws Exception { - super.setUp(); - createDebugSession(); - assertNotNull(currentTarget); - currentTarget.deleteAllBreakpoints(); - pause(); - } - @Override - protected void tearDown() throws Exception { - /* clean up the session */ - targets[0].terminate(); - int x = 0; - while ((!targets[0].isTerminated()) && (x < 30)) { - Thread.sleep(100); - } - if (!targets[0].isTerminated()) - targets[0].terminate(); - super.tearDown(); - } - - - /*************************************************************************** - * A couple tests to make sure setting breakpoints on functions works as - * expected. - */ - public void testFunctionBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException { - - ICDITarget cdiTarget = currentTarget; - ICDIFunctionLocation location; - boolean caught = false; - - - /*********************************************************************** - * Create a break point on a generic function - **********************************************************************/ - - location = cdiTarget.createFunctionLocation(null, "func1"); //$NON-NLS-1$ - assertNotNull(location); - cdiTarget.setFunctionBreakpoint(0, location, null, false); - - /*********************************************************************** - * Create a break point on main - **********************************************************************/ - - location = cdiTarget.createFunctionLocation(null, "main"); //$NON-NLS-1$ - assertNotNull(location); - cdiTarget.setFunctionBreakpoint(0, location, null, false); - - /*********************************************************************** - * Try to create a break point on a function name that does not exist We - * expect that this will cause the setLocationBreakpoint to throw a - * CDIException - **********************************************************************/ - - location = cdiTarget.createFunctionLocation(null, "badname"); //$NON-NLS-1$ - assertNotNull(location); - try { - cdiTarget.setFunctionBreakpoint(0, location, null, false); - } catch (CDIException e) { - caught = true; - } - assertTrue(caught); - - cdiTarget.deleteAllBreakpoints(); - - /*********************************************************************** - * Create a break point on a generic function and see if it will get hit - * and stop program execution. - **********************************************************************/ - - location = cdiTarget.createFunctionLocation(null, "func1"); //$NON-NLS-1$ - assertNotNull(location); - cdiTarget.setFunctionBreakpoint(0, location, null, false); - targets = session.getTargets(); - /* - * We better only have one target connected to this session or something - * is not right... - */ - assertTrue(targets.length == 1); - /* - * Resume the target, this should cause it to run till it hits the - * breakpoint - */ - resumeCurrentTarget(); - /** - * Give the process up to 10 seconds to become either terminated or - * suspended. It sould hit the breakponint almost immediatly so we - * should only sleep for max 100 ms - */ - waitSuspend(cdiTarget); - ICDILocator locator = getCurrentLocator(); - assertTrue(locator.getLineNumber() == 6); - assertTrue(locator.getFunction().equals("func1")); //$NON-NLS-1$ - assertTrue(locator.getFile().endsWith("main.c")); //$NON-NLS-1$ - } - - /*************************************************************************** - * A couple tests to make sure setting breakpoints on line numbers works as - * expected. - */ - public void testLineBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException { - ICDITarget cdiTarget = currentTarget; - ICDILineLocation location; - boolean caught = false; - - - /*********************************************************************** - * Create a break point in a generic function - **********************************************************************/ - location = cdiTarget.createLineLocation("main.c", 7); - assertNotNull(location); - cdiTarget.setLineBreakpoint(0, location, null, false); - - /*********************************************************************** - * Create a break point in main - **********************************************************************/ - location = cdiTarget.createLineLocation("main.c", 18); - assertNotNull(location); - cdiTarget.setLineBreakpoint(0, location, null, false); - - /*********************************************************************** - * Try to create a break point on a line that does not exist We expect - * that this will cause the setLocationBreakpoint to throw a - * CDIException - **********************************************************************/ - - location = cdiTarget.createLineLocation("main.c", 30); - assertNotNull(location); - try { - cdiTarget.setLineBreakpoint(0, location, null, false); - } catch (CDIException e) { - caught = true; - } - assertTrue(caught); - - caught = false; - /*********************************************************************** - * Try to create a break point on a line that does not have code on it - **********************************************************************/ - - location = cdiTarget.createLineLocation("main.c", 11); - assertNotNull(location); - cdiTarget.setLineBreakpoint(0, location, null, false); - - /*********************************************************************** - * Create a break point in a generic function without passing the source - * file name. At the time of writing this would just silently fail, so - * to make sure it works, we will do it once with a valid line number - * and once with an invalid line number, and the first should always - * succeed and the second should always throw an exception. - **********************************************************************/ - location = cdiTarget.createLineLocation(null, 7); - assertNotNull(location); - cdiTarget.setLineBreakpoint(0, location, null, false); - caught = false; - location = cdiTarget.createLineLocation(null, 30); - assertNotNull(location); - try { - cdiTarget.setLineBreakpoint(0, location, null, false); - } catch (CDIException e) { - caught = true; - } - assertTrue("Ignoring line numbers with no file specified?", caught); - - cdiTarget.deleteAllBreakpoints(); - - /*********************************************************************** - * Create a break point on a line number and see if it will get hit and - * stop program execution. - **********************************************************************/ - - location = cdiTarget.createLineLocation(null, 7); - assertNotNull(location); - cdiTarget.setLineBreakpoint(0, location, null, false); - targets = session.getTargets(); - /* - * We better only have one target connected to this session or something - * is not right... - */ - assertTrue(targets.length == 1); - /* - * Resume the target, this should cause it to run till it hits the - * breakpoint - */ - targets[0].resume(); - /** - * Give the process up to 10 seconds to become either terminated or - * suspended. It sould hit the breakponint almost immediatly so we - * should only sleep for max 100 ms - */ - for (int x = 0; x < 100; x++) { - if (targets[0].isSuspended() || targets[0].isTerminated()) - break; - Thread.sleep(100); - } - assertTrue("Suspended: " + targets[0].isSuspended() + " Termiunated: " + targets[0].isTerminated(), targets[0] - .isSuspended()); - ICDILocator locator = getCurrentLocator(); - assertTrue(locator.getLineNumber() == 7); - assertTrue(locator.getFunction().equals("func1")); - assertTrue(locator.getFile().endsWith("main.c")); - - } - - /*************************************************************************** - * A couple tests to make sure getting breakpoints works as expected - */ - public void testGetBreak() throws CoreException, MIException, IOException, CDIException { - ICDITarget cdiTarget = currentTarget; - ICDIFunctionLocation location; - ICDIBreakpoint[] breakpoints; - ICDILocationBreakpoint curbreak; - - - /*********************************************************************** - * Make sure initially we don't have any breakpoints - **********************************************************************/ - breakpoints = cdiTarget.getBreakpoints(); - assertNotNull(breakpoints); - assertTrue(breakpoints.length == 0); - - /*********************************************************************** - * Make sure if we create a simple breakpoint, that we can get it back - * from the system - **********************************************************************/ - /* Create a break point on a generic function */ - location = cdiTarget.createFunctionLocation("main.c", "func1"); - assertNotNull(location); - cdiTarget.setFunctionBreakpoint(0, location, null, false); - - breakpoints = cdiTarget.getBreakpoints(); - assertNotNull(breakpoints); - assertTrue(breakpoints.length == 1); - if (breakpoints[0] instanceof ICDILocationBreakpoint) { - curbreak = (ICDILocationBreakpoint) breakpoints[0]; - } else - curbreak = null; - assertNotNull(curbreak); - - //assertTrue(curbreak.getLocator().equals(location)); - { - ICDILocator locator = curbreak.getLocator(); - String file = locator.getFile(); - String function = locator.getFunction(); - assertTrue("main.c".equals(file)); - assertTrue("func1".equals(function)); - } - - /*********************************************************************** - * Make sure if we create multiple break points that we can still get - * them all back from the system, - **********************************************************************/ - /* Create another break point on main */ - location = cdiTarget.createFunctionLocation("main.c", "main"); - assertNotNull(location); - cdiTarget.setFunctionBreakpoint(0, location, null, false); - - breakpoints = cdiTarget.getBreakpoints(); - assertNotNull(breakpoints); - assertTrue(breakpoints.length == 2); - if (breakpoints[1] instanceof ICDILocationBreakpoint) { - curbreak = (ICDILocationBreakpoint) breakpoints[1]; - } else - curbreak = null; - assertNotNull(curbreak); - /* - * Make sure the location still looks like we expect it to.. . - */ - //assertTrue(curbreak.getLocation().equals(location)); - { - ICDILocator locator = curbreak.getLocator(); - String file = locator.getFile(); - String function = locator.getFunction(); - assertTrue("main.c".equals(file)); - assertTrue("main".equals(function)); - } - - cdiTarget.deleteAllBreakpoints(); - - - } - - /*************************************************************************** - * A couple tests to make sure deleting breakpoints works as expected - */ - public void testDelBreak() throws CoreException, MIException, IOException, CDIException { - ICDITarget cdiTarget = currentTarget; - ICDIFunctionLocation location; - ICDILocator savedLocation; - ICDIBreakpoint[] breakpoints, savedbreakpoints; - ICDILocationBreakpoint curbreak; - - /* Make sure initially we don't have any breakpoints */ - breakpoints = cdiTarget.getBreakpoints(); - assertNotNull(breakpoints); - assertTrue(breakpoints.length == 0); - - /*********************************************************************** - * - * Test to make sure if we create a new breakpoint, we can delete it by - * passing a refrence to it to deleteBreakpoint() - * - **********************************************************************/ - - /* Create a break point on a generic function */ - location = cdiTarget.createFunctionLocation("main.c", "func1"); - assertNotNull(location); - curbreak = cdiTarget.setFunctionBreakpoint(0, location, null, false); - cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } ); - pause(); - /** - * we should not have any breakpoints left. - */ - breakpoints = cdiTarget.getBreakpoints(); - assertTrue(breakpoints.length == 0); - - /*********************************************************************** - * - * Test to make sure if we create multiple new breakpoint, we can delete - * one of them by passing a refrence to it to deleteBreakpoint() - * - **********************************************************************/ - - /* Create a break point on a generic function */ - location = cdiTarget.createFunctionLocation("main.c", "func1"); - assertNotNull(location); - curbreak = cdiTarget.setFunctionBreakpoint(0, location, null, false); - savedLocation = curbreak.getLocator(); - - location = cdiTarget.createFunctionLocation("main.c", "main"); - assertNotNull(location); - curbreak = cdiTarget.setFunctionBreakpoint(0, location, null, false); - cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } ); - pause(); - breakpoints = cdiTarget.getBreakpoints(); - /*********************************************************************** - * Make sure there is only 1 breakpoint left, and it's the one we expect - */ - assertTrue(breakpoints.length == 1); - curbreak = (ICDILocationBreakpoint) breakpoints[0]; - assertNotNull(curbreak); - assertTrue(curbreak.getLocator().equals(savedLocation)); - /*********************************************************************** - * Then delete the other breakpoint. - */ - cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } ); - pause(); - breakpoints = cdiTarget.getBreakpoints(); - assertTrue(breakpoints.length == 0); - - /*********************************************************************** - * Make sure deleteBreakpoints works when given 1 breakpoint to delete - **********************************************************************/ - savedbreakpoints = new ICDIBreakpoint[1]; - int lineStart = 6; - int maxBreakpoints = 5; - for (int x = 0; x < maxBreakpoints; x++) { - ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart); - ICDILocationBreakpoint bp = cdiTarget.setLineBreakpoint(0, lineLocation, null, false); - assertNotNull(bp); - assertEquals(x + lineStart, (bp.getLocator().getLineNumber())); - savedbreakpoints[0] = bp; - } - cdiTarget.deleteBreakpoints(savedbreakpoints); - pause(); - /* We should now have N-1 breakpoints left. */ - breakpoints = cdiTarget.getBreakpoints(); - assertTrue(breakpoints.length == maxBreakpoints-1); - /* Make sure we have the correct N-1 breakpoints left, we deleted one at line N */ - for (int x = 0; x < breakpoints.length; x++) { - curbreak = (ICDILocationBreakpoint) breakpoints[x]; - assertNotEquals(((ICDILocationBreakpoint)savedbreakpoints[0]).getLocator().getLineNumber(), curbreak.getLocator().getLineNumber()); - } - cdiTarget.deleteAllBreakpoints(); - pause(); - assertTrue(cdiTarget.getBreakpoints().length == 0); - - /*********************************************************************** - * Make sure deleteBreakpoints works when given more then 1 but less - * then all breakpoints to delete - **********************************************************************/ - savedbreakpoints = new ICDIBreakpoint[2]; - for (int x = 0; x < maxBreakpoints; x++) { - ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart); - savedbreakpoints[x % 2] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false); - assertNotNull(savedbreakpoints[x % 2]); - } - cdiTarget.deleteBreakpoints(savedbreakpoints); - pause(); - - /* We should now have maxBreakpoints-2 breakpoints left. */ - breakpoints = cdiTarget.getBreakpoints(); - assertEquals(maxBreakpoints-2, breakpoints.length ); - /* Make sure we have the correct 6 breakpoints left */ - for (int x = 0; x < breakpoints.length; x++) { - curbreak = (ICDILocationBreakpoint) breakpoints[x]; - assertEquals(x+lineStart, curbreak.getLocator().getLineNumber()); - } - cdiTarget.deleteAllBreakpoints(); - pause(); - assertTrue(cdiTarget.getBreakpoints().length == 0); - - /*********************************************************************** - * Make sure deleteBreakpoints works when given all the breakpoints - **********************************************************************/ - savedbreakpoints = new ICDIBreakpoint[maxBreakpoints]; - for (int x = 0; x < maxBreakpoints; x++) { - ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart); - savedbreakpoints[x] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false); - assertNotNull(savedbreakpoints[x]); - } - cdiTarget.deleteBreakpoints(savedbreakpoints); - pause(); - /* We should now have 0 breakpoints left. */ - breakpoints = cdiTarget.getBreakpoints(); - assertTrue(breakpoints.length == 0); - - /*********************************************************************** - * Make sure deleteAllBreakpoints works - **********************************************************************/ - - for (int x = 0; x < maxBreakpoints; x++) { - ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart); - curbreak = cdiTarget.setLineBreakpoint(0, lineLocation, null, false); - assertNotNull(curbreak); - } - cdiTarget.deleteAllBreakpoints(); - pause(); - /* We should now have 0 breakpoints left. */ - breakpoints = cdiTarget.getBreakpoints(); - assertTrue(breakpoints.length == 0); - - } - - private void assertNotEquals(int notExpected, int actual) { - if (notExpected==actual) - fail("not expected:<"+actual+">"); - - } - /*************************************************************************** - * A couple tests to make sure setting breakpoints with conditions seems to - * work as expected. - */ - public void testCondBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException { - boolean caught = false; - ICDITarget cdiTarget = currentTarget; - ICDICondition cond; - - /*********************************************************************** - * Create a break point on a line number with a condition and make sure - * it does not suspend execution of the application until the condition - * is true - **********************************************************************/ - cdiTarget.deleteAllBreakpoints(); - pause(); - ICDILineLocation lineLocation = cdiTarget.createLineLocation(null, 23); - assertNotNull(lineLocation); - cond = cdiTarget.createCondition(0, "a>10"); - cdiTarget.setLineBreakpoint(0, lineLocation, cond, false); - pause(); - resumeCurrentTarget(); - /** - * Give the process up to 10 seconds to become either terminated or - * suspended. It sould hit the breakponint almost immediatly so we - * should only sleep for max 100 ms - */ - waitSuspend(cdiTarget); - ICDIStackFrame frame = getCurrentFrame(); - ICDILocator locator = getCurrentLocator(); - assertTrue(locator.getLineNumber() == 23); - assertTrue(locator.getFunction().equals("main")); - assertTrue(locator.getFile().endsWith("main.c")); - /* Get the value of a and and make sure it is 11 */ - assertTrue(targets[0].evaluateExpressionToString(frame, "a"), targets[0].evaluateExpressionToString(frame, "a").equals("11")); - - } - public void testCondBreak2() throws CoreException, MIException, IOException, CDIException, InterruptedException { - - ICDITarget cdiTarget = currentTarget; - - /*********************************************************************** - * Create a break point on a generic function with an empty condition - **********************************************************************/ - ICDICondition cond = cdiTarget.createCondition(0, ""); - ICDIFunctionLocation location = cdiTarget.createFunctionLocation(null, "func1"); - assertNotNull(location); - cdiTarget.setFunctionBreakpoint(0, location, cond, false); - - /*********************************************************************** - * Create a break point on a generic function with an valid condition - **********************************************************************/ - cond = cdiTarget.createCondition(0, "x<10"); - ICDILineLocation location2 = cdiTarget.createLineLocation("main.c", 9); - assertNotNull(location); - cdiTarget.setLineBreakpoint(0, location2, cond, false); - } - - public void testCondBreakError() { - ICDITarget cdiTarget = currentTarget; - ICDICondition cond; - ICDIFunctionLocation location; - /*********************************************************************** - * Create a break point on a generic function with an invalid condition - * We expect to get a CDIException when we try to set the breakpoint. - **********************************************************************/ - boolean caught = false; - cond = cdiTarget.createCondition(0, "nonexist<10"); - location = cdiTarget.createFunctionLocation(null, "func1"); - assertNotNull(location); - try { - cdiTarget.setFunctionBreakpoint(0, location, cond, false); - } catch (CDIException e) { - caught = true; - } - assertTrue("Setting wrong condition should fail",caught); - } - - public void testHitCond() throws CoreException, MIException, IOException, CDIException, InterruptedException { - setBreakOnMain(); - testCondBreak2(); - resumeCurrentTarget(); - waitSuspend(currentTarget); - } - public void xfail_testHitCondWithError() throws CoreException, MIException, IOException, CDIException, InterruptedException { - // this currently fails sometimes - after set bad breakpoint it does not hit any - // only reproducible when setting invalid condition breakpoint, reason unknown - setBreakOnMain(); - testCondBreak2(); - testCondBreakError(); - pause(); - /* We should now have 3 breakpoints left. */ - ICDIBreakpoint[] breakpoints = currentTarget.getBreakpoints(); - assertTrue(breakpoints.length == 3); - resumeCurrentTarget(); - waitSuspend(currentTarget); - } - /*************************************************************************** - * A test to make sure setting address breakpoints works as - * expected. - */ - public void testAddressBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException { - - - ICDIAddressLocation location; - boolean caught = false; - - setBreakOnMain(); - currentTarget.resume(false); - waitSuspend(currentTarget); - currentTarget.stepOver(1); - pause(); - BigInteger address = getCurrentLocator().getAddress(); - /*********************************************************************** - * Create a break point on first instruction - **********************************************************************/ - - location = currentTarget.createAddressLocation(address); - assertNotNull(location); - currentTarget.setAddressBreakpoint(0, location, null, false); - - // restart - currentTarget.restart(); - pause(); - waitSuspend(currentTarget); - - ICDILocator locator = getCurrentLocator(); - assertTrue(locator.getLineNumber() == 18); - assertTrue(locator.getFunction().equals("main")); //$NON-NLS-1$ - assertTrue(locator.getFile().endsWith("main.c")); //$NON-NLS-1$ - } - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/DebugTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/DebugTests.java deleted file mode 100644 index 793bcdf43ae..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/DebugTests.java +++ /dev/null @@ -1,144 +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.core.tests; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.testplugin.CDebugHelper; -import org.eclipse.cdt.debug.testplugin.CProjectHelper; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; - -/** - * @author Peter Graves - * - * This file contains a set of generic tests for the debug stuff. It currenly - * uses the mi debugger. - * - */ -public class DebugTests extends TestCase { - IWorkspace workspace; - IWorkspaceRoot root; - ICProject testProject; - NullProgressMonitor monitor; - ICDISession session; - - - /** - * Constructor for DebugTests - * @param name - */ - public DebugTests(String name) { - super(name); - /*** - * The assume that they have a working workspace - * and workspace root object to use to create projects/files in, - * so we need to get them setup first. - */ - workspace= ResourcesPlugin.getWorkspace(); - root= workspace.getRoot(); - monitor = new NullProgressMonitor(); - if (workspace==null) - fail("Workspace was not setup"); - if (root==null) - fail("Workspace root was not setup"); - - } - - /** - * Sets up the test fixture. - * - * Called before every test case method. - * - * Example code test the packages in the project - * "com.qnx.tools.ide.cdt.core" - */ - @Override - protected void setUp() throws CoreException, InvocationTargetException, IOException { - ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false); - /*** - * Create a new project and import the test source. - */ - IPath importFile = new Path("resources/debugTest.zip"); - testProject=CProjectHelper.createCProjectWithImport("filetest", importFile); - if (testProject==null) - fail("Unable to create project"); - /* Build the test project.. */ - - testProject.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); - - } - - /** - * Tears down the test fixture. - * - * Called after every test case method. - */ - @Override - protected void tearDown() throws CoreException, CDIException { - if (session!=null) { - session.terminate(); - session=null; - } - CProjectHelper.delete(testProject); - } - - public static TestSuite suite() { - return new TestSuite(DebugTests.class); - } - - public static void main (String[] args){ - junit.textui.TestRunner.run(suite()); - } - - - /*** - * Can we setup a debug? - * This is sort of a catch all sanity tests to make sure we can create a debug - * session with a break point and start it without having any exceptions thrown. - * It's not ment to be a real proper test. - */ - public void testDebug() throws CoreException, MIException, IOException, CDIException { - ICDITarget cdiTarget; - ICDIFunctionLocation location; - - session=CDebugHelper.createSession("main",testProject); - assertNotNull(session); - ICDITarget[] targets = session.getTargets(); - assertNotNull(targets); - assertTrue(targets.length > 0); - cdiTarget = targets[0]; - assertNotNull(cdiTarget); - location=cdiTarget.createFunctionLocation(null, "func1"); - assertNotNull(location); - cdiTarget.setFunctionBreakpoint(0, location, null, false); - cdiTarget.resume(); - session.terminate(); - session=null; - - } - - -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/EventBreakpointTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/EventBreakpointTests.java deleted file mode 100644 index 1c6120b4ee1..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/EventBreakpointTests.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.core.tests; - -import java.io.IOException; - -import junit.framework.Test; - -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; -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.model.ICBreakpointType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.gdb.eventbkpts.IEventBreakpointConstants; - -public class EventBreakpointTests extends AbstractDebugTest { - public static Test suite() { - return new DebugTestWrapper(EventBreakpointTests.class){}; - } - - @Override - protected String getProjectName() { - return "catchpoints"; - } - - @Override - protected String getProjectZip() { - return "resources/debugCxxTest.zip"; - } - - @Override - protected String getProjectBinary() { - return "catchpoints.exe"; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - createDebugSession(); - assertNotNull(currentTarget); - currentTarget.deleteAllBreakpoints(); - pause(); - } - - - public void testCatch() throws CModelException, IOException, MIException, CDIException { - eventbreakpoints(IEventBreakpointConstants.EVENT_TYPE_CATCH, ""); - } - - public void testThrow() throws CModelException, IOException, MIException, CDIException { - eventbreakpoints(IEventBreakpointConstants.EVENT_TYPE_THROW, ""); - } - - private void eventbreakpoints(String type, String arg) throws CModelException, IOException, MIException, CDIException { - ICDIBreakpoint[] breakpoints; - ICDIEventBreakpoint curbreak; - - setBreakOnMain(); - currentTarget.restart(); - waitSuspend(currentTarget); - ICDILocator locator = getCurrentLocator(); - assertEquals("Debug should be stopped in function 'main' but it is stopped in: " + locator.getFunction(), - "main", locator.getFunction()); - - currentTarget.deleteAllBreakpoints(); - pause(); - assertTrue(currentTarget instanceof ICDIBreakpointManagement3); - ((ICDIBreakpointManagement3) currentTarget).setEventBreakpoint(type, arg, ICBreakpointType.REGULAR, null, false, true); - pause(); - breakpoints = currentTarget.getBreakpoints(); - assertNotNull(breakpoints); - assertEquals(1, breakpoints.length); - if (breakpoints[0] instanceof ICDIEventBreakpoint) { - curbreak = (ICDIEventBreakpoint) breakpoints[0]; - } else - curbreak = null; - assertNotNull("Found breakpoint is not an event breakpoint",curbreak); - currentTarget.resume(false); - waitSuspend(currentTarget); - // it is stopped we are fine, it did hit breakpoint - } - -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/LocationTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/LocationTests.java deleted file mode 100644 index 5eb3fa0d70c..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/LocationTests.java +++ /dev/null @@ -1,119 +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.core.tests; - -import java.io.IOException; - -import junit.framework.Test; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.core.runtime.CoreException; - -/** - * @author Peter Graves - * - * This file contains a set of generic tests for the CDI Location interfaces. - * It will currenly use the mi implementation. - * - */ -public class LocationTests extends AbstractDebugTest { - public static Test suite() { - return new DebugTestWrapper(LocationTests.class){}; - } - - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - createDebugSession(); - assertNotNull(currentTarget); - currentTarget.deleteAllBreakpoints(); - pause(); - } - - /*** - * A couple tests to make sure comparing Locations works as expected. - */ - public void testIsEquals() throws CoreException, MIException, IOException, CDIException { - ICDITarget cdiTarget = currentTarget; - ICDILineLocation lineLocation, lineLocation2; - ICDIFunctionLocation functionLocation, functionLocation2; - ICDIBreakpoint[] breakpoints; - ICDILocationBreakpoint curbreak; - - - /********************************************************************** - * Simple test.. this should work. - **********************************************************************/ - functionLocation=cdiTarget.createFunctionLocation("main.c", "func1"); - functionLocation2=cdiTarget.createFunctionLocation("main.c", "func1"); - assertTrue(functionLocation.equals(functionLocation2)); - /********************************************************************** - * Simple test.. this should work. - **********************************************************************/ - lineLocation=cdiTarget.createLineLocation("main.c", 10); - lineLocation2=cdiTarget.createLineLocation("main.c", 10); - assertTrue(lineLocation.equals(lineLocation2)); - - /********************************************************************** - * make sure that the location returned from getLocation on the - * ICDILocationBreakpoint.getLocation that is returned from - * setLocationBreakpoint is the same as the breakpoint returned from - * BreakpointManager.getBreakpoints.getLocation() - **********************************************************************/ - functionLocation=cdiTarget.createFunctionLocation("main.c", "func1"); - assertNotNull(functionLocation); - functionLocation2=cdiTarget.setFunctionBreakpoint(0, functionLocation, null, false).getLocator(); - - breakpoints=cdiTarget.getBreakpoints(); - assertNotNull(breakpoints); - assertTrue(breakpoints.length==1); - if (breakpoints[0] instanceof ICDILocationBreakpoint) { - curbreak=(ICDILocationBreakpoint) breakpoints[0]; - } else - curbreak=null; - assertNotNull(curbreak); - - assertTrue(curbreak.getLocator().equals(functionLocation2)); - cdiTarget.deleteAllBreakpoints(); - pause(); - /* Create a break point on a generic function with a file name that - * gdb will change to the relitive path of the source file. This - * should work, but at the time of writing (Sept 25, 2002) does not. - */ - functionLocation=cdiTarget.createFunctionLocation("main.c", "func1"); - assertNotNull(functionLocation); - cdiTarget.setFunctionBreakpoint(0, functionLocation, null, false); - - breakpoints=cdiTarget.getBreakpoints(); - assertNotNull(breakpoints); - assertTrue(breakpoints.length==1); - if (breakpoints[0] instanceof ICDILocationBreakpoint) { - curbreak=(ICDILocationBreakpoint) breakpoints[0]; - } else - curbreak=null; - assertNotNull(curbreak); - - assertTrue("PR:23879",curbreak.getLocator().equals(functionLocation)); - - } - - -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/MapEntrySourceContainerTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/MapEntrySourceContainerTests.java deleted file mode 100644 index 10144aa170d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/MapEntrySourceContainerTests.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River Systems, 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.core.tests; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer; -import org.eclipse.core.runtime.IPath; - -@SuppressWarnings("restriction") -public class MapEntrySourceContainerTests extends TestCase { - - public static Test suite() { - return new TestSuite(MapEntrySourceContainerTests.class); - } - - public MapEntrySourceContainerTests(String name) { - super(name); - } - - public void testUNCPath() { - String uncPath = "//server/path/on/server"; - IPath path = MapEntrySourceContainer.createPath(uncPath); - assertEquals(uncPath, path.toString()); - - uncPath = "\\\\server\\path\\on\\server"; - path = MapEntrySourceContainer.createPath(uncPath); - assertEquals(uncPath, path.toOSString()); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/ProjectWithSpaceTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/ProjectWithSpaceTests.java deleted file mode 100644 index 8db0d548a51..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/ProjectWithSpaceTests.java +++ /dev/null @@ -1,103 +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.core.tests; - -import java.io.IOException; - -import junit.framework.Test; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.core.runtime.CoreException; - -/** - * Create a project with space and do sanity test for debugger - */ -public class ProjectWithSpaceTests extends AbstractDebugTest { - public static Test suite() { - return new DebugTestWrapper(ProjectWithSpaceTests.class) { - }; - } - - @Override - protected String getProjectName() { - return "with space"; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - createDebugSession(); - assertNotNull(currentTarget); - currentTarget.deleteAllBreakpoints(); - pause(); - } - - @Override - protected void tearDown() throws Exception { - /* clean up the session */ - targets[0].terminate(); - int x = 0; - while ((!targets[0].isTerminated()) && (x < 30)) { - Thread.sleep(100); - } - if (!targets[0].isTerminated()) - targets[0].terminate(); - super.tearDown(); - } - - /** - * Basic sanity test - */ - public void testLineBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException { - ICDITarget cdiTarget = currentTarget; - ICDILineLocation location; - boolean caught = false; - /*********************************************************************** - * Create a break point in a generic function - **********************************************************************/ - location = cdiTarget.createLineLocation("main.c", 7); - assertNotNull(location); - cdiTarget.setLineBreakpoint(0, location, null, false); - - targets = session.getTargets(); - /* - * We better only have one target connected to this session or something - * is not right... - */ - assertTrue(targets.length == 1); - /* - * Resume the target, this should cause it to run till it hits the - * breakpoint - */ - ICDITarget target = targets[0]; - target.resume(false); - /** - * Give the process up to 10 seconds to become either terminated or - * suspended. It sould hit the breakponint almost immediatly so we - * should only sleep for max 100 ms - */ - for (int x = 0; x < 100; x++) { - if (target.isSuspended() || target.isTerminated()) - break; - Thread.sleep(100); - } - assertTrue("Suspended: " + target.isSuspended() + " Terminated: " + target.isTerminated(), - target.isSuspended()); - ICDILocator locator = getCurrentLocator(); - assertTrue(locator.getLineNumber() == 7); - assertTrue(locator.getFunction().equals("func1")); - assertTrue(locator.getFile().endsWith("main.c")); - } -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/TargetTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/TargetTests.java deleted file mode 100644 index a18ecb7731e..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/TargetTests.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.core.tests; - -import java.io.FileNotFoundException; -import java.io.IOException; - -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.eclipse.cdt.debug.testplugin.*; -import org.eclipse.cdt.core.model.*; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; -import org.eclipse.cdt.debug.mi.core.*; -import org.eclipse.cdt.debug.core.cdi.*; - -/** - * @author Peter Graves - * - * This file contains a set of generic tests for the CDI Target interfaces. - * It will currenly use the mi implementation. - * - */ -public class TargetTests extends TestCase { - IWorkspace workspace; - IWorkspaceRoot root; - ICProject testProject; - NullProgressMonitor monitor; - - - /** - * Constructor for TargetTests - * @param name - */ - public TargetTests(String name) { - super(name); - /*** - * The assume that they have a working workspace - * and workspace root object to use to create projects/files in, - * so we need to get them setup first. - */ - workspace= ResourcesPlugin.getWorkspace(); - root= workspace.getRoot(); - monitor = new NullProgressMonitor(); - if (workspace==null) - fail("Workspace was not setup"); - if (root==null) - fail("Workspace root was not setup"); - - } - - /** - * Sets up the test fixture. - * - * Called before every test case method. - * - * Example code test the packages in the project - * "com.qnx.tools.ide.cdt.core" - */ - @Override - protected void setUp() throws CoreException,FileNotFoundException { - - /*** - * Setup the various files, paths and projects that are needed by the - * tests - */ - testProject=CProjectHelper.createCProject("filetest"); - if (testProject==null) - fail("Unable to create project"); - } - - /** - * Tears down the test fixture. - * - * Called after every test case method. - */ - @Override - protected void tearDown() throws CoreException { - CProjectHelper.delete(testProject); - } - - public static TestSuite suite() { - return new TestSuite(TargetTests.class); - } - - public static void main (String[] args){ - junit.textui.TestRunner.run(suite()); - } - - - /*** - * A couple tests to make sure various evaluations work as expected - */ - public void testEvaluate() throws CoreException, MIException, IOException, CDIException, InterruptedException { - - /*** - * Tests to come - */ - - } - - -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/pom.xml b/debug/org.eclipse.cdt.debug.ui.tests/pom.xml deleted file mode 100644 index 2c49f49ccaa..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/pom.xml +++ /dev/null @@ -1,35 +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>6.0.0-SNAPSHOT</version> - <artifactId>org.eclipse.cdt.debug.ui.tests</artifactId> - <packaging>eclipse-test-plugin</packaging> - - <build> - <plugins> - <plugin> - <groupId>org.eclipse.tycho</groupId> - <artifactId>tycho-surefire-plugin</artifactId> - <version>${tycho-version}</version> - <configuration> - <useUIHarness>true</useUIHarness> - <argLine>${tycho.testArgLine} ${base.ui.test.vmargs}</argLine> - <includes> - <include>**/AllDebugTests.*</include> - </includes> - <testFailureIgnore>true</testFailureIgnore> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/debug/org.eclipse.cdt.debug.ui.tests/resources/debugCxxTest.zip b/debug/org.eclipse.cdt.debug.ui.tests/resources/debugCxxTest.zip Binary files differdeleted file mode 100644 index d29256144f7..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/resources/debugCxxTest.zip +++ /dev/null diff --git a/debug/org.eclipse.cdt.debug.ui.tests/resources/debugTest.zip b/debug/org.eclipse.cdt.debug.ui.tests/resources/debugTest.zip Binary files differdeleted file mode 100644 index 9d1bdf012f4..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/resources/debugTest.zip +++ /dev/null diff --git a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CDebugHelper.java b/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CDebugHelper.java deleted file mode 100644 index 8a64105c348..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CDebugHelper.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.testplugin; - -import java.io.File; -import java.io.IOException; - -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.IBinary; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.command.MIVersion; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; - - -/** - * Helper methods to set up a Debug session. - */ -public class CDebugHelper { - - - - /** - * Creates a ICDISession. - */ - public static ICDISession createSession(String exe) throws IOException, MIException { - MIPlugin mi; - ICDISession session; - String os = System.getProperty("os.name"); - String exename; - mi=MIPlugin.getDefault(); - - exename=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.debug.ui.tests").find(new Path("/")).getFile(); - exename+="core/org/eclipse/cdt/debug/core/tests/resources/"; - os=os.toLowerCase(); - /* We need to get the correct executable to execute - */ - if (os.indexOf("windows")!=-1) - exename+="win/"+ exe +".exe"; - else if (os.indexOf("qnx")!=-1) - exename+="qnx/" + exe; - else if (os.indexOf("linux")!=-1) - exename+="linux/"+exe; - else if (os.indexOf("sol")!=-1) - exename+="sol/" + exe; - else - return(null); - session=mi.createCSession(null, MIVersion.MI1, new File(exename), new File("."), null, null); - return(session); - } - /** - * Creates a ICDISession. - */ - public static ICDISession createSession(String exe, ICProject project) throws IOException, MIException, CModelException { - MIPlugin mi; - String workspacePath= Platform.getLocation().toOSString(); - ICDISession session; - mi=MIPlugin.getDefault(); - - try { - project.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (Exception exc) {} - IBinary bins[] = project.getBinaryContainer().getBinaries(); - if (bins.length!=1) { - //SHOULD NOT HAPPEN - return(null); - } - - session=mi.createCSession(null, MIVersion.MI1, new File(workspacePath +bins[0].getPath().toOSString()), new File("."), null, null); - return(session); - } - - -} - diff --git a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CProjectHelper.java b/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CProjectHelper.java deleted file mode 100644 index 2f3e5a8d5e4..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CProjectHelper.java +++ /dev/null @@ -1,238 +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.testplugin; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.zip.ZipFile; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.CProjectNature; -import org.eclipse.cdt.core.ICDescriptor; -import org.eclipse.cdt.core.ICDescriptorOperation; -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.IArchive; -import org.eclipse.cdt.core.model.IArchiveContainer; -import org.eclipse.cdt.core.model.IBinary; -import org.eclipse.cdt.core.model.IBinaryContainer; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -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.ui.dialogs.IOverwriteQuery; -import org.eclipse.ui.wizards.datatransfer.ImportOperation; -import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; - -/** - * Helper methods to set up a ICProject. - */ -public class CProjectHelper { - /** - * Creates a ICProject. - */ - public static ICProject createCProjectWithImport(String projectName, IPath zipFile) throws CoreException, InvocationTargetException, IOException { - IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); - IProject project= root.getProject(projectName); - if (!project.exists()) { - project.create(null); - } else { - project.refreshLocal(IResource.DEPTH_INFINITE, null); - } - - if (!project.isOpen()) { - project.open(null); - } - File zip = CTestPlugin.getDefault().getFileInPlugin(zipFile); - importFilesFromZip(new ZipFile(zip),project.getFullPath(),null); - - if (!project.hasNature(CProjectNature.C_NATURE_ID)) { - addNatureToProject(project, CProjectNature.C_NATURE_ID, null); - } - - ICProject cproject = CCorePlugin.getDefault().getCoreModel().create(project); - /* Try to guess at the correct binary parser.. elf or pe at this point.. */ - ICDescriptorOperation op = new ICDescriptorOperation() { - - @Override - public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException { - descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); - String os = System.getProperty("os.name"); - boolean pe=(os.toLowerCase().indexOf("windows")!=-1); - descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, pe?"org.eclipse.cdt.core.PE":"org.eclipse.cdt.core.ELF"); - } - }; - CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(project, op, null); - return cproject; - } - - - /** - * Creates a ICProject. - */ - public static ICProject createCProject(String projectName) throws CoreException { - IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); - IProject project= root.getProject(projectName); - if (!project.exists()) { - project.create(null); - } else { - project.refreshLocal(IResource.DEPTH_INFINITE, null); - } - - if (!project.isOpen()) { - project.open(null); - } - - if (!project.hasNature(CProjectNature.C_NATURE_ID)) { - addNatureToProject(project, CProjectNature.C_NATURE_ID, null); - } - - ICProject cproject = CCorePlugin.getDefault().getCoreModel().create(project); - - return cproject; - } - - /** - * Removes a ICProject. - */ - public static void delete(ICProject cproject) throws CoreException { - cproject.getProject().delete(true, true, null); - } - - - - /** - * Attempts to find an archive with the given name in the workspace - */ - public static IArchive findArchive(ICProject testProject,String name) throws CModelException { - int x; - IArchive[] myArchives; - IArchiveContainer archCont; - archCont=testProject.getArchiveContainer(); - myArchives=archCont.getArchives(); - if (myArchives.length<1) - return(null); - for (x=0;x<myArchives.length;x++) { - if (myArchives[x].getElementName().equals(name)) - return(myArchives[x]); - } - return(null); - } - /** - * Attempts to find a binary with the given name in the workspace - */ - public static IBinary findBinary(ICProject testProject,String name) throws CModelException { - IBinaryContainer binCont; - int x; - IBinary[] myBinaries; - binCont=testProject.getBinaryContainer(); - myBinaries=binCont.getBinaries(); - if (myBinaries.length<1) - return(null); - for (x=0;x<myBinaries.length;x++) { - if (myBinaries[x].getElementName().equals(name)) - return(myBinaries[x]); - - } - return(null); - } - - /** - * Attempts to find an object with the given name in the workspace - */ - public static IBinary findObject(ICProject testProject,String name) throws CModelException { - int x; - ICElement[] myElements; - myElements=testProject.getChildren(); - if (myElements.length<1) - return(null); - for (x=0;x<myElements.length;x++) { - if (myElements[x].getElementName().equals(name)) - if (myElements[x] instanceof IBinary) { - return((IBinary) myElements[x]); - } - } - return(null); - } - /** - * Attempts to find a TranslationUnit with the given name in the workspace - */ - public static ITranslationUnit findTranslationUnit(ICProject testProject,String name) throws CModelException { - int x; - ICElement[] myElements; - myElements=testProject.getChildren(); - if (myElements.length<1) - return(null); - for (x=0;x<myElements.length;x++) { - if (myElements[x].getElementName().equals(name)) - if (myElements[x] instanceof ITranslationUnit) { - return((ITranslationUnit) myElements[x]); - } - } - return(null); - } - - - - /** - * Attempts to find an element with the given name in the workspace - */ - public static ICElement findElement(ICProject testProject,String name) throws CModelException { - int x; - ICElement[] myElements; - myElements=testProject.getChildren(); - if (myElements.length<1) - return(null); - for (x=0;x<myElements.length;x++) { - if (myElements[x].getElementName().equals(name)) - return myElements[x]; - } - return(null); - } - - - private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException { - IProjectDescription description = proj.getDescription(); - String[] prevNatures= description.getNatureIds(); - String[] newNatures= new String[prevNatures.length + 1]; - System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); - newNatures[prevNatures.length]= natureId; - description.setNatureIds(newNatures); - proj.setDescription(description, monitor); - } - - private static void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException { - ZipFileStructureProvider structureProvider= new ZipFileStructureProvider(srcZipFile); - try { - ImportOperation op= new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, new ImportOverwriteQuery()); - op.run(monitor); - } catch (InterruptedException e) { - // should not happen - } - } - - private static class ImportOverwriteQuery implements IOverwriteQuery { - @Override - public String queryOverwrite(String file) { - return ALL; - } - } - - -} - diff --git a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CTestPlugin.java b/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CTestPlugin.java deleted file mode 100644 index cf0510874ee..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CTestPlugin.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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.testplugin; - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IPluginDescriptor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; - - -public class CTestPlugin extends Plugin { - - private static CTestPlugin fgDefault; - - public CTestPlugin(IPluginDescriptor descriptor) { - super(descriptor); - fgDefault= this; - } - - public static CTestPlugin getDefault() { - return fgDefault; - } - - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - public static void enableAutobuild(boolean enable) throws CoreException { - // disable auto build - IWorkspace workspace= CTestPlugin.getWorkspace(); - IWorkspaceDescription desc= workspace.getDescription(); - desc.setAutoBuilding(enable); - workspace.setDescription(desc); - } - - public File getFileInPlugin(IPath path) { - try { - URL installURL= new URL(getDescriptor().getInstallURL(), path.toString()); - URL localURL= Platform.asLocalURL(installURL); - return new File(localURL.getFile()); - } catch (IOException e) { - return null; - } - } - - - -}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/util/ExpectedStrings.java b/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/util/ExpectedStrings.java deleted file mode 100644 index 4388c5d0dd4..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/util/ExpectedStrings.java +++ /dev/null @@ -1,106 +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.testplugin.util; - - -import java.util.Stack; -/** - * @author Peter Graves - * - * This utility class maintains a list of strings, and as a tests finds strings - * in a structure/list, it will maintain a list of unfound/extra strings. - */ -public class ExpectedStrings { - - public String [] expStrings; - private boolean[] foundStrings; - private Stack extraStrings; /* A stack of the unecpected strings we - * recieved - */ - private boolean extra; - - /** - * Constructor for ExpectedStrings. - */ - public ExpectedStrings() { - } - /** - * Constructor for ExpectedStrings that accepts a list of strings that - * we expect to get. - */ - public ExpectedStrings(String[] values) { - int x; - expStrings=new String[values.length]; - for (x=0;x<values.length;x++) { - expStrings[x]=new String(values[x]); - } - foundStrings=new boolean[values.length]; - for (x=0;x<values.length;x++) { - foundStrings[x]=false; - } - extraStrings=new Stack(); - extra=false; - } - - public int foundString(String current) { - int x; - for (x=0;x<expStrings.length;x++) { - if (current.equals(expStrings[x])) { - foundStrings[x]=true; - return(0); - } - } - /* If we arrive here, the strings was not found, so this is - * and extra string - */ - - extraStrings.push(new String(current)); - extra=true; - return(1); - } - public int getNum(String name) { - int x; - for (x=0;x<expStrings.length;x++) { - if (name.equals(expStrings[x])) - return(x); - } - return(-1); - } - public boolean gotAll() { - int x; - for (x=0;x<expStrings.length;x++) { - if (foundStrings[x]==false) - return(false); - } - return(true); - } - public boolean gotExtra() { - return(extra); - } - public String getMissingString() { - int x; - String missing = new String("Missing elements: "); - for (x=0;x<expStrings.length;x++) { - if (foundStrings[x]==false) - missing+=expStrings[x]; - missing+=" "; - } - return(missing); - } - public String getExtraString() { - String extra= new String("Extra elements: "); - while (!extraStrings.empty()) { - extra+=extraStrings.pop(); - extra+=" "; - } - return(extra); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/util/ExpectedStringsTests.java b/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/util/ExpectedStringsTests.java deleted file mode 100644 index 00485d44e15..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/util/ExpectedStringsTests.java +++ /dev/null @@ -1,126 +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.testplugin.util; - -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * @author Peter Graves - * - *Some simple tests to make sure our ExtraStrings class seems to work. - */ -public class ExpectedStringsTests extends TestCase { - - /** - * Constructor for ExpectedStringsTests. - * @param name - */ - public ExpectedStringsTests(String name) { - super(name); - } - /** - * Sets up the test fixture. - * - * Called before every test case method. - * - * Example code test the packages in the project - * "com.qnx.tools.ide.cdt.core" - */ - @Override - protected void setUp() { - - - } - - /** - * Tears down the test fixture. - * - * Called after every test case method. - */ - @Override - protected void tearDown() { - // release resources here and clean-up - } - - public static TestSuite suite() { - return new TestSuite(ExpectedStringsTests.class); - } - - public static void main (String[] args){ - junit.textui.TestRunner.run(suite()); - } - - public void testGotAll() { - ExpectedStrings myExp; - String[] strings= {"stringOne", "stringTwo", "stringThree" }; - - myExp=new ExpectedStrings(strings); - assertTrue("No found strings", !myExp.gotAll()); - myExp.foundString("stringOne"); - assertTrue("1 found strings", !myExp.gotAll()); - myExp.foundString("stringTwo"); - assertTrue("2 found strings", !myExp.gotAll()); - myExp.foundString("stringThree"); - assertTrue("All found strings", myExp.gotAll()); - - - } - public void testGotExtra () { - ExpectedStrings myExp; - String[] strings= {"stringOne", "stringTwo", "stringThree" }; - - myExp=new ExpectedStrings(strings); - assertTrue("No found strings", !myExp.gotExtra()); - myExp.foundString("stringOne"); - assertTrue("1 found strings", !myExp.gotExtra()); - myExp.foundString("stringTwo"); - assertTrue("2 found strings", !myExp.gotExtra()); - myExp.foundString("stringThree"); - assertTrue("All found strings", !myExp.gotExtra()); - myExp.foundString("Somerandomestring"); - assertTrue("Extra String", myExp.gotExtra()); - - } - - public void testGetMissingString() - { - ExpectedStrings myExp; - String[] strings= {"stringOne", "stringTwo", "stringThree" }; - - myExp=new ExpectedStrings(strings); - assertNotNull(myExp.getMissingString()); - myExp.foundString("stringOne"); - assertNotNull(myExp.getMissingString()); - myExp.foundString("stringTwo"); - assertNotNull(myExp.getMissingString()); - myExp.foundString("stringThree"); - assertNotNull(myExp.getMissingString()); - - } - - public void testGetExtraString() - { - ExpectedStrings myExp; - String[] strings= {"stringOne", "stringTwo", "stringThree" }; - - myExp=new ExpectedStrings(strings); - assertNotNull(myExp.getExtraString()); - myExp.foundString("stringOnenot"); - assertNotNull(myExp.getMissingString()); - myExp.foundString("stringTwonot"); - assertNotNull(myExp.getMissingString()); - - } - - - -} diff --git a/debug/org.eclipse.cdt.debug.ui.tests/test.xml b/debug/org.eclipse.cdt.debug.ui.tests/test.xml deleted file mode 100644 index 41075b0e15e..00000000000 --- a/debug/org.eclipse.cdt.debug.ui.tests/test.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0"?> - -<project name="testsuite" default="run" basedir="."> - <!-- The property ${eclipse-home} should be passed into this script --> - <!-- Set a meaningful default value for when it is not. --> - <property name="eclipse-home" value="${basedir}"/> - - <!-- sets the properties eclipse-home, and library-file --> - <property name="plugin-name" value="org.eclipse.cdt.debug.ui.tests"/> - <property name="library-file" - value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/> - - <!-- This target holds all initialization code that needs to be done for --> - <!-- all tests that are to be run. Initialization for individual tests --> - <!-- should be done within the body of the suite target. --> - <target name="init"> - <tstamp/> - <delete> - <fileset dir="${eclipse-home}" includes="org*.xml"/> - </delete> - </target> - - <!-- This target defines the tests that need to be run. --> - <target name="suite"> - <property name="cdt-folder" - value="${eclipse-home}/cdt_folder"/> - <delete dir="${cdt-folder}" quiet="true"/> - <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}"> - <property name="data-dir" value="${cdt-folder}"/> - <property name="plugin-name" value="${plugin-name}"/> - <property name="classname" - value="org.eclipse.cdt.debug.core.tests.AllDebugTests"/> - </ant> - </target> - - <!-- This target holds code to cleanup the testing environment after --> - <!-- after all of the tests have been run. You can use this target to --> - <!-- delete temporary files that have been created. --> - <target name="cleanup"> - </target> - - <!-- This target runs the test suite. Any actions that need to happen --> - <!-- after all the tests have been run should go here. --> - <target name="run" depends="init,suite,cleanup"> - <ant target="collect" antfile="${library-file}" dir="${eclipse-home}"> - <property name="includes" value="org*.xml"/> - <property name="output-file" value="${plugin-name}.xml"/> - </ant> - </target> - -</project> diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF index 2f0121e15aa..cb17d044763 100644 --- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.debug.ui; singleton:=true -Bundle-Version: 7.5.0.qualifier +Bundle-Version: 8.0.0.qualifier Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -17,7 +17,6 @@ Export-Package: org.eclipse.cdt.debug.internal.ui.disassembly.commands;x-internal:=true, org.eclipse.cdt.debug.internal.ui.disassembly.dsf;x-friends:="org.eclipse.cdt.dsf.ui", org.eclipse.cdt.debug.internal.ui.disassembly.editor;x-internal:=true, - org.eclipse.cdt.debug.internal.ui.disassembly.rendering;x-internal:=true, org.eclipse.cdt.debug.internal.ui.disassembly.viewer;x-internal:=true, org.eclipse.cdt.debug.internal.ui.editors;x-internal:=true, org.eclipse.cdt.debug.internal.ui.elements.adapters;x-internal:=true, diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index 322d0a9cbb9..9c798eda526 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -29,7 +29,6 @@ CDebuggerPage.name=C Debugger UI Page MemoryPreferencePage.name=Memory View CDebugPreferencePage.name=Debug SourcePreferencePage.name=Source Lookup Path -DebuggerTypesPreferencePage.name=Debugger Types BreakpointActionPage.name=Breakpoint Action UI Page RunMenu.label=&Run @@ -103,12 +102,6 @@ RestoreDefaultTypeAction.tooltip=Restore Original Type Of Variable CastToArrayAction.label=Display As Array... CastToArrayAction.tooltip=Display Variable As Array -EnableVariablesAction.label=Enable -EnableVariablesAction.tooltip=Enable Selected Variables - -DisableVariablesAction.label=Disable -DisableVariablesAction.tooltip=Disable Selected Variables - DefaultSourceLocator.name=Default C/C++ Source Locator OldDefaultSourceLocator.name=Default C/C++ Source Locator (old) diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 6e970e573c4..d31bd8b93ae 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -246,11 +246,6 @@ class="org.eclipse.cdt.debug.internal.ui.preferences.SourcePreferencePage" id="org.eclipse.cdt.debug.ui.SourcePreferencePage"> </page> - <page - category="org.eclipse.cdt.debug.ui.CDebugPreferencePage" - class="org.eclipse.cdt.debug.internal.ui.preferences.DebuggerTypesPage" - id="org.eclipse.cdt.debug.ui.DebuggerTypesPreferencePage" - name="%DebuggerTypesPreferencePage.name"/> </extension> <extension point="org.eclipse.ui.actionSets"> @@ -327,37 +322,6 @@ <extension point="org.eclipse.ui.menus"> - <menuContribution - locationURI="popup:org.eclipse.debug.ui.ExpressionView?after=additions"> - <menu - id="org.eclipse.cdt.debug.ui.expressionsView_CVariableFormatMenu" - label="%CVariableFormatMenu.label"> - <visibleWhen> - <reference definitionId="org.eclipse.cdt.debug.ui.testAreNumberFormatsSupported"/> - </visibleWhen> - <dynamic - id="org.eclipse.cdt.debug.ui.numberFormats" - class="org.eclipse.cdt.debug.internal.ui.actions.NumberFormatsContribution"> - </dynamic> - <separator name="formatGroup" visible="false"/> - </menu> - </menuContribution> - <menuContribution - locationURI="popup:org.eclipse.debug.ui.VariableView?after=variableGroup"> - <menu - id="org.eclipse.cdt.debug.ui.CVariableFormatMenu" - label="%CVariableFormatMenu.label"> - <visibleWhen> - <reference definitionId="org.eclipse.cdt.debug.ui.testAreNumberFormatsSupported"/> - </visibleWhen> - <dynamic - id="org.eclipse.cdt.debug.ui.numberFormats" - class="org.eclipse.cdt.debug.internal.ui.actions.NumberFormatsContribution"> - </dynamic> - <separator name="formatGroup" visible="false"/> - - </menu> - </menuContribution> <menuContribution locationURI="popup:org.eclipse.debug.ui.VariableView?after=variableGroup"> <command @@ -365,44 +329,6 @@ label="%command.viewMemory.name"> </command> </menuContribution> - <menuContribution - locationURI="popup:org.eclipse.debug.ui.RegisterView?after=variableGroup"> - <menu - id="org.eclipse.cdt.debug.ui.registerView_CVariableFormatMenu" - label="%CVariableFormatMenu.label"> - <visibleWhen> - <reference definitionId="org.eclipse.cdt.debug.ui.testAreNumberFormatsSupported"/> - </visibleWhen> - <dynamic - id="org.eclipse.cdt.debug.ui.numberFormats" - class="org.eclipse.cdt.debug.internal.ui.actions.NumberFormatsContribution"> - </dynamic> - <separator name="formatGroup" visible="false"/> - </menu> - </menuContribution> - </extension> - <extension point="org.eclipse.core.expressions.definitions"> - <definition - id="org.eclipse.cdt.debug.ui.testAreNumberFormatsSupported"> - <with variable="selection"> - <count - value="+"> - </count> - <iterate> - <test property="org.eclipse.cdt.debug.ui.canFormatObject" value="true"/> - </iterate> - </with> - </definition> - </extension> - - <extension point="org.eclipse.core.expressions.propertyTesters"> - <propertyTester - namespace="org.eclipse.cdt.debug.ui" - properties="canFormatObject" - type="org.eclipse.core.runtime.IAdaptable" - class="org.eclipse.cdt.debug.internal.ui.actions.CanFormatObjectTester" - id="org.eclipse.cdt.debug.ui.canFormatObjectTester"> - </propertyTester> </extension> <extension @@ -691,79 +617,6 @@ id="org.eclipse.cdt.debug.ui.actions.ToggleWatchpointAction"/> </objectContribution> <viewerContribution - targetID="org.eclipse.debug.ui.VariableView" - id="org.eclipse.debug.ui.variablesView.popupMenu"> - <action - helpContextId="remove_all_globals_action_context" - enablesFor="*" - label="%RemoveAllGlobalsAction.label" - tooltip="%RemoveAllGlobalsAction.tooltip" - icon="icons/elcl16/rem_all_co.gif" - class="org.eclipse.cdt.debug.internal.ui.actions.RemoveAllGlobalsActionDelegate" - menubarPath="additions" - id="org.eclipse.cdt.debug.internal.ui.actions.RemoveAllGlobalsActionDelegate"> - <enablement> - <pluginState - value="activated" - id="org.eclipse.cdt.debug.ui"/> - </enablement> - </action> - <action - helpContextId="remove_globals_action_context" - enablesFor="+" - label="%RemoveGlobalsAction.label" - tooltip="%RemoveGlobalsAction.tooltip" - icon="icons/elcl16/rem_co.gif" - class="org.eclipse.cdt.debug.internal.ui.actions.RemoveGlobalsActionDelegate" - menubarPath="additions" - id="org.eclipse.cdt.debug.internal.ui.actions.RemoveGlobalsActionDelegate"> - <enablement> - <pluginState - value="activated" - id="org.eclipse.cdt.debug.ui"/> - </enablement> - </action> - <action - helpContextId="add_globals_action_context" - label="%AddGlobalsAction.label" - class="org.eclipse.cdt.debug.internal.ui.actions.AddGlobalsActionDelegate" - icon="icons/elcl16/watch_globals.gif" - menubarPath="additions" - id="org.eclipse.cdt.debug.internal.ui.actions.AddGlobalsActionDelegate"> - <enablement> - <pluginState - value="activated" - id="org.eclipse.cdt.debug.ui"/> - </enablement> - </action> - <action - label="%DisableVariablesAction.label" - icon="icons/elcl16/disabled_co.gif" - helpContextId="disable_variables_action_context" - tooltip="%DisableVariablesAction.tooltip" - class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate" - menubarPath="variableGroup" - enablesFor="2+" - id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"> - <selection - class="org.eclipse.cdt.debug.core.model.ICVariable"> - </selection> - </action> - <action - label="%EnableVariablesAction.label" - icon="icons/elcl16/enabled_co.gif" - helpContextId="enable_variables_action_context" - tooltip="%EnableVariablesAction.tooltip" - class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate" - menubarPath="variableGroup" - enablesFor="2+" - id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"> - <selection - class="org.eclipse.cdt.debug.core.model.ICVariable"> - </selection> - </action> - </viewerContribution> - <viewerContribution targetID="org.eclipse.debug.ui.RegisterView" id="org.eclipse.debug.ui.registersView.popupMenu"> <menu @@ -772,32 +625,6 @@ <separator name="refreshGroup"/> <separator name="emptyRefreshGroup"/> </menu> - <action - label="%DisableVariablesAction.label" - icon="icons/elcl16/disabled_co.gif" - helpContextId="disable_variables_action_context" - tooltip="%DisableVariablesAction.tooltip" - class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate" - menubarPath="variableGroup" - enablesFor="2+" - id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"> - <selection - class="org.eclipse.cdt.debug.core.model.ICVariable"> - </selection> - </action> - <action - label="%EnableVariablesAction.label" - icon="icons/elcl16/enabled_co.gif" - helpContextId="enable_variables_action_context" - tooltip="%EnableVariablesAction.tooltip" - class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate" - menubarPath="variableGroup" - enablesFor="2+" - id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"> - <selection - class="org.eclipse.cdt.debug.core.model.ICVariable"> - </selection> - </action> </viewerContribution> <objectContribution objectClass="org.eclipse.cdt.debug.core.model.ICModule" @@ -944,57 +771,6 @@ tooltip="%AddLineBreakpoint.tooltip"/> </viewContribution> <viewContribution - targetID="org.eclipse.debug.ui.VariableView" - id="org.eclipse.debug.ui.variablesView.toolbar"> - <action - helpContextId="remove_all_globals_action_context" - disabledIcon="icons/dlcl16/rem_all_co.gif" - enablesFor="*" - toolbarPath="additions" - label="%RemoveAllGlobalsAction.label" - tooltip="%RemoveAllGlobalsAction.tooltip" - icon="icons/elcl16/rem_all_co.gif" - class="org.eclipse.cdt.debug.internal.ui.actions.RemoveAllGlobalsActionDelegate" - id="org.eclipse.cdt.debug.internal.ui.actions.RemoveAllGlobalsActionDelegate"> - <enablement> - <pluginState - value="activated" - id="org.eclipse.cdt.debug.ui"/> - </enablement> - </action> - <action - helpContextId="remove_globals_action_context" - disabledIcon="icons/dlcl16/rem_co.gif" - enablesFor="+" - toolbarPath="additions" - label="%RemoveGlobalsAction.label" - tooltip="%RemoveGlobalsAction.tooltip" - icon="icons/elcl16/rem_co.gif" - class="org.eclipse.cdt.debug.internal.ui.actions.RemoveGlobalsActionDelegate" - id="org.eclipse.cdt.debug.internal.ui.actions.RemoveGlobalsActionDelegate"> - <enablement> - <pluginState - value="activated" - id="org.eclipse.cdt.debug.ui"/> - </enablement> - </action> - <action - helpContextId="add_globals_action_context" - disabledIcon="icons/dlcl16/watch_globals.gif" - toolbarPath="additions" - label="%AddGlobalsAction.label" - tooltip="%AddGlobalsAction.tooltip" - icon="icons/elcl16/watch_globals.gif" - class="org.eclipse.cdt.debug.internal.ui.actions.AddGlobalsActionDelegate" - id="org.eclipse.cdt.debug.internal.ui.actions.AddGlobalsActionDelegate"> - <enablement> - <pluginState - value="activated" - id="org.eclipse.cdt.debug.ui"/> - </enablement> - </action> - </viewContribution> - <viewContribution targetID="org.eclipse.debug.ui.RegisterView" id="org.eclipse.debug.ui.registersView.toolbar"> <menu @@ -1180,25 +956,6 @@ </and> </enabledWhen> </page> - <page class="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointFilteringPage" - id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.filtering" - name="%FilteringBreakpointPage.label"> - <filter name="debugModelId" value="org.eclipse.cdt.debug.core"/> - <enabledWhen> - <and> - <adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"> - </adapt> - <not> - <adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint"> - </adapt> - </not> - <not> - <adapt type="org.eclipse.cdt.debug.core.model.ICDynamicPrintf"> - </adapt> - </not> - </and> - </enabledWhen> - </page> <page class="org.eclipse.cdt.debug.internal.ui.propertypages.SignalPropertyPage" id="org.eclipse.cdt.debug.ui.propertypages.signal.common" @@ -1344,144 +1101,12 @@ <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/> </factory> <factory - adaptableType="org.eclipse.cdt.debug.core.model.IModuleRetrieval" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICDebugTarget" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory"/> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICThread" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider"/> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICStackFrame" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/> - <adapter type="org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentProvider"/> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider"/> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICModule" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"> - </adapter> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICModule" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementLabelProviderFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.core.model.ICElement" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"> - </adapter> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICVariable" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementLabelProviderFactory"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"/> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICSignal" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementLabelProviderFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICVariable" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CWatchExpressionFactoryAdapterFactory"> - <adapter - type="org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter"> - </adapter> - </factory> - <factory adaptableType="org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval" class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CMemoryAdapterFactory"> <adapter type="org.eclipse.debug.ui.actions.IAddMemoryBlocksTarget"> </adapter> </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.IDisassemblyLine" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter - type="org.eclipse.cdt.debug.ui.disassembly.IDocumentElementLabelProvider"> - </adapter> - <adapter - type="org.eclipse.cdt.debug.ui.disassembly.IDocumentElementAnnotationProvider"> - </adapter> - <adapter - type="org.eclipse.cdt.debug.ui.disassembly.IElementToggleBreakpointAdapter"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICStackFrame" - class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"> - <adapter - type="org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICThread" - class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"> - <adapter - type="org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.core.model.ICDebugTarget" - class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"> - <adapter - type="org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.cdt.debug.internal.ui.elements.adapters.CRegisterManagerProxy" - class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"> - </adapter> - </factory> </extension> <extension point="org.eclipse.ui.themes"> @@ -1506,22 +1131,6 @@ <initializer class="org.eclipse.cdt.debug.internal.ui.CDebugUIPreferenceInitializer"/> </extension> <extension - point="org.eclipse.debug.ui.memoryRenderings"> - <renderingBindings - defaultIds="org.eclipse.debug.ui.rendering.raw_memory" - primaryId="org.eclipse.debug.ui.rendering.raw_memory" - renderingIds="org.eclipse.debug.ui.rendering.raw_memory,org.eclipse.debug.ui.rendering.ascii,org.eclipse.debug.ui.rendering.signedint,org.eclipse.debug.ui.rendering.unsignedint,org.eclipse.debug.ui.rendering.hexint"> - <enablement> - <instanceof value="org.eclipse.cdt.debug.internal.core.model.CMemoryBlockExtension"/> - </enablement> - </renderingBindings> - <renderingType - class="org.eclipse.cdt.debug.internal.ui.disassembly.rendering.DisassemblyRenderingTypeDelegate" - id="org.eclipse.cdt.debug.ui.rendering.disassembly" - name="%DisassemblyRendering.name"> - </renderingType> - </extension> - <extension point="org.eclipse.debug.ui.sourceContainerPresentations"> <sourceContainerPresentation browserClass="org.eclipse.cdt.debug.internal.ui.sourcelookup.CProjectSourceContainerBrowser" @@ -1590,13 +1199,6 @@ class="org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditor" id="org.eclipse.cdt.debug.ui.SourceNotFoundEditor"> </editor> - <editor - class="org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor" - default="false" - icon="icons/obj16/disassembly_obj.gif" - id="org.eclipse.cdt.debug.ui.disassemblyEditor" - name="%DisassemblyEditor.name"> - </editor> </extension> <!-- Breakpoint Action UI --> <extension @@ -2033,104 +1635,6 @@ <extension point="org.eclipse.ui.handlers"> <handler - class="org.eclipse.cdt.debug.internal.ui.commands.AddRegisterGroupCommandHandler" - commandId="org.eclipse.cdt.debug.ui.command.addRegisterGroup"> - <activeWhen> - <with variable="selection"> - <iterate operator="and"> - <or> - <instanceof - value="org.eclipse.cdt.debug.internal.core.model.CRegisterGroup"> - </instanceof> - <instanceof - value="org.eclipse.cdt.debug.internal.core.model.CRegister"> - </instanceof> - </or> - </iterate> - <count value="+"> - </count> - </with> - </activeWhen> - </handler> - <handler - class="org.eclipse.cdt.debug.internal.ui.commands.EditRegisterGroupCommandHandler" - commandId="org.eclipse.cdt.debug.ui.command.editRegisterGroup"> - <activeWhen> - <with variable="selection"> - <iterate operator="and"> - <instanceof - value="org.eclipse.cdt.debug.internal.core.model.CRegisterGroup"> - </instanceof> - </iterate> - <count value="1"> - </count> - </with> - </activeWhen> - </handler> - <handler - class="org.eclipse.cdt.debug.internal.ui.commands.RestoreRegisterGroupsCommandHandler" - commandId="org.eclipse.cdt.debug.ui.command.restoreRegisterGroups"> - <activeWhen> - <with variable="selection"> - <iterate operator="and"> - <or> - <instanceof - value="org.eclipse.cdt.debug.internal.core.model.CRegisterGroup"> - </instanceof> - <instanceof - value="org.eclipse.cdt.debug.internal.core.model.CRegister"> - </instanceof> - </or> - </iterate> - <count value="+"> - </count> - </with> - </activeWhen> - </handler> - <handler - class="org.eclipse.cdt.debug.internal.ui.commands.RemoveRegisterGroupsCommandHandler" - commandId="org.eclipse.cdt.debug.ui.command.removeRegisterGroups"> - <activeWhen> - <with variable="selection"> - <iterate operator="and"> - <instanceof - value="org.eclipse.cdt.debug.internal.core.model.CRegisterGroup"> - </instanceof> - </iterate> - <count value="+"> - </count> - </with> - </activeWhen> - </handler> - <handler - class="org.eclipse.cdt.debug.internal.ui.commands.LoadSymbolsCommandHandler" - commandId="org.eclipse.cdt.debug.ui.command.loadSymbols"> - <activeWhen> - <with variable="selection"> - <iterate operator="and"> - <instanceof value="org.eclipse.cdt.debug.core.model.ICModule"> - </instanceof> - </iterate> - <count value="+"> - </count> - </with> - </activeWhen> - </handler> - <handler - class="org.eclipse.cdt.debug.internal.ui.commands.LoadAllSymbolsCommandHandler" - commandId="org.eclipse.cdt.debug.ui.command.loadAllSymbols"> - <activeWhen> - <with variable="selection"> - <iterate operator="and"> - <instanceof value="org.eclipse.cdt.debug.core.model.ICModule"> - </instanceof> - </iterate> - <count value="+"> - </count> - </with> - </activeWhen> - </handler> - <handler class="org.eclipse.cdt.debug.internal.ui.commands.ReverseToggleCommandHandler" commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"> </handler> @@ -2168,20 +1672,6 @@ helpContextId="resume_without_signal_action_context"> </handler> <handler - class="org.eclipse.cdt.debug.internal.ui.commands.ViewMemoryHandler" - commandId="org.eclipse.cdt.debug.ui.commands.viewMemory"> - <activeWhen> - <with variable="selection"> - <iterate operator="and"> - <instanceof value="org.eclipse.cdt.debug.core.model.ICVariable"> - </instanceof> - </iterate> - <count value="+"> - </count> - </with> - </activeWhen> - </handler> - <handler class="org.eclipse.cdt.debug.internal.ui.commands.GroupDebugContextsCommandHandler" commandId="org.eclipse.cdt.debug.ui.command.groupDebugContexts"> </handler> diff --git a/debug/org.eclipse.cdt.debug.ui/pom.xml b/debug/org.eclipse.cdt.debug.ui/pom.xml index a9582cb41c8..4afb7b550ba 100644 --- a/debug/org.eclipse.cdt.debug.ui/pom.xml +++ b/debug/org.eclipse.cdt.debug.ui/pom.xml @@ -11,7 +11,7 @@ <relativePath>../../pom.xml</relativePath> </parent> - <version>7.5.0-SNAPSHOT</version> + <version>8.0.0-SNAPSHOT</version> <artifactId>org.eclipse.cdt.debug.ui</artifactId> <packaging>eclipse-plugin</packaging> </project> diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java index 3b4195fe385..f142f4d8016 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java @@ -24,35 +24,20 @@ import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.resources.FileStorage; import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit; -import org.eclipse.cdt.debug.core.cdi.ICDIEventBreakpointHit; -import org.eclipse.cdt.debug.core.cdi.ICDIExitInfo; -import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryEvent; -import org.eclipse.cdt.debug.core.cdi.ICDISignalExitInfo; -import org.eclipse.cdt.debug.core.cdi.ICDISignalReceived; -import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointScope; -import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.core.model.CDebugElementState; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.core.model.ICDebugElement; import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; +import org.eclipse.cdt.debug.core.model.ICDynamicPrintf; import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; -import org.eclipse.cdt.debug.core.model.ICGlobalVariable; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.debug.core.model.ICDynamicPrintf; import org.eclipse.cdt.debug.core.model.ICSignal; import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICThread; import org.eclipse.cdt.debug.core.model.ICTracepoint; import org.eclipse.cdt.debug.core.model.ICType; import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.core.model.ICVariable; import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.core.model.IDummyStackFrame; import org.eclipse.cdt.debug.core.model.IEnableDisableTarget; @@ -80,13 +65,10 @@ import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IDisconnect; import org.eclipse.debug.core.model.IExpression; -import org.eclipse.debug.core.model.IRegister; import org.eclipse.debug.core.model.IRegisterGroup; import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.ITerminate; -import org.eclipse.debug.core.model.IThread; import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.core.model.IWatchExpression; import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; import org.eclipse.debug.ui.DebugUITools; @@ -272,42 +254,12 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode } if ( element instanceof IWatchExpression && ((IWatchExpression)element).hasErrors() ) overlays[OverlayImageDescriptor.BOTTOM_LEFT] = CDebugImages.DESC_OVRS_ERROR; - if ( element instanceof ICVariable && ((ICVariable)element).isArgument() ) - overlays[OverlayImageDescriptor.TOP_RIGHT] = CDebugImages.DESC_OVRS_ARGUMENT; - if ( element instanceof ICGlobalVariable && !(element instanceof IRegister) ) - overlays[OverlayImageDescriptor.TOP_RIGHT] = CDebugImages.DESC_OVRS_GLOBAL; return getImageCache().getImageFor( new OverlayImageDescriptor( baseImage, overlays ) ); } return null; } private Image getBaseImage( Object element ) { - if ( element instanceof ICDebugTarget ) { - ICDebugTarget target = (ICDebugTarget)element; - if ( target.isPostMortem() ) { - return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED ) ); - } - if ( target.isTerminated() || target.isDisconnected() ) { - return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED ) ); - } - return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_DEBUG_TARGET ) ); - } - if ( element instanceof ICThread ) { - ICThread thread = (ICThread)element; - ICDebugTarget target = (ICDebugTarget)thread.getDebugTarget(); - if ( target.isPostMortem() ) { - return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED ) ); - } - if ( thread.isSuspended() ) { - return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED ) ); - } - else if ( thread.isTerminated() ) { - return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED ) ); - } - else { - return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_THREAD_RUNNING ) ); - } - } if ( element instanceof IMarker ) { IBreakpoint bp = getBreakpoint( (IMarker)element ); if ( bp != null && bp instanceof ICBreakpoint ) { @@ -323,12 +275,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode if ( element instanceof IExpression ) { return getExpressionImage( (IExpression)element ); } - if ( element instanceof IRegister ) { - return getRegisterImage( (IRegister)element ); - } - if ( element instanceof IVariable ) { - return getVariableImage( (IVariable)element ); - } if ( element instanceof ICModule ) { return getModuleImage( (ICModule)element ); } @@ -485,10 +431,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode if ( element instanceof IWatchExpression ) { return getWatchExpressionText( (IWatchExpression)element ); } - if ( element instanceof IVariable ) { - label.append( getVariableText( (IVariable)element ) ); - return label.toString(); - } if ( element instanceof IValue ) { label.append( getValueText( (IValue)element ) ); return label.toString(); @@ -518,8 +460,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode } if ( element instanceof IDebugTarget ) label.append( getTargetText( (IDebugTarget)element, showQualified ) ); - else if ( element instanceof IThread ) - label.append( getThreadText( (IThread)element, showQualified ) ); if ( element instanceof ITerminate ) { if ( ((ITerminate)element).isTerminated() ) { label.insert( 0, CDebugUIMessages.getString( "CDTDebugModelPresentation.0" ) ); //$NON-NLS-1$ @@ -615,30 +555,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode return overlays; } - - protected Image getVariableImage( IVariable element ) { - if ( element instanceof ICVariable ) { - ICType type = null; - try { - type = ((ICVariable)element).getType(); - } - catch( DebugException e ) { - // use default image - } - if ( type != null && (type.isPointer() || type.isReference()) ) - return fDebugImageRegistry.get( (((ICVariable)element).isEnabled()) ? CDebugImages.DESC_OBJS_VARIABLE_POINTER : CDebugImages.DESC_OBJS_VARIABLE_POINTER_DISABLED ); - else if ( type != null && (type.isArray() || type.isStructure()) ) - return fDebugImageRegistry.get( (((ICVariable)element).isEnabled()) ? CDebugImages.DESC_OBJS_VARIABLE_AGGREGATE : CDebugImages.DESC_OBJS_VARIABLE_AGGREGATE_DISABLED ); - else - return fDebugImageRegistry.get( (((ICVariable)element).isEnabled()) ? CDebugImages.DESC_OBJS_VARIABLE_SIMPLE : CDebugImages.DESC_OBJS_VARIABLE_SIMPLE_DISABLED ); - } - return null; - } - - protected Image getRegisterImage( IRegister element ) { - return ( ( element instanceof ICVariable && ((ICVariable)element).isEnabled() ) ) ? fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER ) : fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_DISABLED ); - } - protected Image getExpressionImage( IExpression element ) { return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_EXPRESSION ) ); } @@ -659,34 +575,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode return null; } - protected String getVariableText( IVariable var ) throws DebugException { - StringBuffer label = new StringBuffer(); - if ( var instanceof ICVariable ) { - ICType type = null; - try { - type = ((ICVariable)var).getType(); - } - catch( DebugException e ) { - // don't display type - } - if ( type != null && isShowVariableTypeNames() ) { - String typeName = CDebugUIUtils.getVariableTypeName( type ); - if ( typeName != null && typeName.length() > 0 ) { - label.append( typeName ).append( ' ' ); - } - } - String name = var.getName(); - if ( name != null ) - label.append( name.trim() ); - String valueString = getValueText( var.getValue() ); - if ( !isEmpty( valueString ) ) { - label.append( " = " ); //$NON-NLS-1$ - label.append( valueString ); - } - } - return label.toString(); - } - protected String getValueText( IValue value ) { return CDebugUIUtils.getValueText( value ); } @@ -739,75 +627,9 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode } protected String getTargetText( IDebugTarget target, boolean qualified ) throws DebugException { - ICDebugTarget t = target.getAdapter( ICDebugTarget.class ); - if ( t != null ) { - if ( !t.isPostMortem() ) { - CDebugElementState state = t.getState(); - if ( state.equals( CDebugElementState.EXITED ) || state.equals( CDebugElementState.TERMINATED )) { - Object info = t.getCurrentStateInfo(); - String label = CDebugUIMessages.getString( "CDTDebugModelPresentation.3" ); //$NON-NLS-1$ - String reason = ""; //$NON-NLS-1$ - if ( info != null && info instanceof ICDISignalExitInfo ) { - ICDISignalExitInfo sigInfo = (ICDISignalExitInfo)info; - reason = ' ' + MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.5" ), sigInfo.getName(), sigInfo.getDescription() ); //$NON-NLS-1$ - } - else if ( info != null && info instanceof ICDIExitInfo ) { - reason = ' ' + MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.6" ), Integer.valueOf( ((ICDIExitInfo)info).getCode() ) ); //$NON-NLS-1$ - } - return MessageFormat.format( label, target.getName(), reason ); - } - else if ( state.equals( CDebugElementState.SUSPENDED ) ) { - return MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.7" ), target.getName() ); //$NON-NLS-1$ - } - } - } return target.getName(); } - protected String getThreadText( IThread thread, boolean qualified ) throws DebugException { - ICDebugTarget target = thread.getDebugTarget().getAdapter( ICDebugTarget.class ); - if ( target.isPostMortem() ) { - return getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.8" ), thread.getName() ); //$NON-NLS-1$ - } - if ( thread.isTerminated() ) { - return getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.9" ), thread.getName() ); //$NON-NLS-1$ - } - if ( thread.isStepping() ) { - return getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.10" ), thread.getName() ); //$NON-NLS-1$ - } - if ( !thread.isSuspended() ) { - return getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.11" ), thread.getName() ); //$NON-NLS-1$ - } - if ( thread.isSuspended() ) { - String reason = ""; //$NON-NLS-1$ - ICDebugElement element = thread.getAdapter( ICDebugElement.class ); - if ( element != null ) { - Object info = element.getCurrentStateInfo(); - if ( info instanceof ICDISignalReceived ) { - ICDISignal signal = ((ICDISignalReceived)info).getSignal(); - reason = MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.13" ), signal.getName(), signal.getDescription() ); //$NON-NLS-1$ - } - else if ( info instanceof ICDIWatchpointTrigger ) { - reason = MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.14" ), ((ICDIWatchpointTrigger)info).getOldValue(), ((ICDIWatchpointTrigger)info).getNewValue() ); //$NON-NLS-1$ - } - else if ( info instanceof ICDIWatchpointScope ) { - reason = CDebugUIMessages.getString( "CDTDebugModelPresentation.15" ); //$NON-NLS-1$ - } - else if ( info instanceof ICDIBreakpointHit ) { - reason = CDebugUIMessages.getString( "CDTDebugModelPresentation.16" ); //$NON-NLS-1$ - } - else if ( info instanceof ICDISharedLibraryEvent ) { - reason = CDebugUIMessages.getString( "CDTDebugModelPresentation.17" ); //$NON-NLS-1$ - } - else if ( info instanceof ICDIEventBreakpointHit ) { - reason = MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.20" ), ((ICDIEventBreakpointHit)info).getEventBreakpointType() ); //$NON-NLS-1$ - } - } - return MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.18" ), thread.getName(), reason ); //$NON-NLS-1$ - } - return MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.19" ), thread.getName() ); //$NON-NLS-1$ - } - protected String getStackFrameText( IStackFrame f, boolean qualified ) throws DebugException { if ( f instanceof ICStackFrame ) { ICStackFrame frame = (ICStackFrame)f; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java index 977412ba9cf..db8c69f07bc 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java @@ -14,14 +14,12 @@ package org.eclipse.cdt.debug.internal.ui; import java.net.URI; import java.util.Iterator; -import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICType; import org.eclipse.cdt.debug.core.model.ICValue; import org.eclipse.cdt.debug.core.model.IEnableDisableTarget; -import org.eclipse.cdt.debug.internal.ui.disassembly.rendering.DisassemblyEditorInput; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction; import org.eclipse.core.filesystem.URIUtil; @@ -146,16 +144,6 @@ public class CDebugUIUtils { valueString = "."; //$NON-NLS-1$ label.append( valueString ); } - else if ( type != null && type.isFloatingPointType() ) { - Number floatingPointValue = CDebugUtils.getFloatingPointValue( (ICValue)value ); - if ( CDebugUtils.isNaN( floatingPointValue ) ) - valueString = "NAN"; //$NON-NLS-1$ - if ( CDebugUtils.isPositiveInfinity( floatingPointValue ) ) - valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.23" ); //$NON-NLS-1$ - if ( CDebugUtils.isNegativeInfinity( floatingPointValue ) ) - valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.24" ); //$NON-NLS-1$ - label.append( valueString ); - } else if ( valueString.length() > 0 ) { label.append( valueString ); } @@ -221,13 +209,6 @@ public class CDebugUIUtils { if ( input instanceof IPathEditorInput ) { return ((IPathEditorInput)input).getPath().toOSString(); } - if ( input instanceof DisassemblyEditorInput ) { - String sourceFile = ((DisassemblyEditorInput)input).getSourceFile(); - if ( sourceFile != null ) { - return sourceFile; - } - return ((DisassemblyEditorInput)input).getModuleFile(); - } if ( input instanceof IURIEditorInput) { IPath uriPath = URIUtil.toPath(((IURIEditorInput)input).getURI()); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CRegisterManagerProxies.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CRegisterManagerProxies.java deleted file mode 100644 index e746c9bf6cd..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CRegisterManagerProxies.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.ui.elements.adapters.CRegisterManagerProxy; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.contexts.IDebugContextManager; -import org.eclipse.debug.ui.contexts.IDebugContextService; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchWindow; - -/** - * Singleton that keeps track of <code>CRegisterManagerProxy</code> objects - */ -public class CRegisterManagerProxies { - - private static CRegisterManagerProxies fgInstance = new CRegisterManagerProxies(); - - private Map<ICDebugTarget, CRegisterManagerProxy> fMap; - - public static CRegisterManagerProxies getInstance() { - return fgInstance; - } - - public CRegisterManagerProxies() { - super(); - fMap = new HashMap<ICDebugTarget, CRegisterManagerProxy>(); - } - - public void dispose() { - for ( CRegisterManagerProxy proxy : fMap.values() ) { - DebugPlugin.getDefault().removeDebugEventListener( proxy ); - proxy.dispose(); - } - fMap.clear(); - } - - public CRegisterManagerProxy getRegisterManagerProxy( ICDebugTarget target ) { - CRegisterManagerProxy proxy = fMap.get( target ); - if ( proxy == null ) { - synchronized( this ) { - proxy = fMap.get( target ); - if ( proxy == null ) { - proxy = new CRegisterManagerProxy( ((CDebugTarget)target).getRegisterManager() ); - DebugPlugin.getDefault().addDebugEventListener( proxy ); - IDebugContextService service = getContextService(); - if ( service != null ) { - ISelection s = service.getActiveContext(); - if ( s instanceof IStructuredSelection && ((IStructuredSelection)s).size() == 1 ) { - Object context = ((IStructuredSelection)s).getFirstElement(); - proxy.setContext( ( context instanceof ICDebugElement ) ? (ICDebugElement)context : target ); - } - service.addDebugContextListener( proxy ); - } - fMap.put( target, proxy ); - } - } - } - return proxy; - } - - private IDebugContextService getContextService() { - IWorkbenchWindow window = SelectedResourceManager.getDefault().getActiveWindow(); - if ( window != null ) { - IDebugContextManager manager = DebugUITools.getDebugContextManager(); - return manager.getContextService( window ); - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/EvaluationContextManager.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/EvaluationContextManager.java deleted file mode 100644 index a4d554637ee..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/EvaluationContextManager.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IPageListener; -import org.eclipse.ui.IPartListener2; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IWindowListener; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartReference; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * Manages the current evaluation context (stack frame) for evaluation actions. - * In each page, the selection is tracked in each debug view (if any). When a debug - * target selection exists, the "debuggerActive" System property is set to true. - * This property is used to make the "Run to Line" and "Resume at Line" actions - * visible in editors only if there is a running debug session. - */ -public class EvaluationContextManager implements IWindowListener, IPageListener, ISelectionListener, IPartListener2 { - private final static String DEBUGGER_ACTIVE = CDebugUIPlugin.getUniqueIdentifier() + ".debuggerActive"; //$NON-NLS-1$ - protected static EvaluationContextManager fgManager; - private Map<IWorkbenchPage, ICDebugTarget> fContextsByPage = null; - - protected EvaluationContextManager() { - } - - public static void startup() { - Runnable r = new Runnable() { - @Override - public void run() { - if (fgManager == null) { - fgManager = new EvaluationContextManager(); - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchWindow[] windows = workbench.getWorkbenchWindows(); - for (int i = 0; i < windows.length; i++) { - fgManager.windowOpened(windows[i]); - } - workbench.addWindowListener(fgManager); - } - } - }; - CDebugUIPlugin.getStandardDisplay().asyncExec(r); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow) - */ - @Override - public void windowActivated(IWorkbenchWindow window) { - windowOpened(window); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow) - */ - @Override - public void windowDeactivated(IWorkbenchWindow window) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow) - */ - @Override - public void windowClosed(IWorkbenchWindow window) { - window.removePageListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow) - */ - @Override - public void windowOpened(IWorkbenchWindow window) { - IWorkbenchPage[] pages = window.getPages(); - for(int i = 0; i < pages.length; i++) { - window.addPageListener(this); - pageOpened(pages[i]); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPageListener#pageActivated(org.eclipse.ui.IWorkbenchPage) - */ - @Override - public void pageActivated(IWorkbenchPage page) { - pageOpened(page); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPageListener#pageClosed(org.eclipse.ui.IWorkbenchPage) - */ - @Override - public void pageClosed(IWorkbenchPage page) { - page.removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); - page.removePartListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPageListener#pageOpened(org.eclipse.ui.IWorkbenchPage) - */ - @Override - public void pageOpened(IWorkbenchPage page) { - page.addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); - page.addPartListener(this); - IWorkbenchPartReference ref = page.getActivePartReference(); - if (ref != null) { - partActivated(ref); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - @Override - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - IWorkbenchPage page = part.getSite().getPage(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection)selection; - if (ss.size() == 1) { - Object element = ss.getFirstElement(); - if (element instanceof IAdaptable) { - ICDebugTarget target = ((IAdaptable)element).getAdapter(ICDebugTarget.class); - if (target != null) { - setContext(page, target); - return; - } - } - } - } - // no context in the given view - removeContext(page); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partActivated(IWorkbenchPartReference partRef) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partBroughtToTop(IWorkbenchPartReference partRef) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partClosed(IWorkbenchPartReference partRef) { - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(partRef.getId())) { - removeContext(partRef.getPage()); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partDeactivated(IWorkbenchPartReference partRef) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partOpened(IWorkbenchPartReference partRef) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partHidden(IWorkbenchPartReference partRef) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partVisible(IWorkbenchPartReference partRef) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference) - */ - @Override - public void partInputChanged(IWorkbenchPartReference partRef) { - } - - /** - * Sets the evaluation context for the given page, and notes that - * a valid execution context exists. - * - * @param page - * @param frame - */ - private void setContext(IWorkbenchPage page, ICDebugTarget target) { - if (fContextsByPage == null) { - fContextsByPage = new HashMap<IWorkbenchPage, ICDebugTarget>(); - } - fContextsByPage.put(page, target); - System.setProperty(DEBUGGER_ACTIVE, Boolean.TRUE.toString()); - } - - /** - * Removes an evaluation context for the given page, and determines if - * any valid execution context remain. - * - * @param page - */ - private void removeContext(IWorkbenchPage page) { - if (fContextsByPage != null) { - fContextsByPage.remove(page); - if (fContextsByPage.isEmpty()) { - System.setProperty(DEBUGGER_ACTIVE, Boolean.FALSE.toString()); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties index 5e60116ca7d..0b4f3ece6af 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties @@ -19,10 +19,7 @@ LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library_1=Unable to l LoadSymbolsActionDelegate.Operation_failed_1=Operation failed. LoadSymbolsForAllAction.Load_Symbols_For_All_1=Load Symbols For All LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1=Load symbols for all shared libraries. -LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1=Error(s) occurred loading the symbols. LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All -LoadSymbolsForAllActionDelegate.Error_1=Error -LoadSymbolsForAllActionDelegate.0=Operation failed. LoadModuleSymbolsActionDelegate.0=Unable to load symbols. LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols. SignalZeroObjectActionDelegate.0=Unable to resume ignoring the signal. @@ -64,14 +61,10 @@ MoveToLineAdapter.1=Missing document MoveToLineAdapter.2=Empty editor MoveToLineAdapter.3=Operation is not supported. MoveToLineAdapter.4=Move To Line failed. -AddGlobalsActionDelegate.title=Global Variables -AddGlobalsActionDelegate.Error(s)_occured_adding_globals_1=Error(s) occurred adding globals. ManageFunctionBreakpointActionDelegate.Error_1=Error ManageFunctionBreakpointActionDelegate.Operation_failed_1=Operation failed. SignalActionDelegate.0=Unable to deliver the signal to the target. SignalActionDelegate.1=Operation failed. -AddGlobalsActionDelegate.0=Select Variables: -AddGlobalsActionDelegate.1=Add global variables failed. VariableFormatActionDelegate.0=Unable to set format. ExpressionDialog.0=Add Watch Expression ExpressionDialog.1=Expression to watch: @@ -88,18 +81,9 @@ CastToArrayActionDelegate.5=The 'Length' field must not be empty. CastToArrayActionDelegate.6=Invalid length. CastToArrayActionDelegate.7=The length must be greater than 0. CastToArrayActionDelegate.8=Unable to display this variable as an array. -EnableVariablesActionDelegate.0=Exceptions occurred enabling the variable(s). -EnableVariablesActionDelegate.1=Enable variable(s) failed. AddFunctionBreakpointActionDelegate.0=Cannot add function breakpoint. AddLineBreakpointActionDelegate.0=Cannot add line breakpoint. AddWatchpointActionDelegate.0=Cannot add watchpoint. -AddWatchpointDialog.0=Add Watchpoint -AddWatchpointDialog.1=Expression to watch: -AddWatchpointDialog.2=Access -AddWatchpointDialog.3=Write -AddWatchpointDialog.4=Read -AddWatchpointDialog.5=Memory space: -AddWatchpointDialog.6=Units: AddWatchpointOnVariableActionDelegate.No_Element_Size=Failed to get variable/expression size AddWatchpointOnVariableActionDelegate.Error_Dlg_Title=Error ResumeAtLineAdapter.0=Empty editor diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java deleted file mode 100644 index c799394ac5e..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import java.util.Arrays; -import java.util.List; -import org.eclipse.cdt.debug.core.ICGlobalVariableManager; -import org.eclipse.cdt.debug.core.model.IExecFileInfo; -import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.actions.ActionDelegate; -import org.eclipse.ui.dialogs.ListSelectionDialog; - -/** - * A delegate for the "Add Globals" action. - */ -public class AddGlobalsActionDelegate extends ActionDelegate implements IViewActionDelegate, ISelectionListener, IPartListener { - - - class SortedListSelectionDialog extends ListSelectionDialog { - - public SortedListSelectionDialog( Shell parentShell, Object input, IStructuredContentProvider contentProvider, ILabelProvider labelProvider, String message ) { - super( parentShell, input, contentProvider, labelProvider, message ); - } - - @Override - protected Control createDialogArea( Composite parent ) { - Control da = super.createDialogArea( parent ); - getViewer().setSorter( new ViewerSorter() ); - return da; - } - } - - private IGlobalVariableDescriptor[] fGlobals; - - private IViewPart fView = null; - - private IAction fAction; - - private IStructuredSelection fSelection; - - private IStatus fStatus = null; - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) - */ - @Override - public void init( IViewPart view ) { - fView = view; - view.getSite().getPage().addPartListener( this ); - view.getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection) - */ - @Override - public void selectionChanged( IWorkbenchPart part, ISelection selection ) { - if ( part != null && part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) ) { - if ( selection instanceof IStructuredSelection ) { - setSelection( (IStructuredSelection)selection ); - } - else { - setSelection( null ); - } - update( getAction() ); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(IAction) - */ - @Override - public void run( IAction action ) { - final IStructuredSelection selection = getSelection(); - if ( selection == null || selection.size() != 1 ) - return; - BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { - - @Override - public void run() { - try { - doAction( selection.getFirstElement() ); - setStatus( null ); - } - catch( DebugException e ) { - setStatus( e.getStatus() ); - } - } - } ); - IStatus status = getStatus(); - if ( status != null && !status.isOK() ) { - if ( status.isMultiStatus() ) { - status = new MultiStatus( status.getPlugin(), status.getCode(), status.getChildren(), ActionMessages.getString( "AddGlobalsActionDelegate.Error(s)_occured_adding_globals_1" ), status.getException() ); //$NON-NLS-1$ - } - IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); - if ( window != null ) { - CDebugUIPlugin.errorDialog( getErrorDialogMessage(), status ); - } - else { - CDebugUIPlugin.log( status ); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) - */ - @Override - public void selectionChanged( IAction action, ISelection selection ) { - setAction( action ); - if ( getView() != null ) { - update( action ); - } - } - - protected void update( IAction action ) { - if ( action != null ) { - action.setEnabled( getEnableStateForSelection( getSelection() ) ); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart) - */ - @Override - public void partActivated( IWorkbenchPart part ) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart) - */ - @Override - public void partBroughtToTop( IWorkbenchPart part ) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart) - */ - @Override - public void partClosed( IWorkbenchPart part ) { - if ( part.equals( getView() ) ) { - dispose(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart) - */ - @Override - public void partDeactivated( IWorkbenchPart part ) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart) - */ - @Override - public void partOpened( IWorkbenchPart part ) { - } - - protected IViewPart getView() { - return fView; - } - - protected void setView( IViewPart viewPart ) { - fView = viewPart; - } - - protected void setAction( IAction action ) { - fAction = action; - } - - protected IAction getAction() { - return fAction; - } - - private void setSelection( IStructuredSelection selection ) { - fSelection = selection; - } - - private IStructuredSelection getSelection() { - return fSelection; - } - - @Override - public void dispose() { - if ( getView() != null ) { - getView().getViewSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - getView().getViewSite().getPage().removePartListener( this ); - } - } - - protected boolean getEnableStateForSelection( IStructuredSelection selection ) { - if ( selection == null || selection.size() != 1 ) { - return false; - } - Object element = selection.getFirstElement(); - return (element != null && element instanceof IDebugElement && ((IDebugElement)element).getDebugTarget().getAdapter( IExecFileInfo.class ) != null); - } - - private SortedListSelectionDialog createDialog() { - return new SortedListSelectionDialog( getView().getSite().getShell(), fGlobals, new IStructuredContentProvider() { - - @Override - public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) { - } - - @Override - public void dispose() { - } - - @Override - public Object[] getElements( Object parent ) { - return getGlobals(); - } - }, new LabelProvider() { - - @Override - public String getText( Object element ) { - if ( element instanceof IGlobalVariableDescriptor ) { - String path = ""; //$NON-NLS-1$ - if ( ((IGlobalVariableDescriptor)element).getPath() != null ) { - path = ((IGlobalVariableDescriptor)element).getPath().toString(); - int index = path.lastIndexOf( '/' ); - if ( index != -1 ) - path = path.substring( index + 1 ); - } - return (path.length() > 0 ? ('\'' + path + "\'::") : "") + ((IGlobalVariableDescriptor)element).getName(); //$NON-NLS-1$ //$NON-NLS-2$ - } - return null; - } - }, ActionMessages.getString( "AddGlobalsActionDelegate.0" ) ); //$NON-NLS-1$ - } - - protected IGlobalVariableDescriptor[] getGlobals() { - return fGlobals; - } - - protected void doAction( Object element ) throws DebugException { - if ( getView() == null ) - return; - if ( element != null && element instanceof IDebugElement ) { - IExecFileInfo info = ((IDebugElement)element).getDebugTarget().getAdapter( IExecFileInfo.class ); - ICGlobalVariableManager gvm = ((IDebugElement)element).getDebugTarget().getAdapter( ICGlobalVariableManager.class ); - if ( info != null && gvm != null ) { - fGlobals = info.getGlobals(); - ListSelectionDialog dlg = createDialog(); - dlg.setTitle(ActionMessages.getString("AddGlobalsActionDelegate.title")); //$NON-NLS-1$ - dlg.setInitialSelections( gvm.getDescriptors() ); - if ( dlg.open() == Window.OK ) { - List<Object> list = Arrays.asList( dlg.getResult() ); - IGlobalVariableDescriptor[] selections = list.toArray( new IGlobalVariableDescriptor[list.size()] ); - gvm.addGlobals( selections ); - } - } - } - } - - /** - * @see AbstractDebugActionDelegate#getErrorDialogMessage() - */ - protected String getErrorDialogMessage() { - return ActionMessages.getString( "AddGlobalsActionDelegate.1" ); //$NON-NLS-1$ - } - - protected void setStatus( IStatus status ) { - fStatus = status; - } - - protected IStatus getStatus() { - return fStatus; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) - */ - @Override - public void init( IAction action ) { - super.init( action ); - Object element = DebugUITools.getDebugContext(); - setSelection( (element != null) ? new StructuredSelection( element ) : new StructuredSelection() ); - update( action ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java deleted file mode 100644 index b33ea98f716..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java +++ /dev/null @@ -1,436 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.VerifyEvent; -import org.eclipse.swt.events.VerifyListener; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * The "Add Watchpoint" dialog of the "Toggle watchpoint" action. - * @deprecated Replaced by opening a properties dialog on a new breakpoint. - */ -public class AddWatchpointDialog extends Dialog implements ModifyListener, SelectionListener { - - private Combo fExpressionInput; - private String fExpression; - private static List<String> sExpressionHistory = new ArrayList<String>(); - - private boolean fHasMemorySpaceControls; - private Button fMemorySpaceEnableButton; - private Combo fMemorySpaceInput; - private String fMemorySpace; - - private boolean fRangeInitialEnable; - private Button fRangeEnableButton; - private Text fRangeField; - private String fRange = ""; //$NON-NLS-1$ - - private Button fChkBtnWrite; - private Button fChkBtnRead; - private boolean fRead; - private boolean fWrite; - - private ICDIMemorySpaceManagement fMemManagement; - - - /** - * Constructor for AddWatchpointDialog. - * - * @param parentShell - */ - public AddWatchpointDialog( Shell parentShell, ICDIMemorySpaceManagement memMgmt ) { - super( parentShell ); - setShellStyle( getShellStyle() | SWT.RESIZE ); - fMemManagement = memMgmt; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createDialogArea( Composite parent ) { - // The button bar will work better if we make the parent composite - // a single column grid layout. For the widgets we add, we want a - // a two-column grid, so we just create a sub composite for that. - GridLayout gridLayout = new GridLayout(); - parent.setLayout( gridLayout ); - GridData gridData = new GridData( GridData.FILL_BOTH ); - parent.setLayoutData( gridData ); - Composite composite = new Composite( parent, SWT.None ); - gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - composite.setLayout( gridLayout ); - parent = composite; - - // Create the controls - createExpressionControl( parent ); - boolean hasDebugContext = DebugUITools.getDebugContext() != null; - boolean hasMemorySpaces = hasDebugContext && fMemManagement != null && fMemManagement.getMemorySpaces() != null && fMemManagement.getMemorySpaces().length > 0; - fHasMemorySpaceControls = !hasDebugContext || hasMemorySpaces; - if ( fHasMemorySpaceControls ) { - createMemorySpaceControl( parent, hasMemorySpaces ); - } - createCountField( parent ); - createAccessWidgets( parent ); - - // Initialize the inter-control state - if ( fExpression != null && fExpression.length() > 0 ) { - fExpressionInput.add( fExpression, 0 ); - fExpressionInput.select( 0 ); - } - fExpressionInput.setFocus(); - if ( fHasMemorySpaceControls ) { - fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getEnabled() ); - } - fRangeField.setEnabled( fRangeEnableButton.getEnabled() ); - updateUI(); - return parent; - } - - private void createExpressionControl(Composite parent ) { - - Label l = new Label( parent, GridData.FILL_HORIZONTAL ); - l.setText( ActionMessages.getString( "AddWatchpointDialog.1" ) ); //$NON-NLS-1$ - GridData gridData = new GridData( GridData.FILL_HORIZONTAL ); - gridData.horizontalSpan = 2; - l.setLayoutData( gridData ); - - fExpressionInput = new Combo( parent, SWT.BORDER ); - gridData = new GridData( GridData.FILL_HORIZONTAL ); - gridData.horizontalSpan = 2; - fExpressionInput.setLayoutData( gridData ); - fExpressionInput.addModifyListener( this ); - for (String expression : sExpressionHistory) { - fExpressionInput.add( expression ); - } - } - - private void createMemorySpaceControl( Composite parent, boolean hasMemorySpaces ) { - fMemorySpaceEnableButton = new Button( parent, SWT.CHECK ); - GridData gridData = new GridData( GridData.FILL_HORIZONTAL ); - gridData.horizontalSpan = 1; - fMemorySpaceEnableButton.setLayoutData( gridData ); - fMemorySpaceEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.5" ) ); //$NON-NLS-1$ - fMemorySpaceEnableButton.setSelection( false ); - fMemorySpaceEnableButton.addSelectionListener( this ); - - if ( hasMemorySpaces ) { - fMemorySpaceInput = new Combo( parent, SWT.BORDER | SWT.READ_ONLY ); - } else { - fMemorySpaceInput = new Combo( parent, SWT.BORDER ); - } - gridData = new GridData( GridData.FILL_HORIZONTAL ); - gridData.horizontalSpan = 1; - fMemorySpaceInput.setLayoutData( gridData ); - fMemorySpaceInput.addSelectionListener( this ); - if ( fMemManagement != null ) { - String [] memorySpaces = fMemManagement.getMemorySpaces(); - for ( int i = 0; i < memorySpaces.length; i++ ) { - fMemorySpaceInput.add( memorySpaces[i] ); - } - } - if ( fMemorySpace != null && fMemorySpace.length() > 0 ) { - int i = fMemorySpaceInput.indexOf( fMemorySpace ); - if ( i >= 0 ) { - fMemorySpaceInput.select( i ); - fMemorySpaceEnableButton.setSelection( true ); - } else { - fMemorySpaceInput.add( fMemorySpace ); - } - } - fMemorySpaceInput.addModifyListener( this ); - //234909 - for accessibility - fMemorySpaceInput.getAccessible().addAccessibleListener( - new AccessibleAdapter() { - @Override - public void getName(AccessibleEvent e) { - e.result = ActionMessages.getString( "AddWatchpointDialog.5" ); //$NON-NLS-1$ - } - - }); - } - - /** - * @param text - * @param c - * @return true if the concatenation of text + c results - * in a valid string representation of an integer - * @see verifyIntegerText() - */ - private static boolean verifyIntegerTextAddition( String text, char c ) { - - // pass through all control characters - if ( Character.isISOControl( c ) ) { - return true; - } - - // case-insensitive - c = Character.toLowerCase( c ); - text = text.toLowerCase(); - - // first character has to be 0-9 - if ( text.length() == 0 ) { - return Character.isDigit( c ); - } - - // second character must be x if preceded by a 0, otherwise 0-9 will do - if ( text.length() == 1 ) { - if ( text.equals( "0" ) ) { //$NON-NLS-1$ - return c == 'x'; - } - return Character.isDigit( c ); - } - - // all subsequent characters must be 0-9 or a-f if started with 0x - return Character.isDigit( c ) - || text.startsWith( "0x" ) && 'a' <= c && c <= 'f'; //$NON-NLS-1$ - } - - /** - * @param text integer string built up using verifyIntegerTextAddition() - * @return true if text represents a valid string representation of - * an integer - */ - private static boolean verifyIntegerText( String text ) { - if ( text.length() == 0 ) { - return false; - } - if ( text.length() == 1 ) { - return true; - } - if ( text.length() == 2 ) { - return !text.equals("0x"); //$NON-NLS-1$ - } - return true; - } - - private void createCountField( Composite parent ) { - fRangeEnableButton = new Button( parent, SWT.CHECK ); - GridData gridData = new GridData( GridData.FILL_HORIZONTAL ); - gridData.horizontalSpan = 1; - fRangeEnableButton.setLayoutData( gridData ); - fRangeEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.6" ) ); //$NON-NLS-1$ - fRangeEnableButton.setSelection( fRangeInitialEnable && fRange.length() > 0 ); - fRangeEnableButton.addSelectionListener( this ); - - fRangeField = new Text( parent, SWT.BORDER ); - gridData = new GridData( GridData.FILL_HORIZONTAL ); - gridData.horizontalSpan = 1; - GC gc = new GC( fRangeField ); - FontMetrics fm = gc.getFontMetrics(); - gridData.minimumWidth = 8 * fm.getAverageCharWidth(); - fRangeField.setLayoutData( gridData ); - fRangeField.setText( fRange ); - fRangeField.addVerifyListener( new VerifyListener() { - @Override - public void verifyText( VerifyEvent e ) { - e.doit = verifyIntegerTextAddition( fRangeField.getText(), e.character ); - } - }); - fRangeField.addModifyListener( this ); - //234909 - for accessibility - fRangeField.getAccessible().addAccessibleListener( - new AccessibleAdapter() { - @Override - public void getName(AccessibleEvent e) { - e.result = ActionMessages.getString( "AddWatchpointDialog.6" ); //$NON-NLS-1$ - } - - }); - } - - private void createAccessWidgets( Composite parent ) { - GridData gridData = new GridData( GridData.FILL_HORIZONTAL ); - gridData.horizontalSpan = 3; - - Group group = new Group( parent, SWT.NONE ); - group.setLayout( new GridLayout() ); - group.setLayoutData( gridData ); - group.setText( ActionMessages.getString( "AddWatchpointDialog.2" ) ); //$NON-NLS-1$ - fChkBtnWrite = new Button( group, SWT.CHECK ); - fChkBtnWrite.setText( ActionMessages.getString( "AddWatchpointDialog.3" ) ); //$NON-NLS-1$ - fChkBtnWrite.setSelection( true ); - fChkBtnWrite.addSelectionListener( this ); - fChkBtnRead = new Button( group, SWT.CHECK ); - fChkBtnRead.setText( ActionMessages.getString( "AddWatchpointDialog.4" ) ); //$NON-NLS-1$ - fChkBtnRead.setSelection( false ); - fChkBtnRead.addSelectionListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ - @Override - protected void configureShell( Shell newShell ) { - super.configureShell( newShell ); - - // use the same title used by the platform dialog - newShell.setText( ActionMessages.getString( "AddWatchpointDialog.0" ) ); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ - @Override - protected void okPressed() { - fExpression = fExpressionInput.getText().trim(); - if ( fExpression.length() > 0 ) { - addHistory( fExpression ); - } - if ( fHasMemorySpaceControls ) { - fMemorySpace = fMemorySpaceEnableButton.getSelection() ? fMemorySpaceInput.getText().trim() : ""; //$NON-NLS-1$ - } - fRange = fRangeEnableButton.getSelection() ? fRangeField.getText().trim() : "0"; //$NON-NLS-1$ - fRead = fChkBtnRead.getSelection(); - fWrite = fChkBtnWrite.getSelection(); - super.okPressed(); - } - - /* (non-Javadoc) - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - @Override - public void modifyText( ModifyEvent e ) { - updateUI(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createButtonBar( Composite parent ) { - return super.createButtonBar( parent ); - } - - public String getExpression() { - return fExpression; - } - - public String getMemorySpace() { - return fMemorySpace; - } - - private static void addHistory( String item ) { - if ( !sExpressionHistory.contains( item ) ) { - sExpressionHistory.add( 0, item ); - - if ( sExpressionHistory.size() > 5 ) - sExpressionHistory.remove( sExpressionHistory.size() - 1 ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - @Override - public void widgetDefaultSelected( SelectionEvent e ) { - // ignore - } - - /* (non-Javadoc) - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - @Override - public void widgetSelected( SelectionEvent e ) { - updateUI(); - } - - private void updateUI() { - if ( fHasMemorySpaceControls ) { - fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getSelection() ); - } - fRangeField.setEnabled( fRangeEnableButton.getSelection() ); - Button b = getButton( IDialogConstants.OK_ID ); - if ( b == null ) { - return; - } - b.setEnabled( okayEnabled() ); - } - - private boolean okayEnabled() { - if ( !fChkBtnRead.getSelection() && !fChkBtnWrite.getSelection() ) { - return false ; - } - if ( fExpressionInput.getText().length() == 0 ) { - return false; - } - if ( fHasMemorySpaceControls && fMemorySpaceInput.getEnabled() && fMemorySpaceInput.getText().length() == 0 ) { - return false; - } - if ( fRangeField.getEnabled() - && ( fRangeField.getText().length() == 0 || !verifyIntegerText( fRangeField.getText() ) ) ) { - return false; - } - return true; - } - - public boolean getWriteAccess() { - return fWrite; - } - - public boolean getReadAccess() { - return fRead; - } - - public void setExpression(String expressionString ) { - fExpression = expressionString; - } - - public BigInteger getRange() { - return BigInteger.valueOf( Long.decode(fRange).longValue() ); - } - - public void initializeRange( boolean enable, String range ) { - fRangeInitialEnable = enable; - fRange = range; - } - - public void initializeMemorySpace( String memorySpace ) { - fMemorySpace = memorySpace; - } - - @Override - protected void createButtonsForButtonBar(Composite parent) { - // override so we can change the initial okay enabled state - createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, - true ).setEnabled( okayEnabled() ); - createButton( parent, IDialogConstants.CANCEL_ID, - IDialogConstants.CANCEL_LABEL, false ); - } - -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BinaryVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BinaryVariableFormatActionDelegate.java deleted file mode 100644 index a48a9a3d92d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BinaryVariableFormatActionDelegate.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: - * Mark Mitchell, CodeSourcery - Bug 136896: View variables in binary format - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.CVariableFormat; - -/** - * The delegate of the "Binary Format" action. - */ -public class BinaryVariableFormatActionDelegate extends VariableFormatActionDelegate { - - /** - * Constructor for BinaryVariableFormatActionDelegate. - */ - public BinaryVariableFormatActionDelegate() { - super( CVariableFormat.BINARY ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CanFormatObjectTester.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CanFormatObjectTester.java deleted file mode 100644 index 8b1ff2d84ea..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CanFormatObjectTester.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 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.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.debug.core.model.IWatchExpression; - -/** - * Property test for object in selection. - * property: canFormatObject - if object is C/C++ formattable - * @author elaskavaia - * - */ -public class CanFormatObjectTester extends PropertyTester { - - public CanFormatObjectTester() { - - } - - @Override - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - if (property.equals("canFormatObject")) { //$NON-NLS-1$ - if (receiver instanceof ICVariable) { return expectedValue == Boolean.TRUE; } - if (receiver instanceof IWatchExpression) { - IWatchExpression w = (IWatchExpression) receiver; - if (w.getValue() instanceof ICValue) - return expectedValue == Boolean.TRUE; - } - return expectedValue == Boolean.FALSE; - } - return false; - } - -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java deleted file mode 100644 index 613549cc459..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.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.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.CVariableFormat; - -/** - * The delegate of the "Decimal Format" action. - */ -public class DecVariableFormatActionDelegate extends VariableFormatActionDelegate { - - /** - * Constructor for DecVariableFormatActionDelegate. - */ - public DecVariableFormatActionDelegate() { - super( CVariableFormat.DECIMAL ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DisableVariablesActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DisableVariablesActionDelegate.java deleted file mode 100644 index 5ec27b263ce..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DisableVariablesActionDelegate.java +++ /dev/null @@ -1,29 +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.internal.ui.actions; - -/** - * Enter type comment. - * - * @since Jun 19, 2003 - */ -public class DisableVariablesActionDelegate extends EnableVariablesActionDelegate -{ - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate#isEnableAction() - */ - @Override - protected boolean isEnableAction() - { - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java deleted file mode 100644 index bca7a42f68d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import java.util.Iterator; -import org.eclipse.cdt.debug.core.model.IEnableDisableTarget; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.debug.core.DebugException; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -/** - * The delegate of the "Enable" action contribution to the "IVariable" objects. - */ -public class EnableVariablesActionDelegate implements IViewActionDelegate { - - private IViewPart fView; - - private IAction fAction; - - public EnableVariablesActionDelegate() { - } - - protected IViewPart getView() { - return fView; - } - - protected void setView( IViewPart view ) { - fView = view; - } - - protected IAction getAction() { - return fAction; - } - - protected void setAction( IAction action ) { - fAction = action; - } - - /** - * This action enables variables. - */ - protected boolean isEnableAction() { - return true; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - @Override - public void init( IViewPart view ) { - setView( view ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public void run( IAction action ) { - IStructuredSelection selection = getSelection(); - final int size = selection.size(); - if ( size == 0 ) - return; - final Iterator it = selection.iterator(); - final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, ActionMessages.getString( "EnableVariablesActionDelegate.0" ), null ); //$NON-NLS-1$ - BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { - - @Override - public void run() { - while( it.hasNext() ) { - IEnableDisableTarget target = getEnableDisableTarget( it.next() ); - if ( target != null && target.canEnableDisable() ) { - try { - if ( size > 1 ) { - target.setEnabled( isEnableAction() ); - } - else - target.setEnabled( !target.isEnabled() ); - } - catch( DebugException e ) { - ms.merge( e.getStatus() ); - } - } - } - update(); - } - } ); - if ( !ms.isOK() ) { - CDebugUIPlugin.errorDialog( ActionMessages.getString( "EnableVariablesActionDelegate.1" ), ms ); //$NON-NLS-1$ - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - @Override - public void selectionChanged( IAction action, ISelection selection ) { - setAction( action ); - if ( !(selection instanceof IStructuredSelection) ) - return; - IStructuredSelection sel = (IStructuredSelection)selection; - Object o = sel.getFirstElement(); - if ( getEnableDisableTarget( o ) == null ) - return; - Iterator it = sel.iterator(); - boolean allEnabled = true; - boolean allDisabled = true; - while( it.hasNext() ) { - IEnableDisableTarget target = getEnableDisableTarget( it.next() ); - if ( target != null && target.canEnableDisable() ) { - if ( target.isEnabled() ) - allDisabled = false; - else - allEnabled = false; - } - } - if ( isEnableAction() ) - action.setEnabled( !allEnabled ); - else - action.setEnabled( !allDisabled ); - } - - private IStructuredSelection getSelection() { - return (IStructuredSelection)getView().getViewSite().getSelectionProvider().getSelection(); - } - - protected void update() { - getView().getViewSite().getSelectionProvider().setSelection( getView().getViewSite().getSelectionProvider().getSelection() ); - } - - protected IEnableDisableTarget getEnableDisableTarget( Object obj ) { - IEnableDisableTarget target = null; - if ( obj instanceof IAdaptable ) { - target = ((IAdaptable)obj).getAdapter( IEnableDisableTarget.class ); - } - return target; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java deleted file mode 100644 index 3268250b380..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.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.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.CVariableFormat; - -/** - * The delegate of the "Hexadecimal Format" action. - */ -public class HexVariableFormatActionDelegate extends VariableFormatActionDelegate { - - /** - * Constructor for HexVariableFormatActionDelegate. - */ - public HexVariableFormatActionDelegate() { - super( CVariableFormat.HEXADECIMAL ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java deleted file mode 100644 index a1f45d2e6ed..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.IModuleRetrieval; -import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; - -/** - * The delegate for the "Load Symbols For All" action of the Modules view. - */ -public class LoadSymbolsForAllActionDelegate extends AbstractViewActionDelegate { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#getErrorDialogTitle() - */ - @Override - protected String getErrorDialogTitle() { - return ActionMessages.getString( "LoadSymbolsForAllActionDelegate.Error_1" ); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#getErrorDialogMessage() - */ - @Override - protected String getErrorDialogMessage() { - return ActionMessages.getString( "LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1" ); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#doAction() - */ - @Override - protected void doAction() throws DebugException { - ICDebugTarget target = getDebugTarget( getView().getViewer().getInput() ); - if ( target != null ) { - final IModuleRetrieval mr = target.getAdapter( IModuleRetrieval.class ); - if ( mr != null ) { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - - @Override - public void run() { - try { - mr.loadSymbolsForAllModules(); - } - catch( DebugException e ) { - failed( e ); - } - } - } ); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#update() - */ - @Override - protected void update() { - IAction action = getAction(); - if ( getView() != null && getView().getViewer() != null && action != null ) { - ICDebugTarget target = getDebugTarget( getView().getViewer().getInput() ); - action.setEnabled( ( target != null ) ? target.isSuspended() : false ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#doHandleDebugEvent(org.eclipse.debug.core.DebugEvent) - */ - @Override - protected void doHandleDebugEvent( DebugEvent event ) { - } - - private ICDebugTarget getDebugTarget( Object element ) { - if ( element instanceof IAdaptable ) { - return ((IAdaptable)element).getAdapter( ICDebugTarget.class ); - } - return null; - } - - protected void failed( Throwable e ) { - MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, ActionMessages.getString( "LoadSymbolsForAllActionDelegate.0" ), null ); //$NON-NLS-1$ - ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); - CDebugUtils.error( ms, this ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java index 39f29125097..1d4d6f63309 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java @@ -15,8 +15,6 @@ import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.model.IMoveToLine; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.cdt.debug.internal.core.model.CDebugElement; -import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; @@ -29,8 +27,6 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; @@ -64,15 +60,10 @@ public class MoveToLineAdapter implements IMoveToLineTarget { } else { final String fileName = getFileName( input ); - IDebugTarget debugTarget = null; - if (target instanceof CDebugElement) { - debugTarget = ((CDebugElement)target).getDebugTarget(); - } - ITextSelection textSelection = (ITextSelection)selection; final int lineNumber = textSelection.getStartLine() + 1; if ( target instanceof IAdaptable ) { - final IPath path = convertPath( fileName, debugTarget ); + final IPath path = new Path( fileName ); final IMoveToLine moveToLine = ((IAdaptable)target).getAdapter( IMoveToLine.class ); if ( moveToLine != null && moveToLine.canMoveToLine( path.toPortableString(), lineNumber ) ) { Runnable r = new Runnable() { @@ -131,13 +122,7 @@ public class MoveToLineAdapter implements IMoveToLineTarget { if (fileName == null) { return false; } - - IDebugTarget debugTarget = null; - if (target instanceof CDebugElement) { - debugTarget = ((CDebugElement)target).getDebugTarget(); - } - - final IPath path = convertPath( fileName, debugTarget ); + final IPath path = new Path( fileName ); ITextSelection textSelection = (ITextSelection)selection; int lineNumber = textSelection.getStartLine() + 1; return moveToLine.canMoveToLine(path.toPortableString(), lineNumber ); @@ -159,19 +144,4 @@ public class MoveToLineAdapter implements IMoveToLineTarget { ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); CDebugUtils.error( ms, this ); } - private IPath convertPath( String sourceHandle, IDebugTarget debugTarget ) { - IPath path = null; - if ( Path.EMPTY.isValidPath( sourceHandle ) ) { - if ( debugTarget != null ) { - ISourceLocator sl = debugTarget.getLaunch().getSourceLocator(); - if ( sl instanceof CSourceLookupDirector ) { - path = ((CSourceLookupDirector)sl).getCompilationPath( sourceHandle ); - } - } - if ( path == null ) { - path = new Path( sourceHandle ); - } - } - return path; - } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java deleted file mode 100644 index f7ec7f1548f..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.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.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.CVariableFormat; - -/** - * The delegate of the "Natural Format" action. - */ -public class NaturalVariableFormatActionDelegate extends VariableFormatActionDelegate { - - /** - * Constructor for NaturalVariableFormatActionDelegate. - */ - public NaturalVariableFormatActionDelegate() { - super( CVariableFormat.NATURAL ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NumberFormatsContribution.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NumberFormatsContribution.java deleted file mode 100644 index 818a24e7d38..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NumberFormatsContribution.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 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 - * Marc Khouzam (Ericsson) - Support for octal number format (bug 370462) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.debug.core.model.CVariableFormat; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.ContributionItem; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.actions.CompoundContributionItem; -import org.eclipse.ui.menus.IWorkbenchContribution; -import org.eclipse.ui.services.IServiceLocator; - -/** - * Dynamic menu contribution that shows available number formats - * in the current view. - * - * @since 6.0 - */ -public class NumberFormatsContribution extends CompoundContributionItem implements IWorkbenchContribution { - static final String CURRENT_FORMAT = "current_format"; - - private static final Map<CVariableFormat, String> FORMATS = new LinkedHashMap<CVariableFormat, String>(); - static { - FORMATS.put(CVariableFormat.NATURAL, "Default"); - FORMATS.put(CVariableFormat.DECIMAL, "Decimal"); - FORMATS.put(CVariableFormat.HEXADECIMAL, "Hexadecimal"); - FORMATS.put(CVariableFormat.OCTAL, "Octal"); - FORMATS.put(CVariableFormat.BINARY, "Binary"); - } - - private class SelectNumberFormatAction extends Action { - private final CVariableFormat fFormat; - private VariableFormatActionDelegate delegate; - - public VariableFormatActionDelegate getDelegate() { - return delegate; - } - - SelectNumberFormatAction(CVariableFormat format) { - super(FORMATS.get(format), AS_RADIO_BUTTON); - - fFormat = format; - delegate = new VariableFormatActionDelegate(fFormat); - } - - void selectionChanged(ISelection sel) { - delegate.selectionChanged(this, sel); - } - - @Override - public void run() { - if (isChecked()) { - delegate.run(this); - } - } - } - - private IServiceLocator fServiceLocator; - - private static IContributionItem[] NO_ITEMS = new IContributionItem[] { new ContributionItem() { - @Override - public void fill(Menu menu, int index) { - MenuItem item = new MenuItem(menu, SWT.NONE); - item.setEnabled(false); - item.setText("Empty"); - } - - @Override - public boolean isEnabled() { - return false; - } - } }; - - @Override - protected IContributionItem[] getContributionItems() { - ISelectionService service = fServiceLocator.getService(ISelectionService.class); - ISelection selection = service.getSelection(); - - - List<Action> actions = new ArrayList<Action>(FORMATS.size()); - - for (CVariableFormat formatId : FORMATS.keySet()) { - SelectNumberFormatAction action = new SelectNumberFormatAction(formatId); - action.selectionChanged(selection); - actions.add(action); - } - - if (actions.isEmpty()) { return NO_ITEMS; } - - IContributionItem[] items = new IContributionItem[actions.size()]; - for (int i = 0; i < actions.size(); i++) { - items[i] = new ActionContributionItem(actions.get(i)); - } - return items; - } - - @Override - public void initialize(IServiceLocator serviceLocator) { - fServiceLocator = serviceLocator; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveAllGlobalsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveAllGlobalsActionDelegate.java deleted file mode 100644 index fc947dfb7c0..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveAllGlobalsActionDelegate.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import org.eclipse.cdt.debug.core.ICGlobalVariableManager; -import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * A delegate for the "Remove All Globals" action. - */ -public class RemoveAllGlobalsActionDelegate extends ActionDelegate implements IViewActionDelegate, IDebugEventSetListener { - - private IAction fAction; - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - @Override - public void init( IViewPart view ) { - DebugPlugin.getDefault().addDebugEventListener(this); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.actions.ActionDelegate#init(org.eclipse.jface.action.IAction) - */ - @Override - public void init( IAction action ) { - DebugPlugin.getDefault().addDebugEventListener(this); - fAction = action; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - @Override - public void selectionChanged(IAction action, ISelection selection) { - update(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.actions.ActionDelegate#dispose() - */ - @Override - public void dispose() { - DebugPlugin.getDefault().removeDebugEventListener(this); - fAction = null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public void run( IAction action ) { - IAdaptable context = DebugUITools.getDebugContext(); - if ( context instanceof IDebugElement ) { - final ICGlobalVariableManager gvm = ((IDebugElement)context).getDebugTarget().getAdapter( ICGlobalVariableManager.class ); - if ( gvm != null ) { - DebugPlugin.getDefault().asyncExec( - new Runnable() { - @Override - public void run() { - gvm.removeAllGlobals(); - } - } ); - } - } - } - - /** - * Enables/disables the action based on whether there are any globals in the - * variables view. - */ - private void update() { - final IAction action = fAction; - if (action != null) { - final IAdaptable context = DebugUITools.getDebugContext(); - boolean enabled = false; - if (context instanceof IDebugElement) { - final ICGlobalVariableManager gvm = ((IDebugElement) context) - .getDebugTarget().getAdapter( - ICGlobalVariableManager.class); - if (gvm != null) { - final IGlobalVariableDescriptor[] globals = gvm - .getDescriptors(); - enabled = globals != null && globals.length > 0; - } - } - action.setEnabled(enabled); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) - */ - @Override - public void handleDebugEvents( DebugEvent[] events ) { - // The ICGlobalVariableManager will fire a target content-changed - // event when a global is added or removed. Update the enable/disable - // state of this action accordingly - - if (fAction != null) { - for (int i = 0; i < events.length; i++) { - final DebugEvent event = events[i]; - if (event.getSource() instanceof IDebugTarget - && event.getKind() == DebugEvent.CHANGE - && event.getDetail() == DebugEvent.CONTENT ) { - update(); - break; - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveGlobalsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveGlobalsActionDelegate.java deleted file mode 100644 index 8b9f1795f0a..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveGlobalsActionDelegate.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import java.util.ArrayList; -import java.util.Iterator; -import org.eclipse.cdt.debug.core.ICGlobalVariableManager; -import org.eclipse.cdt.debug.core.model.ICGlobalVariable; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * A delegate for the "Remove Globals" action. - */ -public class RemoveGlobalsActionDelegate extends ActionDelegate implements IViewActionDelegate { - - private IAction fAction; - - private ISelection fSelection; - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - @Override - public void init( IViewPart view ) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) - */ - @Override - public void init( IAction action ) { - setAction( action ); - update(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public void run( IAction action ) { - ISelection selection = getSelection(); - if ( !(selection instanceof IStructuredSelection) ) - return; - IStructuredSelection ss = (IStructuredSelection)selection; - final Iterator it = ss.iterator(); - ArrayList list = new ArrayList( ss.size() ); - while( it.hasNext() ) { - Object obj = it.next(); - if ( obj instanceof ICGlobalVariable ) - list.add( obj ); - } - if ( list.size() == 0 ) - return; - final ICGlobalVariable[] globals = (ICGlobalVariable[])list.toArray( new ICGlobalVariable[list.size()] ); - final ICGlobalVariableManager gvm = globals[0].getDebugTarget().getAdapter( ICGlobalVariableManager.class ); - if ( gvm == null ) - return; - Runnable r = new Runnable() { - @Override - public void run() { - gvm.removeGlobals( globals ); - } - }; - DebugPlugin.getDefault().asyncExec( r ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - @Override - public void selectionChanged( IAction action, ISelection selection ) { - setSelection( selection ); - update(); - } - - protected IAction getAction() { - return fAction; - } - - protected ISelection getSelection() { - return fSelection; - } - - private void setAction( IAction action ) { - fAction = action; - } - - private void setSelection( ISelection selection ) { - fSelection = selection; - } - - private void update() { - IAction action = getAction(); - if ( action != null ) { - ISelection selection = getSelection(); - boolean enabled = false; - if ( selection instanceof IStructuredSelection ) { - Iterator it = ((IStructuredSelection)selection).iterator(); - while( it.hasNext() ) { - if ( it.next() instanceof ICGlobalVariable ) { - enabled = true; - break; - } - } - } - action.setEnabled( enabled ); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java index 42aa56e3cf8..ddd6f686481 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java @@ -15,8 +15,6 @@ import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.model.IResumeAtLine; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.cdt.debug.internal.core.model.CDebugElement; -import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; @@ -29,8 +27,6 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; @@ -64,11 +60,7 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget { } else { final String fileName = getFileName( input ); // actually, absolute path, not just file name - IDebugTarget debugTarget = null; - if ( target instanceof CDebugElement ) { - debugTarget = ((CDebugElement)target).getDebugTarget(); - } - final IPath path = convertPath( fileName, debugTarget ); + final IPath path = new Path(fileName); ITextSelection textSelection = (ITextSelection)selection; final int lineNumber = textSelection.getStartLine() + 1; if ( target instanceof IAdaptable ) { @@ -130,12 +122,8 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget { if (fileName == null) { return false; } - IDebugTarget debugTarget = null; - if ( target instanceof CDebugElement ) { - debugTarget = ((CDebugElement)target).getDebugTarget(); - } - final IPath path = convertPath( fileName, debugTarget ); + final IPath path = new Path( fileName ); ITextSelection textSelection = (ITextSelection)selection; int lineNumber = textSelection.getStartLine() + 1; return resumeAtLine.canResumeAtLine( path.toPortableString(), lineNumber ); @@ -157,20 +145,4 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget { ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); CDebugUtils.error( ms, this ); } - - private IPath convertPath( String sourceHandle, IDebugTarget debugTarget ) { - IPath path = null; - if ( Path.EMPTY.isValidPath( sourceHandle ) ) { - if ( debugTarget != null ) { - ISourceLocator sl = debugTarget.getLaunch().getSourceLocator(); - if ( sl instanceof CSourceLookupDirector ) { - path = ((CSourceLookupDirector)sl).getCompilationPath( sourceHandle ); - } - } - if ( path == null ) { - path = new Path( sourceHandle ); - } - } - return path; - } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java index 9f287b31716..a5e77c0cf04 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java @@ -15,8 +15,6 @@ import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.cdt.debug.internal.core.model.CDebugElement; -import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; @@ -29,8 +27,6 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; @@ -67,11 +63,7 @@ public class RunToLineAdapter implements IRunToLineTarget { } else { final String fileName = getFileName( input ); // actually, absolute path, not just file name - IDebugTarget debugTarget = null; - if (target instanceof CDebugElement) { // should always be, but just in case - debugTarget = ((CDebugElement)target).getDebugTarget(); - } - final IPath path = convertPath( fileName, debugTarget ); + final IPath path = new Path( fileName ); ITextSelection textSelection = (ITextSelection)selection; final int lineNumber = textSelection.getStartLine() + 1; if ( target instanceof IAdaptable ) { @@ -134,11 +126,7 @@ public class RunToLineAdapter implements IRunToLineTarget { if (fileName == null) { return false; } - IDebugTarget debugTarget = null; - if (target instanceof CDebugElement) { // should always be, but just in case - debugTarget = ((CDebugElement)target).getDebugTarget(); - } - final IPath path = convertPath( fileName, debugTarget ); + final IPath path = new Path( fileName ); ITextSelection textSelection = (ITextSelection)selection; int lineNumber = textSelection.getStartLine() + 1; @@ -161,20 +149,4 @@ public class RunToLineAdapter implements IRunToLineTarget { ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); CDebugUtils.error( ms, this ); } - - private IPath convertPath( String sourceHandle, IDebugTarget debugTarget ) { - IPath path = null; - if ( Path.EMPTY.isValidPath( sourceHandle ) ) { - if ( debugTarget != null ) { - ISourceLocator sl = debugTarget.getLaunch().getSourceLocator(); - if ( sl instanceof CSourceLookupDirector ) { - path = ((CSourceLookupDirector)sl).getCompilationPath( sourceHandle ); - } - } - if ( path == null ) { - path = new Path( sourceHandle ); - } - } - return path; - } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java index be1a2350e85..16411c980a0 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java @@ -11,11 +11,8 @@ *******************************************************************************/ package org.eclipse.cdt.debug.internal.ui.actions; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ISteppingModeTarget; import org.eclipse.cdt.debug.core.model.ITargetProperties; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.cdt.debug.ui.ICDebugUIConstants; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; @@ -32,10 +29,8 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.widgets.Event; import org.eclipse.ui.IViewActionDelegate; import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.ActionDelegate; /** @@ -114,17 +109,6 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate ISteppingModeTarget target = getTarget(); if ( target != null ) { target.enableInstructionStepping( enabled ); - if ( enabled && target instanceof ICDebugTarget ) { - try { - IWorkbenchPage page = fWindow.getActivePage(); - if (page != null) { - page.showView( ICDebugUIConstants.ID_DSF_DISASSEMBLY_VIEW ); - } - } - catch( PartInitException e ) { - CDebugUIPlugin.log( e.getStatus() ); - } - } } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java deleted file mode 100644 index 857a946fdad..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java +++ /dev/null @@ -1,150 +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.internal.ui.actions; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.debug.core.model.CVariableFormat; -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.cdt.debug.internal.core.model.AbstractCValue; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.model.IWatchExpression; -import org.eclipse.debug.internal.core.WatchExpression; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; - -/** - * The superclass of the all format action delegates. - */ -public class VariableFormatActionDelegate implements IObjectActionDelegate { - private CVariableFormat fFormat = CVariableFormat.NATURAL; - private ICVariable[] fVariables = null; - private IStructuredSelection selection; - - /** - * Constructor for VariableFormatActionDelegate. - */ - public VariableFormatActionDelegate(CVariableFormat format) { - fFormat = format; - } - - /** - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) - */ - @Override - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - } - - /** - * @see org.eclipse.ui.IActionDelegate#run(IAction) - */ - @Override - public void run(IAction action) { - ICVariable[] vars = getVariables(); - if (vars != null && vars.length > 0) { - final MultiStatus ms = new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "", null); //$NON-NLS-1$ - BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { - @Override - public void run() { - try { - doAction(getVariables()); - } catch (DebugException e) { - ms.merge(e.getStatus()); - } - } - }); - if (!ms.isOK()) { - IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); - if (window != null) { - CDebugUIPlugin.errorDialog(ActionMessages.getString("VariableFormatActionDelegate.0"), ms); //$NON-NLS-1$ - } else { - CDebugUIPlugin.log(ms); - } - } - } - } - - /** - * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) - */ - @Override - public void selectionChanged(IAction action, ISelection selection) { - - if (selection instanceof IStructuredSelection) { - this.selection = (IStructuredSelection) selection; - List<ICVariable> list = new ArrayList<ICVariable>(); - IStructuredSelection ssel = (IStructuredSelection) selection; - Iterator i = ssel.iterator(); - while (i.hasNext()) { - Object o = i.next(); - if (o instanceof ICVariable) { - ICVariable var = (ICVariable) o; - list.add(var); - } else if (o instanceof IWatchExpression) { - IWatchExpression expr = (IWatchExpression) o; - IValue value = expr.getValue(); - if (value instanceof AbstractCValue) { - ICVariable parent = ((AbstractCValue) value).getParentVariable(); - if (parent != null) { - list.add(parent); - } - } - } - } - for (Iterator<ICVariable> iterator = list.iterator(); iterator.hasNext();) { - ICVariable var = iterator.next(); - boolean enabled = var.supportsFormatting(); - action.setEnabled(enabled); - if (enabled) { - action.setChecked(var.getFormat() == fFormat); - } else { - iterator.remove(); - } - } - setVariables(list.toArray(new ICVariable[list.size()])); - } else { - action.setChecked(false); - action.setEnabled(false); - } - } - - - protected void doAction( ICVariable[] vars ) throws DebugException { - for( int i = 0; i < vars.length; i++ ) { - vars[i].changeFormat( fFormat ); - } - for (Iterator iterator = selection.iterator(); iterator.hasNext();) { - Object o = iterator.next(); - if (o instanceof WatchExpression){ - ((WatchExpression)o).evaluate(); - } - } - } - - protected ICVariable[] getVariables() { - return fVariables; - } - - private void setVariables(ICVariable[] variables) { - fVariables = variables; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java index 51f9aaa3c6d..13ce246a0bc 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java @@ -18,10 +18,7 @@ import java.util.HashMap; import java.util.Map; import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; @@ -29,8 +26,6 @@ import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.ui.breakpoints.AbstractToggleBreakpointAdapter; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.ui.DebugUITools; import org.eclipse.ui.IWorkbenchPart; /** @@ -112,23 +107,4 @@ public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter { protected int getBreakpointType() { return ICBreakpointType.REGULAR; } - - public static ICDIMemorySpaceManagement getMemorySpaceManagement(){ - IAdaptable debugViewElement = DebugUITools.getDebugContext(); - ICDIMemorySpaceManagement memMgr = null; - - if ( debugViewElement != null ) { - ICDebugTarget debugTarget = debugViewElement.getAdapter(ICDebugTarget.class); - - if ( debugTarget != null ){ - ICDITarget target = debugTarget.getAdapter(ICDITarget.class); - - if (target instanceof ICDIMemorySpaceManagement) - memMgr = (ICDIMemorySpaceManagement)target; - } - } - - return memMgr; - } - } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties index 8942d9a016e..0605ed04b41 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties @@ -38,7 +38,6 @@ CBreakpointPropertyPage.watchpointType_write_label=Write CBreakpointPropertyPage.watchpoint_expression_label=Expression to watch: CBreakpointPropertyPage.watchpoint_expression_errorMessage=Enter the expression to watch: CBreakpointPropertyPage.watchpoint_range_label=Range: -CBreakpointPropertyPage.watchpoint_memorySpace_label=Memory Space: CBreakpointPropertyPage.workspace_button=W&orkspace... CBreakpointPropertyPage.condition_label=&Condition: CBreakpointPropertyPage.condition_invalidValue_message=Invalid condition. @@ -47,8 +46,6 @@ CBreakpointPropertyPage.breakpointType_label=Class: CBreakpointPropertyPage.enabled_label=Enabled CBreakpointPropertyPage.eventType_label=Event Type -ThreadFilterEditor.0=&Restrict to Selected Targets and Threads: - TracepointPropertyPage.tracepointType_function_label=C/C++ Function Tracepoint TracepointPropertyPage.tracepointType_address_label=C/C++ Address Tracepoint TracepointPropertyPage.tracepointType_line_label=C/C++ Line Tracepoint diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java deleted file mode 100644 index 78a1023d9d0..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.breakpoints; - -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointFilterExtension; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.dialogs.PropertyPage; - -public class CBreakpointFilteringPage extends PropertyPage { - - private ThreadFilterEditor fThreadFilterEditor; - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createContents( Composite parent ) { - noDefaultAndApplyButton(); - Composite mainComposite = new Composite( parent, SWT.NONE ); - mainComposite.setFont( parent.getFont() ); - mainComposite.setLayout( new GridLayout() ); - mainComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); - createThreadFilterEditor( mainComposite ); - setValid( true ); - return mainComposite; - } - - public ICBreakpoint getBreakpoint() { - return getElement().getAdapter(ICBreakpoint.class); - } - - public ICBreakpointFilterExtension getFilterExtension() { - ICBreakpoint bp = getBreakpoint(); - if (bp != null) { - try { - return bp.getExtension( - CDIDebugModel.getPluginIdentifier(), ICBreakpointFilterExtension.class); - } catch (CoreException e) {} - } - return null; - } - - protected void createThreadFilterEditor( Composite parent ) { - fThreadFilterEditor = new ThreadFilterEditor( parent, this ); - } - - protected ThreadFilterEditor getThreadFilterEditor() { - return fThreadFilterEditor; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - @Override - public boolean performOk() { - doStore(); - return super.performOk(); - } - - /** - * Stores the values configured in this page. - */ - protected void doStore() { - fThreadFilterEditor.doStore(); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java index dcdf5d43ab0..19b6e6b83f8 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java @@ -19,11 +19,8 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; @@ -524,25 +521,7 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement } return array2d; } - - private ICDIMemorySpaceManagement getMemorySpaceManagement(){ - Object debugViewElement = getDebugContext(); - ICDIMemorySpaceManagement memMgr = null; - - if ( debugViewElement != null ) { - ICDebugTarget debugTarget = (ICDebugTarget)DebugPlugin.getAdapter(debugViewElement, ICDebugTarget.class); - - if ( debugTarget != null ){ - ICDITarget target = debugTarget.getAdapter(ICDITarget.class); - - if (target instanceof ICDIMemorySpaceManagement) - memMgr = (ICDIMemorySpaceManagement)target; - } - } - - return memMgr; - } - + class LabelFieldEditor extends ReadOnlyFieldEditor { private String fValue; @@ -769,17 +748,9 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement protected void createWatchMemorySpaceEditor( Composite parent ) { ICBreakpoint breakpoint = getBreakpoint(); if (breakpoint == null || breakpoint.getMarker() == null) { - ICDIMemorySpaceManagement memSpaceMgmt = getMemorySpaceManagement(); - if (memSpaceMgmt != null) { - String[] memorySpaces = memSpaceMgmt.getMemorySpaces(); - if (memorySpaces != null && memorySpaces.length != 0) { - addField( new WatchpointMemorySpaceFieldEditor( - ICWatchpoint2.MEMORYSPACE, - BreakpointsMessages.getString("CBreakpointPropertyPage.watchpoint_memorySpace_label"), //$NON-NLS-1$ - memorySpaces, - parent) ); - } - } + // XXX: In pre-CDI removal this set up additional field by getting memory space + // from ICDIMemorySpaceManagement. post-CDT removal memory space is still displayed + // (else below) but cannot be set on new breakpoints } else { String memorySpace = getPreferenceStore().getString(ICWatchpoint2.MEMORYSPACE); if (memorySpace != null && memorySpace.length() != 0) { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java index 4f5f9b517d1..425ffd72f1f 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java @@ -11,9 +11,9 @@ package org.eclipse.cdt.debug.internal.ui.breakpoints; import java.util.Map; + import org.eclipse.cdt.debug.core.ICBreakpointListener; import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugPlugin; @@ -54,22 +54,6 @@ public class CBreakpointUpdater implements ICBreakpointListener { */ @Override public void breakpointInstalled( final IDebugTarget target, IBreakpoint breakpoint ) { - if ( breakpoint instanceof ICBreakpoint && target instanceof ICDebugTarget ) { - final ICBreakpoint b = (ICBreakpoint)breakpoint; - asyncExec( new Runnable() { - - @Override - public void run() { - try { - if ( b.incrementInstallCount() == 1 ) - DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( b ); - } - catch( CoreException e ) { - CDebugUIPlugin.log( e.getStatus() ); - } - } - } ); - } } /* diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java deleted file mode 100644 index b3278845520..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.breakpoints; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.model.ICBreakpointFilterExtension; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -public class ThreadFilterEditor { - - /** - * Comment for ThreadFilterEditor. - */ - public class CheckHandler implements ICheckStateListener { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) - */ - @Override - public void checkStateChanged( CheckStateChangedEvent event ) { - Object element = event.getElement(); - if ( element instanceof IDebugTarget ) { - checkTarget( (IDebugTarget)element, event.getChecked() ); - } - else if ( element instanceof IThread ) { - checkThread( (IThread)element, event.getChecked() ); - } - } - - /** - * Check or uncheck a debug target in the tree viewer. - * When a debug target is checked, attempt to - * check all of the target's threads by default. - * When a debug target is unchecked, uncheck all - * its threads. - */ - protected void checkTarget( IDebugTarget target, boolean checked ) { - getThreadViewer().setChecked( target, checked ); - getThreadViewer().setGrayed( target, false ); - getThreadViewer().expandToLevel( target, AbstractTreeViewer.ALL_LEVELS ); - IThread[] threads; - try { - threads = target.getThreads(); - } - catch( DebugException exception ) { - CDebugUIPlugin.log( exception ); - return; - } - for( int i = 0; i < threads.length; i++ ) { - getThreadViewer().setChecked( threads[i], checked ); - getThreadViewer().setGrayed( threads[i], false ); - } - } - - /** - * Check or uncheck a thread. - * Update the thread's debug target. - */ - protected void checkThread( IThread thread, boolean checked ) { - getThreadViewer().setChecked( thread, checked ); - IDebugTarget target = (thread).getDebugTarget(); - IThread[] threads; - try { - threads = target.getThreads(); - } - catch( DebugException exception ) { - CDebugUIPlugin.log( exception ); - return; - } - int checkedNumber = 0; - for( int i = 0; i < threads.length; i++ ) { - if ( getThreadViewer().getChecked( threads[i] ) ) { - ++checkedNumber; - } - } - if ( checkedNumber == 0 ) { - getThreadViewer().setChecked( target, false ); - getThreadViewer().setGrayed( target, false ); - } - else if ( checkedNumber == threads.length ) { - getThreadViewer().setChecked( target, true ); - getThreadViewer().setGrayed( target, false ); - } - else { - getThreadViewer().setGrayChecked( target, true ); - } - } - } - - /** - * Comment for ThreadFilterEditor. - */ - public class ThreadFilterContentProvider implements ITreeContentProvider { - - /** - * Constructor for ThreadFilterContentProvider. - */ - public ThreadFilterContentProvider() { - super(); - // TODO Auto-generated constructor stub - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ - @Override - public Object[] getChildren( Object parent ) { - if ( parent instanceof IDebugTarget ) { - ICDebugTarget target = ((IDebugTarget)parent).getAdapter( ICDebugTarget.class ); - if ( target != null ) { - try { - return ((ICDebugTarget)parent).getThreads(); - } - catch( DebugException e ) { - CDebugUIPlugin.log( e ); - } - } - } - if ( parent instanceof ILaunchManager ) { - List<Object> children = new ArrayList<Object>(); - ILaunch[] launches = ((ILaunchManager)parent).getLaunches(); - IDebugTarget[] targets; - ICDebugTarget target; - for( int i = 0, numLaunches = launches.length; i < numLaunches; i++ ) { - targets = launches[i].getDebugTargets(); - for( int j = 0, numTargets = targets.length; j < numTargets; j++ ) { - target = targets[j].getAdapter( ICDebugTarget.class ); - if ( target != null && !target.isDisconnected() && !target.isTerminated() ) { - children.add( target ); - } - } - } - return children.toArray(); - } - return new Object[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - */ - @Override - public Object getParent( Object element ) { - if ( element instanceof IThread ) { - return ((IThread)element).getDebugTarget(); - } - if ( element instanceof IDebugTarget ) { - return ((IDebugElement)element).getLaunch(); - } - if ( element instanceof ILaunch ) { - return DebugPlugin.getDefault().getLaunchManager(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - */ - @Override - public boolean hasChildren( Object element ) { - if ( element instanceof IStackFrame ) { - return false; - } - if ( element instanceof IDebugElement ) { - return getChildren( element ).length > 0; - } - if ( element instanceof ILaunch ) { - return true; - } - if ( element instanceof ILaunchManager ) { - return ((ILaunchManager)element).getLaunches().length > 0; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - @Override - public Object[] getElements( Object inputElement ) { - return getChildren( inputElement ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - @Override - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - @Override - public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) { - } - } - - private CBreakpointFilteringPage fPage; - - private CheckboxTreeViewer fThreadViewer; - - private ThreadFilterContentProvider fContentProvider; - - private CheckHandler fCheckHandler; - - /** - * Constructor for ThreadFilterEditor. - */ - public ThreadFilterEditor( Composite parent, CBreakpointFilteringPage page ) { - fPage = page; - fContentProvider = new ThreadFilterContentProvider(); - fCheckHandler = new CheckHandler(); - createThreadViewer( parent ); - } - - protected CBreakpointFilteringPage getPage() { - return fPage; - } - - private void createThreadViewer( Composite parent ) { - Label label = new Label( parent, SWT.NONE ); - label.setText( BreakpointsMessages.getString( "ThreadFilterEditor.0" ) ); //$NON-NLS-1$ - label.setFont( parent.getFont() ); - label.setLayoutData( new GridData() ); - GridData data = new GridData( GridData.FILL_BOTH ); - data.heightHint = 100; - fThreadViewer = new CheckboxTreeViewer( parent, SWT.BORDER ); - fThreadViewer.addCheckStateListener( fCheckHandler ); - fThreadViewer.getTree().setLayoutData( data ); - fThreadViewer.getTree().setFont( parent.getFont() ); - fThreadViewer.setContentProvider( fContentProvider ); - fThreadViewer.setLabelProvider( DebugUITools.newDebugModelPresentation() ); - fThreadViewer.setInput( DebugPlugin.getDefault().getLaunchManager() ); - setInitialCheckedState(); - } - - /** - * Returns the debug targets that appear in the tree - */ - protected IDebugTarget[] getDebugTargets() { - Object input = fThreadViewer.getInput(); - if ( !(input instanceof ILaunchManager) ) { - return new IDebugTarget[0]; - } - ILaunchManager launchManager = (ILaunchManager)input; - return launchManager.getDebugTargets(); - } - - protected CheckboxTreeViewer getThreadViewer() { - return fThreadViewer; - } - - /** - * Sets the initial checked state of the tree viewer. - * The initial state should reflect the current state - * of the breakpoint. If the breakpoint has a thread - * filter in a given thread, that thread should be - * checked. - */ - protected void setInitialCheckedState() { - ICBreakpointFilterExtension filterExtension = fPage.getFilterExtension(); - try { - ICDebugTarget[] targets = filterExtension.getTargetFilters(); - for( int i = 0; i < targets.length; i++ ) { - ICThread[] filteredThreads = filterExtension.getThreadFilters( targets[i] ); - if ( filteredThreads != null ) { - for ( int j = 0; j < filteredThreads.length; ++j ) - fCheckHandler.checkThread( filteredThreads[j], true ); - } - else { - fCheckHandler.checkTarget( targets[i], true ); - } - } - } - catch( CoreException e ) { - CDebugUIPlugin.log( e ); - } - } - - protected void doStore() { - ICBreakpointFilterExtension filterExtension = fPage.getFilterExtension(); - IDebugTarget[] targets = getDebugTargets(); - for ( int i = 0; i < targets.length; ++i ) { - if ( !(targets[i] instanceof ICDebugTarget) ) - continue; - try { - if ( getThreadViewer().getChecked( targets[i] ) ) { - if ( getThreadViewer().getGrayed( targets[i] ) ) { - ICThread[] threads = getTargetThreadFilters( (ICDebugTarget)targets[i] ); - filterExtension.setThreadFilters( threads ); - } - else { - filterExtension.setTargetFilter( (ICDebugTarget)targets[i] ); - } - } - else { - filterExtension.removeTargetFilter( (ICDebugTarget)targets[i] ); - } - DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( fPage.getBreakpoint() ); - } - catch( CoreException e ) { - CDebugUIPlugin.log( e ); - } - } - } - - private ICThread[] getTargetThreadFilters( ICDebugTarget target ) { - Object[] threads = ((ITreeContentProvider)getThreadViewer().getContentProvider()).getChildren( target ); - ArrayList<ICThread> list = new ArrayList<ICThread>( threads.length ); - for ( int i = 0; i < threads.length; ++i ) { - if ( getThreadViewer().getChecked( threads[i] ) ) - list.add( (ICThread)threads[i] ); - } - return list.toArray( new ICThread[list.size()] ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java index 66a530f20e2..fbcf59efb0b 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java @@ -21,7 +21,6 @@ import org.eclipse.cdt.core.model.IFunctionDeclaration; import org.eclipse.cdt.core.model.IMethodDeclaration; import org.eclipse.cdt.core.model.IVariableDeclaration; import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor; import org.eclipse.cdt.internal.ui.editor.CEditor; import org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor; import org.eclipse.core.expressions.PropertyTester; @@ -84,10 +83,6 @@ public class ToggleCBreakpointTester extends PropertyTester { return true; // can't figure the associated project, enable it by default. } } - } else if ("isDisassemblyEditorSupportsCBreakpoint".equals(property) && (receiver instanceof DisassemblyEditor)) { //$NON-NLS-1$ - if (!CDebugUtils.isCustomToggleBreakpointFactory()) - return true; - // No additional check is required, the check for the receiver is enough. // test for IVariableDeclaration, IFunctionDeclaration, IMethodDeclaration } else if ("isCDeclarationSupportsCBreakpoint".equals(property) && (receiver instanceof List<?>)) { //$NON-NLS-1$ diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/AbstractRegisterGroupCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/AbstractRegisterGroupCommandHandler.java deleted file mode 100644 index 4d61e76638f..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/AbstractRegisterGroupCommandHandler.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Alvaro Sanchez-Leon (Ericsson) - Support Register Groups (Bug 235747) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.commands; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup; -import org.eclipse.cdt.debug.core.model.IRegisterDescriptor; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages; -import org.eclipse.cdt.debug.internal.ui.actions.RegisterGroupDialog; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Display; - -public abstract class AbstractRegisterGroupCommandHandler extends AbstractHandler { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#addRegisterGroup(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public void addRegisterGroup(IStructuredSelection selection) { - ICDebugTarget t = getDebugTarget(selection); - if (t != null) { - // Using Debug model - try { - IRegisterDescriptor[] registers = t.getRegisterDescriptors(); - RegisterGroupDialog dialog = new RegisterGroupDialog(Display.getCurrent().getActiveShell(), registers); - if (dialog.open() == Window.OK) { - t.addRegisterGroup(dialog.getName(), dialog.getDescriptors()); - } - } catch (DebugException e) { - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#canAddRegisterGroup(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public boolean canAddRegisterGroup(IStructuredSelection selection) { - ICDebugTarget target = getDebugTarget(selection); - return (target != null) ? target.isSuspended() : false; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#editRegisterGroup(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public void editRegisterGroup(IStructuredSelection selection) { - IPersistableRegisterGroup group = getRegisterGroup(selection); - if (group == null) { - return; - } - - IRegisterDescriptor[] all; - try { - all = ((CDebugTarget) group.getDebugTarget()).getRegisterDescriptors(); - RegisterGroupDialog dialog = new RegisterGroupDialog(Display.getCurrent().getActiveShell(), - group.getName(), all, group.getRegisterDescriptors()); - if (dialog.open() == Window.OK) { - IDebugTarget target = group.getDebugTarget(); - if (target instanceof ICDebugTarget) { - ((ICDebugTarget) target).modifyRegisterGroup(group, dialog.getDescriptors()); - } - } - } catch (DebugException e) { - CDebugUIPlugin.errorDialog(ActionMessages.getString("EditRegisterGroupActionDelegate.0"), e.getStatus()); //$NON-NLS-1$ - } - - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#canEditRegisterGroup(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public boolean canEditRegisterGroup(IStructuredSelection selection) { - IPersistableRegisterGroup group = getRegisterGroup(selection); - return (group != null); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#removeRegisterGroups(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public void removeRegisterGroups(IStructuredSelection selection) { - IRegisterGroup[] groups = getRegisterGroups(selection); - if (groups.length > 0) { - IDebugTarget target = groups[0].getDebugTarget(); - if (target instanceof ICDebugTarget) { - ((ICDebugTarget) target).removeRegisterGroups(groups); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#canRemoveRegisterGroups(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public boolean canRemoveRegisterGroups(IStructuredSelection selection) { - IRegisterGroup[] groups = getRegisterGroups(selection); - if (groups.length > 0) { - return true; - } - - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#restoreDefaultGroups(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public void restoreDefaultGroups(IStructuredSelection selection) { - getDebugTarget(selection).restoreDefaultRegisterGroups(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.actions.IRegisterGroupActionsTarget#canRestoreDefaultGroups(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.IStructuredSelection) - */ - public boolean canRestoreDefaultGroups(IStructuredSelection selection) { - ICDebugTarget target = getDebugTarget(selection); - return (target != null) ? target.isSuspended() : false; - } - - private ICDebugTarget getDebugTarget(IStructuredSelection selection) { - - Object element = selection.getFirstElement(); - - if (element instanceof IDebugElement) { - return ((IDebugElement) element).getDebugTarget().getAdapter(ICDebugTarget.class); - } - return null; - } - - private IPersistableRegisterGroup getRegisterGroup(IStructuredSelection ss) { - IPersistableRegisterGroup selectedGroup = null; - if (!ss.isEmpty()) { - Object s = ss.getFirstElement(); - if (s instanceof IPersistableRegisterGroup) { - selectedGroup = (IPersistableRegisterGroup) s; - } - } - - return selectedGroup; - } - - private IRegisterGroup[] getRegisterGroups(IStructuredSelection ss) { - ArrayList<IRegisterGroup> list = new ArrayList<IRegisterGroup>(); - for (Iterator<?> iterator = ss.iterator(); iterator.hasNext();) { - Object selection = iterator.next(); - if (selection instanceof IRegisterGroup) { - list.add((IRegisterGroup) selection); - } - } - - return list.toArray(new IRegisterGroup[list.size()]); - } - -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/AddRegisterGroupCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/AddRegisterGroupCommandHandler.java deleted file mode 100644 index 9563d2ad9ad..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/AddRegisterGroupCommandHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.commands; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.expressions.IEvaluationContext; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.ISources; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Command handler to trigger an AddRegisterGroup operation - */ -public class AddRegisterGroupCommandHandler extends AbstractRegisterGroupCommandHandler { - - public void setEnabled(Object evaluationContext) { - boolean state = false; - if (evaluationContext instanceof IEvaluationContext) { - Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); - if (s instanceof IStructuredSelection) { - state = canAddRegisterGroup((IStructuredSelection)s); - } - } - setBaseEnabled(state); - } - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection selection = HandlerUtil.getCurrentSelection(event); - if (selection instanceof IStructuredSelection) { - addRegisterGroup((IStructuredSelection)selection); - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/EditRegisterGroupCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/EditRegisterGroupCommandHandler.java deleted file mode 100644 index ba376b87e89..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/EditRegisterGroupCommandHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.commands; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.expressions.IEvaluationContext; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.ISources; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Command handler to trigger an AddRegisterGroup operation - */ -public class EditRegisterGroupCommandHandler extends AbstractRegisterGroupCommandHandler { - - public void setEnabled(Object evaluationContext) { - boolean state = false; - if (evaluationContext instanceof IEvaluationContext) { - Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); - if (s instanceof IStructuredSelection) { - state = canEditRegisterGroup((IStructuredSelection)s); - } - } - setBaseEnabled(state); - } - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection selection = HandlerUtil.getCurrentSelection(event); - if (selection instanceof IStructuredSelection) { - editRegisterGroup((IStructuredSelection)selection); - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/LoadAllSymbolsCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/LoadAllSymbolsCommandHandler.java deleted file mode 100644 index 82e27d01f2e..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/LoadAllSymbolsCommandHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software System and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elena Laskavaia (QNX) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.commands; - -import org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsForAllActionDelegate; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.jface.action.Action; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; - -public class LoadAllSymbolsCommandHandler extends AbstractHandler implements IHandler { - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - final IWorkbenchPart part = HandlerUtil.getActivePart(event); - - if (part instanceof IViewPart) { - LoadSymbolsForAllActionDelegate delegate = new LoadSymbolsForAllActionDelegate(); - delegate.init((IViewPart) part); - delegate.run(new Action() { - }); - delegate.dispose(); - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/LoadSymbolsCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/LoadSymbolsCommandHandler.java deleted file mode 100644 index 44bb6aae0c4..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/LoadSymbolsCommandHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software System and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elena Laskavaia (QNX) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.commands; - -import org.eclipse.cdt.debug.internal.ui.actions.LoadModuleSymbolsActionDelegate; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; - -public class LoadSymbolsCommandHandler extends AbstractHandler implements IHandler { - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - final IWorkbenchPart part = HandlerUtil.getActivePart(event); - ISelection selection = HandlerUtil.getCurrentSelection(event); - LoadModuleSymbolsActionDelegate delegate = new LoadModuleSymbolsActionDelegate(); - IAction action = new Action() { };// fake action - delegate.selectionChanged(action, selection); - delegate.setActivePart(action, part); - if (action.isEnabled()) - delegate.run(action); - delegate.dispose(); - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/RemoveRegisterGroupsCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/RemoveRegisterGroupsCommandHandler.java deleted file mode 100644 index 540c74d6abf..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/RemoveRegisterGroupsCommandHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.commands; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.expressions.IEvaluationContext; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.ISources; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Command handler to trigger a RemoveRegisterGroups operation - */ -public class RemoveRegisterGroupsCommandHandler extends AbstractRegisterGroupCommandHandler { - - public void setEnabled(Object evaluationContext) { - boolean state = false; - if (evaluationContext instanceof IEvaluationContext) { - Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); - if (s instanceof IStructuredSelection) { - state = canRemoveRegisterGroups((IStructuredSelection)s); - } - } - setBaseEnabled(state); - } - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection selection = HandlerUtil.getCurrentSelection(event); - if (selection instanceof IStructuredSelection) { - removeRegisterGroups((IStructuredSelection)selection); - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/RestoreRegisterGroupsCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/RestoreRegisterGroupsCommandHandler.java deleted file mode 100644 index 3943cca8401..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/RestoreRegisterGroupsCommandHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.commands; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.expressions.IEvaluationContext; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.ISources; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Command handler to trigger an AddRegisterGroup operation - */ -public class RestoreRegisterGroupsCommandHandler extends AbstractRegisterGroupCommandHandler { - - public void setEnabled(Object evaluationContext) { - boolean state = false; - if (evaluationContext instanceof IEvaluationContext) { - Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); - if (s instanceof IStructuredSelection) { - state = canRestoreDefaultGroups((IStructuredSelection)s); - } - } - setBaseEnabled(state); - } - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection selection = HandlerUtil.getCurrentSelection(event); - if (selection instanceof IStructuredSelection) { - restoreDefaultGroups((IStructuredSelection)selection); - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ViewMemoryHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ViewMemoryHandler.java deleted file mode 100644 index 6f3d2eb4c7a..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ViewMemoryHandler.java +++ /dev/null @@ -1,77 +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.internal.ui.commands; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.cdt.debug.internal.ui.views.memory.AddMemoryBlocks; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.memory.IMemoryRenderingSite; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Handler for viewing variable in memory view command, based on - * org.eclipse.cdt.debug.internal.ui.actions.ViewMemoryActionDelegate - * - */ -public class ViewMemoryHandler extends AbstractHandler { - - /* - * (non-Javadoc) - * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) - */ - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection selection = HandlerUtil.getCurrentSelection(event); - if (selection instanceof IStructuredSelection) { - List<Object> list = new ArrayList<Object>(); - Iterator<?> iter = ((IStructuredSelection)selection).iterator(); - while (iter.hasNext()) { - Object obj = iter.next(); - if (obj instanceof ICVariable) { - list.add(obj); - } - } - ICVariable[] variables = list.toArray(new ICVariable[list.size()]); - showInMemoryView(variables); - } - return null; - } - - private void showInMemoryView(ICVariable[] variables) { - try { - IWorkbenchPage page = CDebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); - IViewPart newView = page.showView(IDebugUIConstants.ID_MEMORY_VIEW, null, IWorkbenchPage.VIEW_ACTIVATE); - IMemoryRenderingSite memSite = (IMemoryRenderingSite) newView; - new AddMemoryBlocks().addMemoryBlocksForVariables(variables, memSite); - } catch (ClassCastException e) { - CDebugUIPlugin.log(e); - } catch (PartInitException e) { - CDebugUIPlugin.log(e); - } catch (DebugException e) { - CDebugUIPlugin.log(e); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/CDIDisassemblyRetrieval.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/CDIDisassemblyRetrieval.java deleted file mode 100644 index fbe0a8608a8..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/CDIDisassemblyRetrieval.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2015 Wind River Systems, 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: - * Anton Leherbauer (Wind River Systems) - initial API and implementation - * Freescale Semiconductor - refactoring - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.disassembly.dsf; - -import java.math.BigInteger; - -import org.eclipse.cdt.core.IAddress; -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.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; -import org.eclipse.cdt.debug.internal.core.model.DisassemblyBlock; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.swt.widgets.Display; - - -/** - */ -public class CDIDisassemblyRetrieval implements IDisassemblyRetrieval { - - private ICDebugTarget fDebugTarget; - - /** - * Constructor - */ - public CDIDisassemblyRetrieval(ICDebugTarget debugTarget) { - fDebugTarget= debugTarget; - } - - /* - * @see org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval#asyncGetDisassembly(java.math.BigInteger, java.math.BigInteger, java.lang.String, int, org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval.DisassemblyRequest) - */ - @Override - public void asyncGetDisassembly(final BigInteger startAddress, final BigInteger endAddress, final String file, final int lineNumber, final int lines, final boolean mixed, final DisassemblyRequest disassemblyRequest) { - Runnable op= new Runnable() { - @Override - public void run() { - ICDITarget cdiTarget= fDebugTarget.getAdapter(ICDITarget.class); - try { - ICDIMixedInstruction[] mixedInstructions= null; - ICDIInstruction[] asmInstructions= null; - if (file != null) { - if (mixed) { - mixedInstructions= cdiTarget.getMixedInstructions(file, lineNumber, lines); - } else { - asmInstructions= cdiTarget.getInstructions(file, lineNumber, lines); - } - } - else if (startAddress != null) { - if (mixed) { - mixedInstructions= cdiTarget.getMixedInstructions(startAddress, endAddress); - } - if (mixedInstructions == null || mixedInstructions.length == 0) { - mixedInstructions= null; - asmInstructions= cdiTarget.getInstructions(startAddress, endAddress); - } else if (mixedInstructions.length == 1 && mixedInstructions[0].getInstructions().length == 0) { - mixedInstructions= null; - asmInstructions= cdiTarget.getInstructions(startAddress, endAddress); - } - } - if (mixedInstructions != null) { - IDisassemblyBlock block= DisassemblyBlock.create(fDebugTarget.getDisassembly(), mixedInstructions); - disassemblyRequest.setDisassemblyBlock(block); - } else if (asmInstructions != null) { - IDisassemblyBlock block= DisassemblyBlock.create(fDebugTarget.getDisassembly(), asmInstructions); - disassemblyRequest.setDisassemblyBlock(block); - } - } catch (CDIException exc) { - disassemblyRequest.setStatus(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), exc.getDetailMessage(), exc)); - } catch (DebugException exc) { - disassemblyRequest.setStatus(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), exc.getMessage(), exc)); - } finally { - disassemblyRequest.done(); - } - - } - }; - Display.getDefault().asyncExec(op); - } - - /* - * @see org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval#asyncGetFrameAddress(org.eclipse.debug.core.model.IStackFrame, org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval.AddressRequest) - */ - @Override - public void asyncGetFrameAddress(final IStackFrame stackFrame, final AddressRequest addressRequest) { - Runnable op= new Runnable() { - @Override - public void run() { - if (stackFrame instanceof ICStackFrame) { - IAddress address = ((ICStackFrame)stackFrame).getAddress(); - if (address != null ) { - addressRequest.setAddress(address.getValue()); - } else { - addressRequest.setStatus(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), "Internal error: Cannot retrieve frame address")); //$NON-NLS-1$ - } - } else { - addressRequest.cancel(); - } - addressRequest.done(); - } - }; - Display.getDefault().asyncExec(op); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java deleted file mode 100644 index 1ffc3e62486..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java +++ /dev/null @@ -1,709 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Wind River Systems, 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: - * Wind River Systems - initial API and implementation - * Freescale Semiconductor - refactoring - * Patrick Chuong (Texas Instruments) - Bug fix (329682) - * Patrick Chuong (Texas Instruments) - Bug fix (304108) - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.disassembly.dsf; - -import java.math.BigInteger; - -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; -import org.eclipse.cdt.debug.core.model.IAsmInstruction; -import org.eclipse.cdt.debug.core.model.IAsmSourceLine; -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.cdt.debug.core.model.ICType; -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; -import org.eclipse.cdt.debug.internal.core.CRequest; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.CExpression; -import org.eclipse.cdt.debug.internal.core.model.CStackFrame; -import org.eclipse.cdt.debug.internal.ui.CDebugUIMessages; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; -import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.Position; - -import com.ibm.icu.text.MessageFormat; - -/** - * The CDI backend to the DSF disassembly view. - * - */ -public class DisassemblyBackendCdi extends AbstractDisassemblyBackend implements IDebugEventSetListener { - - private ICThread fTargetContext; - private String fCdiSessionId; - private ICStackFrame fTargetFrameContext; - private CDIDisassemblyRetrieval fDisassemblyRetrieval; - /* The frame level as the disassembly callback expects it (0 = topmost frame) */ - private int fFrameLevel; - - public DisassemblyBackendCdi() { - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#init(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback) - */ - @Override - public void init(IDisassemblyPartCallback callback) { - super.init(callback); - DebugPlugin.getDefault().addDebugEventListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#hasDebugContext() - */ - @Override - public boolean hasDebugContext() { - return fTargetContext != null; - } - - /** - * Unlike DSF, CDI sessions don't have an ID. But to appease the DSF - * Disassembly view, we fabricate one. - * - * @param debugElement - * the debug element which represents the process being debugged - * @return the session ID - */ - private String getSessionId(ICDebugElement debugElement) { - return "cdi-" + System.identityHashCode(debugElement.getDebugTarget()); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#setDebugContext(org.eclipse.core.runtime.IAdaptable) - */ - @Override - public SetDebugContextResult setDebugContext(IAdaptable context) { - assert supportsDebugContext(context) : "caller should not have invoked us"; //$NON-NLS-1$ - - SetDebugContextResult result = new SetDebugContextResult(); - - ICDebugTarget cdiDebugTarget = (ICDebugTarget)((ICDebugElement)context).getDebugTarget(); - String cdiSessionId = getSessionId(cdiDebugTarget); - - fDisassemblyRetrieval = new CDIDisassemblyRetrieval(cdiDebugTarget); - - if (!cdiSessionId.equals(fCdiSessionId)) { - fTargetContext = null; - fTargetFrameContext = null; - result.contextChanged = true; - - if (context instanceof ICStackFrame) { - fFrameLevel = 0; - fTargetContext = (ICThread)((ICStackFrame)context).getThread(); - try { - // Get the topmost stack frame. Note that the state of the - // thread may have changed by now. It may be running, in - // which case we'll get null here. See bugzilla 317226 - IStackFrame topFrame = fTargetContext.getTopStackFrame(); - if (topFrame != null) { - fTargetFrameContext = (ICStackFrame)context; - - // CDI frame levels are ordered opposite of DSF. Frame 0 is the - // root frame of the thread where in DSF it's the topmost frame - // (where the PC is). Do a little math to flip reverse the value - fFrameLevel = ((CStackFrame)topFrame).getLevel() - fTargetFrameContext.getLevel(); - } - } catch (DebugException e) { - } - } - - if (fTargetContext != null) { - result.sessionId = fCdiSessionId = cdiSessionId; - } - } - else if (context instanceof ICStackFrame) { - result.sessionId = fCdiSessionId; - fTargetFrameContext = null; - fFrameLevel = 0; - ICThread newTargetContext = (ICThread)((ICStackFrame)context).getThread(); - ICThread oldTargetContext = fTargetContext; - fTargetContext = newTargetContext; - if (oldTargetContext == null) { - result.contextChanged = true; - } else if (/*oldTargetContext != null && */newTargetContext != null) { - result.contextChanged = !oldTargetContext.getDebugTarget().equals(newTargetContext.getDebugTarget()); - } - try { - // Get the topmost stack frame. Note that the state of the - // thread may have changed by now. It may be running, in - // which case we'll get null here. See bugzilla 317226 - IStackFrame topFrame = fTargetContext.getTopStackFrame(); - if (topFrame != null) { - fTargetFrameContext = (ICStackFrame)context; - - // CDI frame levels are ordered opposite of DSF. Frame 0 is the - // root frame of the thread where in DSF it's the topmost frame - // (where the PC is). Do a little math to flip reverse the value - fFrameLevel = ((CStackFrame)topFrame).getLevel() - fTargetFrameContext.getLevel(); - } - } catch (DebugException e) { - } - if (!result.contextChanged) { - fCallback.gotoFrame(fFrameLevel); - } - } else { - fTargetContext = null; - fTargetFrameContext = null; - result.contextChanged = true; - } - - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#supportsDebugContext(org.eclipse.core.runtime.IAdaptable) - */ - @Override - public boolean supportsDebugContext(IAdaptable context) { - return supportsDebugContext_(context); - } - - /** - * @param context - * @return - */ - public static boolean supportsDebugContext_(IAdaptable context) { - return (context != null) && (context.getAdapter(ICDebugElement.class) != null); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#clearDebugContext() - */ - @Override - public void clearDebugContext() { - fTargetContext= null; - fCdiSessionId = null; - fTargetFrameContext = null; - fDisassemblyRetrieval = null; - fFrameLevel = 0; - } - - private class AddressRequest extends CRequest implements IDisassemblyRetrieval.AddressRequest { - private BigInteger fAddress; - @Override - public BigInteger getAddress() { return fAddress; } - @Override - public void setAddress(BigInteger address) { fAddress = address; } - }; - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#retrieveFrameAddress(int) - */ - @Override - public void retrieveFrameAddress(final int targetFrame) { - try { - final IStackFrame[] stackFrames= fTargetContext.getStackFrames(); - if (stackFrames.length <= targetFrame) { - fCallback.setUpdatePending(false); - return; - } - IStackFrame stackFrame= stackFrames[targetFrame]; - fDisassemblyRetrieval.asyncGetFrameAddress(stackFrame, new AddressRequest() { - @Override - public void done() { - fCallback.setUpdatePending(false); - if (isSuccess()) { - BigInteger address= getAddress(); - if (targetFrame == 0) { - fCallback.updatePC(address); - } else { - fCallback.gotoFrame(targetFrame, address); - } - } - } - }); - - } catch (DebugException exc) { - DisassemblyUtils.internalError(exc); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#getFrameLevel() - */ - @Override - public int getFrameLevel() { - return fFrameLevel; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#isSuspended() - */ - @Override - public boolean isSuspended() { - return fTargetContext != null && fTargetContext.isSuspended(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#getFrameFile() - */ - @Override - public String getFrameFile() { - return fTargetFrameContext != null ? fTargetFrameContext.getFile() : null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#getFrameLine() - */ - @Override - public int getFrameLine() { - return fTargetFrameContext.getFrameLineNumber(); - } - - private class DisassemblyRequest extends CRequest implements IDisassemblyRetrieval.DisassemblyRequest { - private IDisassemblyBlock fBlock; - @Override - public IDisassemblyBlock getDisassemblyBlock() { return fBlock; } - @Override - public void setDisassemblyBlock(IDisassemblyBlock block) { fBlock = block; } - }; - - /* (non-Javadoc) - * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyBackend#retrieveDisassembly(java.math.BigInteger, java.math.BigInteger, java.lang.String, boolean, boolean, boolean, int, int, int) - */ - @Override - public void retrieveDisassembly(final BigInteger startAddress, - BigInteger endAddress, final String file, int lineNumber, final int lines, final boolean mixed, - final boolean showSymbols, final boolean showDisassembly, final int linesHint) { - - if (fTargetContext == null || fTargetContext.isTerminated()) { - return; - } - final BigInteger addressLength= BigInteger.valueOf(lines * 4); - if (endAddress.subtract(startAddress).compareTo(addressLength) > 0) { - endAddress= startAddress.add(addressLength); - } - // make sure address range is no less than 32 bytes - // this is an attempt to get better a response from the backend (bug 302925) - final BigInteger finalEndAddress= startAddress.add(BigInteger.valueOf(32)).max(endAddress); - final IDisassemblyRetrieval.DisassemblyRequest disassemblyRequest= new DisassemblyRequest() { - @Override - public void done() { - if (isSuccess() && getDisassemblyBlock() != null) { - if (!insertDisassembly(startAddress, finalEndAddress, getDisassemblyBlock(), mixed, showSymbols, showDisassembly)) { - // did not get disassembly data for startAddress - try fallbacks - if (file != null) { - // previous attempt used the file; retry using the address - fCallback.setUpdatePending(true); - retrieveDisassembly(startAddress, finalEndAddress, null, -1, lines, mixed, showSymbols, showDisassembly, linesHint); - } else if (mixed) { - // retry using non-mixed mode - fCallback.setUpdatePending(true); - retrieveDisassembly(startAddress, finalEndAddress, null, -1, lines, false, showSymbols, showDisassembly, linesHint); - } else { - // give up - fCallback.doScrollLocked(new Runnable() { - @Override - public void run() { - fCallback.insertError(startAddress, "Unable to retrieve disassembly data from backend."); //$NON-NLS-1$ - } - }); - } - } - } else { - final IStatus status= getStatus(); - if (status != null && !status.isOK()) { - fCallback.doScrollLocked(new Runnable() { - @Override - public void run() { - fCallback.insertError(startAddress, status.getMessage()); - } - }); - } - fCallback.setUpdatePending(false); - } - } - }; - fDisassemblyRetrieval.asyncGetDisassembly(startAddress, finalEndAddress, file, lineNumber, lines, mixed, disassemblyRequest); - - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#insertSource(org.eclipse.jface.text.Position, java.math.BigInteger, java.lang.String, int) - */ - @Override - public Object insertSource(Position pos, BigInteger address, - String file, int lineNumber) { - ISourceLocator locator = fTargetContext.getLaunch().getSourceLocator(); - if (locator instanceof ISourceLookupDirector) { - return ((ISourceLookupDirector)locator).getSourceElement(file); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#hasFrameContext() - */ - @Override - public boolean hasFrameContext() { - return fTargetFrameContext != null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyBackend#gotoSymbol(java.lang.String) - */ - @Override - public void gotoSymbol(String symbol) { - final BigInteger address = evaluateAddressExpression(symbol, false); - if (address != null) { - fCallback.asyncExec(new Runnable() { - @Override - public void run() { - fCallback.gotoAddress(address); - }}); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#evaluateSymbolAddress(java.lang.String, boolean) - */ - @Override - public BigInteger evaluateAddressExpression(String symbol, final boolean suppressError) { - if (fTargetFrameContext != null) { - try { - // This logic was lifted from CMemoryBlockRetrievalExtension.getExtendedMemoryBlock(String, Object) - CStackFrame cstackFrame = (CStackFrame)fTargetFrameContext; - ICDIExpression cdiExpression = cstackFrame.getCDITarget().createExpression(symbol); - CExpression cdtExpression = new CExpression(cstackFrame, cdiExpression, null); - IValue value = cdtExpression.getValue(); - if (value instanceof ICValue) { - ICType type = ((ICValue)value).getType(); - if (type != null) { - // get the address for the expression, allow all types - String rawExpr = cdtExpression.getExpressionString(); - String voidExpr = "(void *)(" + rawExpr + ')'; //$NON-NLS-1$ - String attempts[] = { rawExpr, voidExpr }; - for (int i = 0; i < attempts.length; i++) { - String expr = attempts[i]; - String addressStr = cstackFrame.evaluateExpressionToString(expr); - if (addressStr != null) { - try { - return (addressStr.startsWith("0x")) ? new BigInteger(addressStr.substring(2), 16) : new BigInteger(addressStr); //$NON-NLS-1$ - - } catch (NumberFormatException e) { - if (i >= attempts.length) { - throw new DebugException(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, - MessageFormat.format(CDebugUIMessages.getString("DisassemblyBackendCdi_Symbol_Evaluation_Unusable"), new String[]{symbol}))); //$NON-NLS-1$ - } - } - } - } - } - } - else { - throw new DebugException(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, - MessageFormat.format(CDebugUIMessages.getString("DisassemblyBackendCdi_Symbol_Didnt_Evaluate"), new String[]{symbol}))); //$NON-NLS-1$ - } - } - catch (final CDIException exc) { - if (!suppressError) { - fCallback.asyncExec(new Runnable() { - @Override - public void run() { - ErrorDialog.openError(fCallback.getSite().getShell(), - CDebugUIMessages.getString("DisassemblyBackendCdi_Error_Dlg_Title"), //$NON-NLS-1$ - null, new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, exc.getLocalizedMessage())); - }}); - } - } - catch (final DebugException exc) { - if (!suppressError) { - fCallback.asyncExec(new Runnable() { - @Override - public void run() { - ErrorDialog.openError(fCallback.getSite().getShell(), - CDebugUIMessages.getString("DisassemblyBackendCdi_Error_Dlg_Title"), //$NON-NLS-1$ - null, exc.getStatus()); - }}); - } - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyBackend#retrieveDisassembly(java.lang.String, int, java.math.BigInteger, boolean, boolean, boolean) - */ - @Override - public void retrieveDisassembly(String file, int lines, - final BigInteger endAddress, final boolean mixed, final boolean showSymbols, - final boolean showDisassembly) { - final IDisassemblyRetrieval.DisassemblyRequest disassemblyRequest= new DisassemblyRequest() { - @Override - public void done() { - if (isSuccess() && getDisassemblyBlock() != null) { - insertDisassembly(null, endAddress, getDisassemblyBlock(), mixed, showSymbols, showDisassembly); - } else { - final IStatus status= getStatus(); - if (status != null && !status.isOK()) { - fCallback.asyncExec(new Runnable() { - @Override - public void run() { - ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$ - } - }); - } - fCallback.setUpdatePending(false); - } - } - }; - - assert !fCallback.getUpdatePending(); - fCallback.setUpdatePending(true); - fDisassemblyRetrieval.asyncGetDisassembly(null, endAddress, file, 1, lines, mixed, disassemblyRequest); - } - - /** - * @param startAddress - * an address the caller is hoping will be covered by this - * insertion. I.e., [disassemblyBlock] may or may not contain - * that address; the caller wants to know if it does, and so we - * indicate that via our return value. Can be null to indicate n/a, - * in which case we return true as long as any instruction was inserted - * @param endAddress - * cut-off address. Any elements in [disassemblyBlock] that - * extend beyond this address are ignored. - * @param disassemblyBlock - * @param mixed - * @param showSymbols - * @param showDisassembly - * @return whether [startAddress] was inserted - */ - private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IDisassemblyBlock disassemblyBlock, boolean mixed, boolean showSymbols, boolean showDisassembly) { - if (!fCallback.hasViewer() || fCdiSessionId == null) { - // return true to avoid a retry - return true; - } - - if (!fCallback.getUpdatePending()) { - // safe-guard in case something weird is going on - assert false; - // return true to avoid a retry - return true; - } - - // indicates whether [startAddress] was inserted - boolean insertedStartAddress = startAddress == null; - - try { - fCallback.lockScroller(); - - final IDisassemblyDocument document = fCallback.getDocument(); // for convenience - IAsmSourceLine[] srcLines= disassemblyBlock.getSourceLines(); - AddressRangePosition p = null; - Object srcElement= disassemblyBlock.getSourceElement(); - for (int i = 0; i < srcLines.length; i++) { - IAsmSourceLine srcLine= srcLines[i]; - - // If the caller doesn't want mixed, set line number to -1 so we - // create a pure disassembly position object - int lineNumber= mixed ? srcLine.getLineNumber() - 1 : -1; - - IAsmInstruction[] instructions= srcLine.getInstructions(); - for (int j = 0; j < instructions.length; j++) { - IAsmInstruction instruction = instructions[j]; - BigInteger address= instruction.getAdress().getValue(); - if (startAddress == null) { - startAddress = address; - fCallback.setGotoAddressPending(address); - } - if (p == null || !p.containsAddress(address)) { - p = fCallback.getPositionOfAddress(address); - } - if (p instanceof ErrorPosition && p.fValid) { - p.fValid = false; - document.addInvalidAddressRange(p); - } else if (p == null || address.compareTo(endAddress) > 0) { - return insertedStartAddress; - } else if (p.fValid) { - if (srcElement != null && lineNumber >= 0 || p.fAddressLength == BigInteger.ONE) { - // override probably unaligned disassembly - p.fValid = false; - document.addInvalidAddressRange(p); - } else { - return insertedStartAddress; - } - } - boolean hasSource= false; - String compilationPath= null; - if (srcElement != null && lineNumber >= 0) { - if (srcElement instanceof LocalFileStorage) { - compilationPath = ((LocalFileStorage)srcElement).getFullPath().toString(); - } - else if (srcElement instanceof IFile) { - compilationPath = ((IFile)srcElement).getLocation().toString(); - } - else if (srcElement instanceof java.io.File) { - compilationPath = ((java.io.File)srcElement).getAbsolutePath(); - } - else if (srcElement instanceof ITranslationUnit) { - IPath location = ((ITranslationUnit) srcElement).getLocation(); - if (location != null) { - compilationPath = location.toString(); - } - } - else { - assert false : "missing support for source element of type " + srcElement.getClass().toString(); //$NON-NLS-1$ - } - if (compilationPath != null) { - p = fCallback.insertSource(p, address, compilationPath, lineNumber); - hasSource = fCallback.getStorageForFile(compilationPath) != null; - } - else { - hasSource = false; - } - } - // insert symbol label - final String functionName= instruction.getFunctionName(); - if (functionName != null && functionName.length() > 0 && instruction.getOffset() == 0) { - p = document.insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly)); - } - // determine instruction byte length - BigInteger instrLength= null; - if (j < instructions.length - 1) { - instrLength= instructions[j+1].getAdress().distanceTo(instruction.getAdress()).abs(); - } else if (i < srcLines.length - 1) { - int nextSrcLineIdx= i+1; - while (nextSrcLineIdx < srcLines.length) { - IAsmInstruction[] nextInstrs= srcLines[nextSrcLineIdx].getInstructions(); - if (nextInstrs.length > 0) { - instrLength= nextInstrs[0].getAdress().distanceTo(instruction.getAdress()).abs(); - break; - } - ++nextSrcLineIdx; - } - if (nextSrcLineIdx >= srcLines.length) { - break; - } - } else { -// if (instructions.length == 1) { -// if (p.fAddressLength.compareTo(BigInteger.valueOf(8)) <= 0) { -// instrLength= p.fAddressLength; -// } -// } - } - if (instrLength == null) { - // cannot determine length of last instruction - break; - } - final String opCode; - // insert function name+offset instead of opcode bytes - if (functionName != null && functionName.length() > 0) { - opCode= functionName + '+' + instruction.getOffset(); - } else { - opCode= ""; //$NON-NLS-1$ - } - if (!showDisassembly && hasSource) { - p = document.insertDisassemblyLine(p, address, instrLength.intValue(), opCode, "", compilationPath, lineNumber); //$NON-NLS-1$ - } else { - p = document.insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstructionText(), compilationPath, lineNumber); //$NON-NLS-1 - } - insertedStartAddress= insertedStartAddress || address.compareTo(startAddress) == 0; - if (p == null && insertedStartAddress) { - break; - } - } - } - - - } catch (BadLocationException e) { - // should not happen - DisassemblyUtils.internalError(e); - } finally { - fCallback.setUpdatePending(false); - if (insertedStartAddress) { - fCallback.updateInvalidSource(); - fCallback.unlockScroller(); - fCallback.doPending(); - fCallback.updateVisibleArea(); - } else { - fCallback.unlockScroller(); - } - } - return insertedStartAddress; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) - */ - @Override - public void handleDebugEvents(DebugEvent[] events) { - for (DebugEvent event : events) { - if (event.getKind() == DebugEvent.TERMINATE) { - Object eventSource = event.getSource(); - if ((eventSource instanceof CDebugTarget) && (getSessionId((CDebugTarget)eventSource).equals(fCdiSessionId))) { - fCallback.handleTargetEnded(); - return; - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#dispose() - */ - @Override - public void dispose() { - DebugPlugin.getDefault().removeDebugEventListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#evaluateExpression(java.lang.String) - */ - @Override - public String evaluateExpression(String expression) { - // This is called to service text hovering. We either resolve the - // expression or we don't. No error reporting needed. - if (fTargetFrameContext != null) { - try { - // This logic was lifted from CMemoryBlockRetrievalExtension.getExtendedMemoryBlock(String, Object) - CStackFrame cstackFrame = (CStackFrame)fTargetFrameContext; - ICDIExpression cdiExpression = cstackFrame.getCDITarget().createExpression(expression); - CExpression cdtExpression = new CExpression(cstackFrame, cdiExpression, null); - IValue value = cdtExpression.getValue(); - if (value instanceof ICValue) { - ICType type = ((ICValue)value).getType(); - if (type != null) { - return cstackFrame.evaluateExpressionToString(cdtExpression.getExpressionString()); - } - } - } - catch (Exception exc) { - - } - } - return ""; //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdiFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdiFactory.java deleted file mode 100644 index b4c5e4cf2d3..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdiFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Freescale Semiconductor, 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: - * Freescale Semiconductor - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.disassembly.dsf; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IAdapterFactory; - -public class DisassemblyBackendCdiFactory implements IAdapterFactory { - - private static final Class<?>[] ADAPTERS = { IDisassemblyBackend.class }; - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (IDisassemblyBackend.class.equals(adapterType)) { - if (adaptableObject instanceof IAdaptable && DisassemblyBackendCdi.supportsDebugContext_((IAdaptable)adaptableObject)) { - return new DisassemblyBackendCdi(); - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { - return ADAPTERS; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java deleted file mode 100644 index 957e6416e1d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java +++ /dev/null @@ -1,379 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2015 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.disassembly.editor; - -import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider; -import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerAction; -import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualSourceViewer; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.actions.ToggleBreakpointAction; -import org.eclipse.debug.ui.contexts.DebugContextEvent; -import org.eclipse.debug.ui.contexts.IDebugContextListener; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.jface.text.source.IVerticalRuler; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IReusableEditor; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.EditorPart; -import org.eclipse.ui.texteditor.IDocumentProvider; -import org.eclipse.ui.texteditor.ITextEditor; - -public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusableEditor, IDebugContextListener, IPropertyChangeListener { - - private DisassemblyPane fDisassemblyPane; - - public DisassemblyEditor() { - super(); - fDisassemblyPane = new DisassemblyPane( "#DisassemblyEditorContext", "#DisassemblyEditorRulerContext" ); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public void doSave( IProgressMonitor monitor ) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#doSaveAs() - */ - @Override - public void doSaveAs() { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) - */ - @Override - public void init( IEditorSite site, IEditorInput input ) throws PartInitException { - setSite( site ); - setInput( input ); - ((DisassemblyDocumentProvider)getDocumentProvider()). - getDocumentPresentation( input ). - addPropertyChangeListener( this ); - DebugUITools.getDebugContextManager().addDebugContextListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#isDirty() - */ - @Override - public boolean isDirty() { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() - */ - @Override - public boolean isSaveAsAllowed() { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - @Override - public void createPartControl( Composite parent ) { - fDisassemblyPane.create( parent ); - createActions(); - - // register the context menu such that other plugins may contribute to it - if ( getSite() != null ) { - getSite().registerContextMenu( fDisassemblyPane.getViewContextMenuId(), fDisassemblyPane.getTextMenuManager(), getViewer() ); - } - - if ( getSite() != null ) { - getSite().registerContextMenu( fDisassemblyPane.getRulerContextMenuId(), fDisassemblyPane.getTextMenuManager(), getViewer() ); - } - - VirtualSourceViewer viewer = fDisassemblyPane.getViewer(); - IEditorInput input = getEditorInput(); - if ( input instanceof DisassemblyEditorInput ) { - Object debugContext = ((DisassemblyEditorInput)input).getDebugContext(); - VirtualDocument document = (VirtualDocument)getDocumentProvider().getDocument( input ); - IAnnotationModel annotationModel = getDocumentProvider().getAnnotationModel( input ); - viewer.setDocument( document, annotationModel ); - ((VirtualDocument)viewer.getDocument()).getContentProvider().changeInput( viewer, document.getPresentationContext(), null, debugContext, document.getCurrentOffset() ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.WorkbenchPart#setFocus() - */ - @Override - public void setFocus() { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.WorkbenchPart#dispose() - */ - @Override - public void dispose() { - DebugUITools.getDebugContextManager().removeDebugContextListener( this ); - ((DisassemblyDocumentProvider)getDocumentProvider()). - getDocumentPresentation( getEditorInput() ). - removePropertyChangeListener( this ); - getDocumentProvider().disconnect( getEditorInput() ); - fDisassemblyPane.dispose(); - super.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput) - */ - @Override - public final void setInput( IEditorInput input ) { - super.setInput( input ); - Object debugContext = ((DisassemblyEditorInput)input).getDebugContext(); - try { - getDocumentProvider().connect( input ); - } - catch( CoreException e ) { - // shouldn't happen - } - VirtualDocument document = (VirtualDocument)getDocumentProvider().getDocument( input ); - VirtualSourceViewer viewer = getViewer(); - if ( document != null && viewer != null ) { - DocumentContentProvider contentProvider = document.getContentProvider(); - Object oldInput = contentProvider.getInput(); - contentProvider.changeInput( getViewer(), document.getPresentationContext(), oldInput, debugContext, document.getCurrentOffset() ); -// getViewer().refresh( false, true ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent) - */ - @Override - public void debugContextChanged( DebugContextEvent event ) { - ISelection selection = event.getContext(); - if ( selection instanceof IStructuredSelection ) { - IStructuredSelection ss = (IStructuredSelection)selection; - Object context = ss.getFirstElement(); - if ( context != null ) { - IDisassemblyContextProvider contextProvider = getDisassemblyContextProvider( context ); - if ( contextProvider != null ) { - Object disassemblyContext = contextProvider.getDisassemblyContext( context ); - if ( disassemblyContext != null ) { - DisassemblyEditorInput oldInput = (DisassemblyEditorInput)getEditorInput(); - if ( oldInput.getDisassemblyContext().equals( disassemblyContext ) ) { - setInput( new DisassemblyEditorInput( context, disassemblyContext ) ); - } - } - } - } - } - } - - private IDisassemblyContextProvider getDisassemblyContextProvider( Object element ) { - IDisassemblyContextProvider adapter = null; - if ( element instanceof IDisassemblyContextProvider ) { - adapter = (IDisassemblyContextProvider)element; - } - else if ( element instanceof IAdaptable ) { - IAdaptable adaptable = (IAdaptable)element; - adapter = adaptable.getAdapter( IDisassemblyContextProvider.class ); - } - return adapter; - } - - private VirtualSourceViewer getViewer() { - return fDisassemblyPane.getViewer(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#close(boolean) - */ - @Override - public void close( boolean save ) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#doRevertToSaved() - */ - @Override - public void doRevertToSaved() { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#getAction(java.lang.String) - */ - @Override - public IAction getAction( String actionId ) { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#getDocumentProvider() - */ - @Override - public IDocumentProvider getDocumentProvider() { - return CDebugUIPlugin.getDefault().getDisassemblyEditorManager().getDocumentProvider(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#getHighlightRange() - */ - @Override - public IRegion getHighlightRange() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#getSelectionProvider() - */ - @Override - public ISelectionProvider getSelectionProvider() { - VirtualSourceViewer viewer = getViewer(); - return ( viewer != null ) ? viewer.getSelectionProvider() : null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#isEditable() - */ - @Override - public boolean isEditable() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#removeActionActivationCode(java.lang.String) - */ - @Override - public void removeActionActivationCode( String actionId ) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#resetHighlightRange() - */ - @Override - public void resetHighlightRange() { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#selectAndReveal(int, int) - */ - @Override - public void selectAndReveal( int offset, int length ) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#setAction(java.lang.String, org.eclipse.jface.action.IAction) - */ - @Override - public void setAction( String actionID, IAction action ) { - fDisassemblyPane.setAction( actionID, action ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#setActionActivationCode(java.lang.String, char, int, int) - */ - @Override - public void setActionActivationCode( String actionId, char activationCharacter, int activationKeyCode, int activationStateMask ) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#setHighlightRange(int, int, boolean) - */ - @Override - public void setHighlightRange( int offset, int length, boolean moveCursor ) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#showHighlightRangeOnly(boolean) - */ - @Override - public void showHighlightRangeOnly( boolean showHighlightRangeOnly ) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.ITextEditor#showsHighlightRangeOnly() - */ - @Override - public boolean showsHighlightRangeOnly() { - // TODO Auto-generated method stub - return false; - } - - protected void createActions() { - IVerticalRuler ruler = fDisassemblyPane.getVerticalRuler(); - IAction action= new ToggleBreakpointAction( this, null, ruler ); - setAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT, action ); - action= new EnableDisableBreakpointRulerAction( this, ruler ); - setAction( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT, action ); - action= new CBreakpointPropertiesRulerAction( this, ruler ); - setAction( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES, action ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - @Override - public void propertyChange( PropertyChangeEvent event ) { - getViewer().refresh(); - } - - @Override - public Object getAdapter(Class adapter) { - if (IDocument.class.equals(adapter)) { - return getDocumentProvider().getDocument(getEditorInput()); - } - return super.getAdapter(adapter); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java deleted file mode 100644 index 7a7c99325b1..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java +++ /dev/null @@ -1,215 +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.internal.ui.disassembly.rendering; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.core.resources.IMarker; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.AnnotationModel; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.texteditor.MarkerAnnotation; - -/** - * Annotation model for Disassembly view. - */ -public class DisassemblyAnnotationModel extends AnnotationModel { - - private DisassemblyEditorInput fInput; - -// private IDocument fDisassemblyDocument; - - /** - * Constructor for DisassemblyAnnotationModel. - */ - public DisassemblyAnnotationModel() { - super(); - } - - protected void breakpointsAdded( final IBreakpoint[] breakpoints, final IDocument document ) { - DisassemblyEditorInput input = getInput(); - if ( DisassemblyEditorInput.EMPTY_EDITOR_INPUT.equals( input ) || - DisassemblyEditorInput.PENDING_EDITOR_INPUT.equals( input ) ) - return; - asyncExec( new Runnable() { - @Override - public void run() { - breakpointsAdded0( breakpoints, document ); - } - } ); - } - - protected void breakpointsRemoved( final IBreakpoint[] breakpoints, final IDocument document ) { - DisassemblyEditorInput input = getInput(); - if ( DisassemblyEditorInput.EMPTY_EDITOR_INPUT.equals( input ) || - DisassemblyEditorInput.PENDING_EDITOR_INPUT.equals( input ) ) - return; - asyncExec( new Runnable() { - @Override - public void run() { - breakpointsRemoved0( breakpoints, document ); - } - } ); - } - - protected void breakpointsChanged( final IBreakpoint[] breakpoints, final IDocument document ) { - DisassemblyEditorInput input = getInput(); - if ( DisassemblyEditorInput.EMPTY_EDITOR_INPUT.equals( input ) || - DisassemblyEditorInput.PENDING_EDITOR_INPUT.equals( input ) ) - return; - asyncExec( new Runnable() { - @Override - public void run() { - breakpointsChanged0( breakpoints, document ); - } - } ); - } - - protected void breakpointsAdded0( IBreakpoint[] breakpoints, IDocument document ) { - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( breakpoints[i] instanceof ICLineBreakpoint && isApplicable( breakpoints[i] ) ) { - addBreakpointAnnotation( (ICLineBreakpoint)breakpoints[i], document ); - } - } - fireModelChanged(); - } - - protected void breakpointsRemoved0( IBreakpoint[] breakpoints, IDocument document ) { - removeAnnotations( findAnnotationsforBreakpoints( breakpoints ), true, false ); - } - - protected void breakpointsChanged0( IBreakpoint[] breakpoints, IDocument document ) { - List annotations = findAnnotationsforBreakpoints( breakpoints ); - List markers = new ArrayList( annotations.size() ); - Iterator it = annotations.iterator(); - while( it.hasNext() ) { - MarkerAnnotation ma = (MarkerAnnotation)it.next(); - markers.add( ma.getMarker() ); - modifyAnnotationPosition( ma, getPosition( ma ), false ); - } - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( breakpoints[i] instanceof ICLineBreakpoint && !markers.contains( breakpoints[i].getMarker() ) ) { - addBreakpointAnnotation( (ICLineBreakpoint)breakpoints[i], document ); - } - } - fireModelChanged(); - } - - protected DisassemblyEditorInput getInput() { - return this.fInput; - } - - protected void setInput( DisassemblyEditorInput input, IDocument document ) { - DisassemblyEditorInput oldInput = this.fInput; - this.fInput = input; - if ( this.fInput != null && !this.fInput.equals( oldInput ) ) - updateAnnotations( document ); - } - - private boolean isApplicable( IBreakpoint breakpoint ) { - return true; - } - - private void addBreakpointAnnotation( ICLineBreakpoint breakpoint, IDocument document ) { - Position position = createBreakpointPosition( breakpoint, document ); - if ( position != null ) { - try { - addAnnotation( createMarkerAnnotation( breakpoint ), position, false ); - } - catch( BadLocationException e ) { - } - } - } - - private Position createBreakpointPosition( ICLineBreakpoint breakpoint, IDocument document ) { - Position position = null; - DisassemblyEditorInput input = getInput(); - if ( input != null ) { - int start = -1; - if ( document != null ) { - int instrNumber = input.getInstructionLine( breakpoint ); - if ( instrNumber > 0 ) { - try { - start = fDocument.getLineOffset( instrNumber - 1 ); - if ( start > -1 ) { - // Avoid the document boundaries; see bugzilla 178485 - int lineLen = document.getLineLength(instrNumber - 1); - if (start == 0) { - start++; - lineLen--; - } - if (start + lineLen == document.getLength()) { - lineLen--; - } - return new Position( start, lineLen ); - } - } - catch( BadLocationException e ) { - } - } - } - } - return position; - } - - private MarkerAnnotation createMarkerAnnotation( IBreakpoint breakpoint ) { - return new MarkerAnnotation( breakpoint.getMarker() ); - } - - protected void dispose() { - } - - private List findAnnotationsforBreakpoints( IBreakpoint[] breakpoints ) { - List annotations = new LinkedList(); - Iterator it = getAnnotationIterator(); - while ( it.hasNext() ) { - Annotation ann = (Annotation)it.next(); - if ( ann instanceof MarkerAnnotation ) { - IMarker marker = ((MarkerAnnotation)ann).getMarker(); - if ( marker != null ) { - for ( int i = 0; i < breakpoints.length; ++i ) { - if ( marker.equals( breakpoints[i].getMarker() ) ) { - annotations.add( ann ); - } - } - } - } - } - return annotations; - } - - private void asyncExec( Runnable r ) { - Display display = Display.getDefault(); - if ( display != null ) - display.asyncExec( r ); - } - - private void updateAnnotations( final IDocument document ) { - asyncExec( new Runnable() { - @Override - public void run() { - doUpdateAnnotations( document ); - } - } ); - } - - protected void doUpdateAnnotations( IDocument document ) { - breakpointsAdded0( DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(), document ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java deleted file mode 100644 index 7203b04cc7a..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java +++ /dev/null @@ -1,366 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; - -import java.util.Arrays; -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.model.IAsmInstruction; -import org.eclipse.cdt.debug.core.model.IAsmSourceLine; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Region; -import org.eclipse.core.runtime.Assert; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IPersistableElement; - -/** - * Editor input associated with a debug element. - */ -public class DisassemblyEditorInput implements IEditorInput { - - public static final IEditorInput EMPTY_EDITOR_INPUT = new DisassemblyEditorInput(); - - public static final IEditorInput PENDING_EDITOR_INPUT = - new DisassemblyEditorInput() { - @Override - public String getContents() { - return DisassemblyMessages.getString( "DisassemblyDocumentProvider.Pending_1" ); //$NON-NLS-1$ - } - }; - - /** - * Disassembly block associated with this editor input - */ - private IDisassemblyBlock fBlock; - - private String fContents = ""; //$NON-NLS-1$ - - private IRegion[] fSourceRegions = new IRegion[0]; - - /** - * Constructor for DisassemblyEditorInput. - */ - protected DisassemblyEditorInput() { - } - - /** - * Constructor for DisassemblyEditorInput. - * - * @param disassembly - * @param instructions - */ - private DisassemblyEditorInput( IDisassemblyBlock block) { - fBlock = block; - createContents(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#exists() - */ - @Override - public boolean exists() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getImageDescriptor() - */ - @Override - public ImageDescriptor getImageDescriptor() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getName() - */ - @Override - public String getName() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getPersistable() - */ - @Override - public IPersistableElement getPersistable() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getToolTipText() - */ - @Override - public String getToolTipText() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter( Class adapter ) { - return null; - } - - public boolean contains( ICStackFrame frame ) { - if ( fBlock != null ) { - return fBlock.contains( frame ); - } - return false; - } - - public String getContents() { - return fContents; - } - - public int getInstructionLine( IAddress address ) { - if ( fBlock != null ) { - IAsmSourceLine[] lines = fBlock.getSourceLines(); - int result = 0; - for ( int i = 0; i < lines.length; ++i ) { - IAsmInstruction[] instructions = lines[i].getInstructions(); - if ( fBlock.isMixedMode() ) - ++result; - for ( int j = 0; j < instructions.length; ++j ) { - ++result; - if ( address.equals( instructions[j].getAdress() ) ) { - return result; - } - } - } - } - return -1; - } - - public int getInstructionLine( ICLineBreakpoint breakpoint ) { - if ( fBlock != null ) { - IDisassembly dis = fBlock.getDisassembly(); - if ( dis != null ) { - ICDebugTarget target = dis.getDebugTarget().getAdapter( ICDebugTarget.class ); - if ( target != null ) { - try { - IAddress address = target.getBreakpointAddress( breakpoint ); - if ( address != null && !address.isZero() ) - return getInstructionLine( address ); - } - catch( DebugException e ) { - } - } - } - } - return -1; - } - - public IAddress getAddress( int lineNumber ) { - if ( fBlock != null ) { - IAsmSourceLine[] lines = fBlock.getSourceLines(); - int current = 0; - for ( int i = 0; i < lines.length; ++i ) { - IAsmInstruction[] instructions = lines[i].getInstructions(); - if ( fBlock.isMixedMode() ) { - ++current; - } - if ( lineNumber == current && instructions.length > 0 ) - return instructions[0].getAdress(); - if ( lineNumber > current && lineNumber <= current + instructions.length ) - return instructions[lineNumber - current - 1].getAdress(); - current += instructions.length; - } - } - return null; - } - - public String getModuleFile() { - return ( fBlock != null ) ? fBlock.getModuleFile() : null; - } - - public String getSourceFile() { - if ( fBlock != null ) { - Object element = fBlock.getSourceElement(); - if ( element instanceof IFile ) { - return ((IFile)element).getLocation().toOSString(); - } - else if ( element instanceof IStorage ) { - return ((IStorage)element).getFullPath().toOSString(); - } - } - return null; - } - - public int getSourceLine( int instrNumber ) { - if ( fBlock != null ) { - IAsmSourceLine[] sl = fBlock.getSourceLines(); - int current = 0; - for ( int i = 0; i < sl.length; ++i ) { - ++current; - IAsmInstruction[] ins = sl[i].getInstructions(); - if ( instrNumber >= current && instrNumber <= current + ins.length ) - return sl[i].getLineNumber(); - current += ins.length; - } - } - return -1; - } - - public static DisassemblyEditorInput create( ICStackFrame frame ) throws DebugException { - DisassemblyEditorInput input = null; - ICDebugTarget target = ((ICDebugTarget)frame.getDebugTarget()); - IDisassembly disassembly = target.getDisassembly(); - if ( disassembly != null ) { - IDisassemblyBlock block = disassembly.getDisassemblyBlock( frame ); - input = new DisassemblyEditorInput( block); - } - return input; - } - - public static DisassemblyEditorInput create( IDisassemblyBlock block) throws DebugException { - return new DisassemblyEditorInput(block); - } - private void createContents() { - fSourceRegions = new IRegion[0]; - StringBuffer lines = new StringBuffer(); - int maxFunctionName = 0; - int maxOpcodeLength = 0; - long maxOffset = 0; - if ( fBlock != null ) { - IAsmSourceLine[] mi = fBlock.getSourceLines(); - for ( int j = 0; j < mi.length; ++j ) { - IAsmInstruction[] instructions = mi[j].getInstructions(); - for( int i = 0; i < instructions.length; ++i ) { - String functionName = instructions[i].getFunctionName(); - if ( functionName.length() > maxFunctionName ) { - maxFunctionName = functionName.length(); - } - String opcode = instructions[i].getOpcode(); - if ( opcode.length() > maxOpcodeLength ) - maxOpcodeLength = opcode.length(); - long offset = Math.abs( instructions[i].getOffset() ); - if ( offset > maxOffset ) { - maxOffset = offset; - } - } - } - int instrPos = calculateInstructionPosition( maxFunctionName, maxOffset ); - int argPosition = instrPos + maxOpcodeLength + 1; - if ( fBlock.isMixedMode() ) - fSourceRegions = new IRegion[mi.length]; - for ( int j = 0; j < mi.length; ++j ) { - if ( fBlock.isMixedMode() ) { - String sl = getSourceLineString( mi[j] ); - fSourceRegions[j] = new Region( lines.length(), sl.length() ); - lines.append( sl ); - } - IAsmInstruction[] instructions = mi[j].getInstructions(); - for( int i = 0; i < instructions.length; ++i ) { - lines.append( getInstructionString( instructions[i], instrPos, argPosition ) ); - } - } - } - fContents = lines.toString(); - } - - private String getInstructionString( IAsmInstruction instruction, int instrPosition, int argPosition ) { - int worstCaseSpace = Math.max( instrPosition, argPosition ); - char[] spaces = new char[worstCaseSpace]; - Arrays.fill( spaces, ' ' ); - StringBuffer sb = new StringBuffer(); - if ( instruction != null ) { - sb.append( instruction.getAdress().toHexAddressString() ); - sb.append( ' ' ); - String functionName = instruction.getFunctionName(); - if ( functionName != null && functionName.length() > 0 ) { - sb.append( '<' ); - sb.append( functionName ); - long offset = instruction.getOffset(); - if ( offset != 0 ) { - if ( offset > 0 ) - sb.append( '+' ); - sb.append( instruction.getOffset() ); - } - sb.append( ">:" ); //$NON-NLS-1$ - sb.append( spaces, 0, instrPosition - sb.length() ); - } - sb.append( instruction.getOpcode() ); - sb.append( spaces, 0, argPosition - sb.length() ); - sb.append( instruction.getArguments() ); - sb.append( '\n' ); - } - return sb.toString(); - } - - private int calculateInstructionPosition( int maxFunctionName, long maxOffset ) { - //(Address prefix address representation in chars) + (space) + (<) + (+) + (>) + (:) + (space) - int addressLength = getDisassembly().getAddressFactory().getMax().getCharsNum(); - return ( addressLength + 6 + maxFunctionName + Long.toString( maxOffset ).length() ); - } - - private String getSourceLineString( IAsmSourceLine line ) { - String text = line.toString(); - if ( text == null ) { - text = DisassemblyMessages.getString( "DisassemblyEditorInput.source_line_is_not_available_1" ) + '\n'; //$NON-NLS-1$ - } - return text; - } - - public IRegion[] getSourceRegions() { - return this.fSourceRegions; - } - - protected IDisassembly getDisassembly() { - return ( fBlock != null ) ? fBlock.getDisassembly() : null; - } - - /** - * @return the disassembly block - */ - public IDisassemblyBlock getDisassemblyBlock() { - return fBlock; - } - - public ICLineBreakpoint breakpointExists( IAddress address ) throws CoreException { - Assert.isTrue( address != null ); - IDisassembly dis = getDisassembly(); - if ( dis != null ) { - ICDebugTarget bt = dis.getDebugTarget().getAdapter( ICDebugTarget.class ); - if ( bt != null ) { - String modelId = CDIDebugModel.getPluginIdentifier(); - IBreakpoint[] bps = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints( modelId ); - for ( int i = 0; i < bps.length; ++i ) { - if ( bps[i] instanceof ICLineBreakpoint ) { - ICLineBreakpoint b = (ICLineBreakpoint)bps[i]; - try { - IAddress a = bt.getBreakpointAddress( b ); - if ( a != null && address.compareTo( a ) == 0 ) - return b; - } - catch( NumberFormatException e ) { - } - catch( CoreException e ) { - } - } - } - } - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java deleted file mode 100644 index 1e9f5176c59..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2015 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; - -import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument; -import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualSourceViewer; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.model.IMemoryBlock; -import org.eclipse.debug.ui.memory.AbstractMemoryRendering; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public class DisassemblyMemoryRendering extends AbstractMemoryRendering { - - protected SashForm fSashForm; - protected DisassemblyPane fDisassemblyPane; - - public DisassemblyMemoryRendering( String renderingId ) { - super( renderingId ); - fDisassemblyPane = new DisassemblyPane( "#DisassemblyRenderingContext", "#DisassemblyRenderingRulerContext" ); //$NON-NLS-1$//$NON-NLS-2$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite) - */ - @Override - public Control createControl( Composite parent ) { - Composite composite = new Composite( parent, SWT.BORDER ); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - composite.setLayout( layout ); - composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); - createViewer( composite ); - return composite; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.memory.IMemoryRendering#getControl() - */ - @Override - public Control getControl() { - return fDisassemblyPane.getControl(); - } - - protected VirtualSourceViewer getViewer() { - return fDisassemblyPane.getViewer(); - } - - protected void createViewer( final Composite parent ) { - fSashForm = new SashForm( parent, SWT.VERTICAL ); - fSashForm.setLayoutData( new GridData( GridData.FILL_BOTH ) ); - - fDisassemblyPane.create( fSashForm ); - -// createGoToAddressComposite( fSashForm ); -// hideGotoAddressComposite(); - - IMemoryBlock memoryBlock = getMemoryBlock(); - IDisassemblyContextProvider contextProvider = getDisassemblyContextProvider( memoryBlock ); - Object disassemblyContext = null; - if ( contextProvider != null ) { - disassemblyContext = contextProvider.getDisassemblyContext( memoryBlock ); - } - DisassemblyAnnotationModel annotationModel = new DisassemblyAnnotationModel(); - VirtualDocument document = new VirtualDocument( annotationModel, getDocumentPresentationContext(), disassemblyContext ); - getViewer().setDocument( document ); - document.getContentProvider().changeInput( getViewer(), document.getPresentationContext(), null, getMemoryBlock(), document.getCurrentOffset() ); - } - - private IDocumentPresentation getDocumentPresentationContext() { - return null; - } - - private IDisassemblyContextProvider getDisassemblyContextProvider( Object element ) { - IDisassemblyContextProvider adapter = null; - if ( element instanceof IDisassemblyContextProvider ) { - adapter = (IDisassemblyContextProvider)element; - } - else if ( element instanceof IAdaptable ) { - IAdaptable adaptable = (IAdaptable)element; - adapter = adaptable.getAdapter( IDisassemblyContextProvider.class ); - } - return adapter; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java deleted file mode 100644 index 2f57fa0728f..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.internal.ui.disassembly.rendering; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class DisassemblyMessages { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyMessages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); - - private DisassemblyMessages() { - } - - 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.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties deleted file mode 100644 index e69de29bb2d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties +++ /dev/null diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java deleted file mode 100644 index fb31d63e89f..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.ui.memory.IMemoryRendering; -import org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate; - -public class DisassemblyRenderingTypeDelegate implements IMemoryRenderingTypeDelegate { - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate#createRendering(java.lang.String) - */ - @Override - public IMemoryRendering createRendering( String id ) throws CoreException { - return new DisassemblyMemoryRendering( id ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java deleted file mode 100644 index a1b6e839c10..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java +++ /dev/null @@ -1,191 +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 - * IBM Corporation - * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981 - * Wind River Systems - adapted to work with platform Modules view (bug 210558) - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider; -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.cdt.debug.core.model.IDisassemblyLine; -import org.eclipse.cdt.debug.core.model.IModuleRetrieval; -import org.eclipse.cdt.debug.internal.core.CDisassemblyContextProvider; -import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval; -import org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceDisplayAdapter; -import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider; -import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementAnnotationProvider; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentProvider; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementLabelProvider; -import org.eclipse.cdt.debug.ui.disassembly.IElementToggleBreakpointAdapter; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider; -import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; - -public class CDebugElementAdapterFactory implements IAdapterFactory { - - private static IElementContentProvider fgDebugTargetContentProvider = new CDebugTargetContentProvider(); - private static IElementContentProvider fgThreadContentProvider = new CThreadContentProvider(); - private static IElementContentProvider fgStackFrameContentProvider = new CStackFrameContentProvider(); - private static IElementContentProvider fgModuleContentProvider = new ModuleContentProvider(); - private static IElementContentProvider fgCRegisterManagerContentProvider = new CRegisterManagerContentProvider(); - - private static IModelProxyFactory fgDebugElementProxyFactory = new CDebugElementProxyFactory(); - - private static IElementMementoProvider fgStackFrameMementoProvider = new CStackFrameMementoProvider(); - private static IElementMementoProvider fgModuleMementoProvider = new ModuleMementoProvider(); - - private static IDisassemblyContextProvider fgDisassemblyContextProvider = new CDisassemblyContextProvider(); - private static IDocumentElementContentProvider fgDisassemblyContentProvider = new DisassemblyElementContentProvider(); - private static IDocumentElementLabelProvider fgDisassemblyLabelProvider = new DisassemblyElementLabelProvider(); - private static IElementToggleBreakpointAdapter fgDisassemblyToggleBreakpointAdapter = new DisassemblyToggleBreakpointAdapter(); - private static ISourceDisplay fgSourceDisplayAdapter = new SourceDisplayAdapter(); - - private static IViewerInputProvider fgDefaultViewerInputProvider = new CDefaultViewerInputProvider(); - private static IViewerInputProvider fgStackFrameViewerInputProvider = new CStackFrameViewerInputProvider(); - private static IColumnPresentationFactory fgRegistersViewColumnPresentationFactory = new RegistersViewColumnPresentationFactory(); - private static IColumnPresentationFactory fgDefaultViewColumnPresentationFactory = new DefaultViewColumnPresentationFactory(); - private static IElementMementoProvider fgRegisterManagerProxyMementoProvider = new CRegisterManagerProxyMementoProvider(); - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - @Override - @SuppressWarnings( "rawtypes" ) - public Object getAdapter( Object adaptableObject, Class adapterType ) { - if ( adapterType.isInstance( adaptableObject ) ) { - return adaptableObject; - } - if ( adapterType.equals( IElementContentProvider.class ) ) { - if ( adaptableObject instanceof ICDebugTarget ) { - return fgDebugTargetContentProvider; - } - if ( adaptableObject instanceof ICThread ) { - return fgThreadContentProvider; - } - if ( adaptableObject instanceof ICStackFrame ) { - return fgStackFrameContentProvider; - } - if ( adaptableObject instanceof CRegisterManagerProxy ) { - return fgCRegisterManagerContentProvider; - } - if ( adaptableObject instanceof ICModule || - adaptableObject instanceof ICElement ) { - return fgModuleContentProvider; - } - } - if ( adapterType.equals( IModelProxyFactory.class ) ) { - if ( adaptableObject instanceof ICDebugTarget ) { - return fgDebugElementProxyFactory; - } - if ( adaptableObject instanceof ICThread ) { - return fgDebugElementProxyFactory; - } - if ( adaptableObject instanceof ICStackFrame ) { - return fgDebugElementProxyFactory; - } - if ( adaptableObject instanceof IModuleRetrieval ) { - return fgDebugElementProxyFactory; - } - if ( adaptableObject instanceof DisassemblyRetrieval ) { - return fgDebugElementProxyFactory; - } - if ( adaptableObject instanceof CRegisterManagerProxy ) { - return fgDebugElementProxyFactory; - } - } - if ( adapterType.equals( IElementMementoProvider.class ) ) { - if ( adaptableObject instanceof ICStackFrame ) { - return fgStackFrameMementoProvider; - } - if ( adaptableObject instanceof IModuleRetrieval - || adaptableObject instanceof ICThread - || adaptableObject instanceof ICModule - || adaptableObject instanceof ICElement ) { - return fgModuleMementoProvider; - } - if ( adaptableObject instanceof CRegisterManagerProxy ) { - return fgRegisterManagerProxyMementoProvider; - } - } - if ( adapterType.equals( IDisassemblyContextProvider.class ) ) { - if ( adaptableObject instanceof ICStackFrame ) { - return fgDisassemblyContextProvider; - } - } - if ( adapterType.equals( IDocumentElementContentProvider.class ) ) { - if ( adaptableObject instanceof ICStackFrame ) { - return fgDisassemblyContentProvider; - } - } - if ( adapterType.equals( IDocumentElementLabelProvider.class ) ) { - if ( adaptableObject instanceof IDisassemblyLine ) { - return fgDisassemblyLabelProvider; - } - } - if ( adapterType.equals( IElementToggleBreakpointAdapter.class ) ) { - if ( adaptableObject instanceof IDisassemblyLine ) { - return fgDisassemblyToggleBreakpointAdapter; - } - } - if ( adapterType.equals( ISourceDisplay.class ) ) { - if ( adaptableObject instanceof ICStackFrame ) { - return fgSourceDisplayAdapter; - } - } - if ( adapterType.equals( IViewerInputProvider.class ) ) { - if ( adaptableObject instanceof ICDebugTarget - || adaptableObject instanceof ICThread ) - return fgDefaultViewerInputProvider; - if ( adaptableObject instanceof ICStackFrame ) { - return fgStackFrameViewerInputProvider; - } - } - if ( adapterType.equals( IColumnPresentationFactory.class ) ) { - if ( adaptableObject instanceof CRegisterManagerProxy ) { - return fgRegistersViewColumnPresentationFactory; - } else if (adaptableObject instanceof ICDebugElement) { - return fgDefaultViewColumnPresentationFactory; - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - @Override - @SuppressWarnings( "rawtypes" ) - public Class[] getAdapterList() { - return new Class[] { - IElementContentProvider.class, - IModelProxyFactory.class, - IElementMementoProvider.class, - IDisassemblyContextProvider.class, - IDocumentElementContentProvider.class, - IDocumentElementLabelProvider.class, - IDocumentElementAnnotationProvider.class, - IElementToggleBreakpointAdapter.class, - ISourceDisplay.class, - IViewerInputProvider.class, - }; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementLabelProviderFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementLabelProviderFactory.java deleted file mode 100644 index abcb6f5511c..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementLabelProviderFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.debug.core.model.ICSignal; -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleLabelProvider; -import org.eclipse.cdt.debug.internal.ui.views.signals.SignalLabelProvider; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; - -/** - * Factory for all (non-default) label providers - */ -public class CDebugElementLabelProviderFactory implements IAdapterFactory { - - private static IElementLabelProvider fgModuleLabelProvider = new ModuleLabelProvider(); - private static IElementLabelProvider fgVariableLabelProvider = new CVariableLabelProvider(); - private static IElementLabelProvider fgSignalLabelProvider = new SignalLabelProvider(); - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - @Override - @SuppressWarnings("rawtypes") - public Object getAdapter( Object adaptableObject, Class adapterType ) { - if ( adapterType.equals( IElementLabelProvider.class ) ) { - if ( adaptableObject instanceof ICModule ) { - return fgModuleLabelProvider; - } - if ( adaptableObject instanceof ICElement ) { - return fgModuleLabelProvider; - } - if ( adaptableObject instanceof ICVariable ) { - return fgVariableLabelProvider; - } - if ( adaptableObject instanceof ICSignal ) { - return fgSignalLabelProvider; - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { - return new Class[] { - IElementLabelProvider.class, - }; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementProxyFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementProxyFactory.java deleted file mode 100644 index 4159cfe4396..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementProxyFactory.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * IBM Corporation - * Wind River Systems - adapted to work with platform Modules view (bug 210558) - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.IModuleRetrieval; -import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval; -import org.eclipse.cdt.debug.internal.ui.views.modules.ModulesViewModelProxy; -import org.eclipse.cdt.debug.internal.ui.views.signals.SignalsViewModelProxy; -import org.eclipse.cdt.debug.ui.ICDebugUIConstants; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.update.DefaultModelProxyFactory; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class CDebugElementProxyFactory extends DefaultModelProxyFactory { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.provisional.IModelProxyFactoryAdapter#createModelProxy(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext) - */ - @Override - public IModelProxy createModelProxy( Object element, IPresentationContext context ) { - if ( IDebugUIConstants.ID_MODULE_VIEW.equals( context.getId() ) ) { - IModuleRetrieval mr = null; - if ( element instanceof IAdaptable ) { - ICDebugTarget target = ((IAdaptable)element).getAdapter( ICDebugTarget.class ); - if ( target != null ) - mr = target.getAdapter( IModuleRetrieval.class ); - } - if ( mr != null ) { - return new ModulesViewModelProxy( mr ); - } - } - else if ( IDebugUIConstants.ID_REGISTER_VIEW.equals( context.getId() ) ) { - if ( element instanceof CRegisterManagerProxy ) { - return new CRegisterManagerModelProxy( (CRegisterManagerProxy)element ); - } - } - else if ( ICDebugUIConstants.ID_DEFAULT_DISASSEMBLY_EDITOR.equals( context.getId() ) ) { - if ( element instanceof DisassemblyRetrieval ) { - return new DisassemblyElementProxy( element ); - } - } - else if ( ICDebugUIConstants.ID_SIGNALS_VIEW.equals( context.getId() ) ) { - if ( element instanceof ICDebugTarget ) { - return new SignalsViewModelProxy( element ); - } - } - return super.createModelProxy( element, context ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugTargetContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugTargetContentProvider.java deleted file mode 100644 index b631dd2bf45..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugTargetContentProvider.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider; -import org.eclipse.cdt.debug.internal.ui.views.signals.SignalsContentProvider; -import org.eclipse.cdt.debug.ui.ICDebugUIConstants; -import org.eclipse.debug.internal.ui.model.elements.DebugTargetContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Delegating provider implementation. If the memento request is for the - * modules view, the provider impelementation delegates the request to the - * modules view-specific provider. Otherwise, it calls the default superclass - * implementation. - */ -public class CDebugTargetContentProvider extends DebugTargetContentProvider { - private final ModuleContentProvider fModuleContentProvider = new ModuleContentProvider(); - private final SignalsContentProvider fSignalsContentProvider = new SignalsContentProvider(); - - @Override - public void update(IChildrenCountUpdate[] updates) { - String id = updates[0].getPresentationContext().getId(); - if (IDebugUIConstants.ID_MODULE_VIEW.equals(id)) { - fModuleContentProvider.update(updates); - } else if (ICDebugUIConstants.ID_SIGNALS_VIEW.equals(id)) { - fSignalsContentProvider.update(updates); - } else { - super.update(updates); - } - } - - @Override - public void update(IHasChildrenUpdate[] updates) { - String id = updates[0].getPresentationContext().getId(); - if (IDebugUIConstants.ID_MODULE_VIEW.equals(id)) { - fModuleContentProvider.update(updates); - } else if (ICDebugUIConstants.ID_SIGNALS_VIEW.equals(id)) { - fSignalsContentProvider.update(updates); - } else { - super.update(updates); - } - } - - @Override - public void update(IChildrenUpdate[] updates) { - String id = updates[0].getPresentationContext().getId(); - if (IDebugUIConstants.ID_MODULE_VIEW.equals(id)) { - fModuleContentProvider.update(updates); - } else if (ICDebugUIConstants.ID_SIGNALS_VIEW.equals(id)) { - fSignalsContentProvider.update(updates); - } else { - super.update(updates); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDefaultViewerInputProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDefaultViewerInputProvider.java deleted file mode 100644 index 607565b39a9..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDefaultViewerInputProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.internal.ui.CRegisterManagerProxies; -import org.eclipse.cdt.debug.ui.ICDebugUIConstants; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.internal.ui.elements.adapters.DefaultViewerInputProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class CDefaultViewerInputProvider extends DefaultViewerInputProvider implements IViewerInputProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ViewerInputProvider#getViewerInput(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - @Override - protected Object getViewerInput( Object source, IPresentationContext context, IViewerUpdate update ) throws CoreException { - if ( IDebugUIConstants.ID_REGISTER_VIEW.equals( context.getId() ) && source instanceof ICDebugElement ) { - ICDebugTarget target = (ICDebugTarget)((ICDebugElement)source).getDebugTarget(); - return CRegisterManagerProxies.getInstance().getRegisterManagerProxy( target ); - } - if ( ICDebugUIConstants.ID_SIGNALS_VIEW.equals( context.getId() ) && source instanceof ICDebugElement ) { - ICDebugTarget target = (ICDebugTarget)((ICDebugElement)source).getDebugTarget(); - return target; - } - return super.getViewerInput( source, context, update ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.elements.adapters.DefaultViewerInputProvider#supportsContextId(java.lang.String) - */ - @Override - protected boolean supportsContextId( String id ) { - if ( IDebugUIConstants.ID_REGISTER_VIEW.equals( id ) ) - return true; - if ( ICDebugUIConstants.ID_SIGNALS_VIEW.equals( id ) ) - return true; - return super.supportsContextId( id ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerContentProvider.java deleted file mode 100644 index 4c80af8dcde..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerContentProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class CRegisterManagerContentProvider extends ElementContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - @Override - protected Object[] getChildren( Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor ) throws CoreException { - return getElements( getRegisterGroups( (CRegisterManagerProxy)parent ), index, length ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - @Override - protected int getChildCount( Object element, IPresentationContext context, IViewerUpdate monitor ) throws CoreException { - return getRegisterGroups( (CRegisterManagerProxy)element ).length; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String) - */ - @Override - protected boolean supportsContextId( String id ) { - return IDebugUIConstants.ID_REGISTER_VIEW.equals( id ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#hasChildren(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - @Override - protected boolean hasChildren( Object element, IPresentationContext context, IViewerUpdate monitor ) throws CoreException { - return getRegisterGroups( (CRegisterManagerProxy)element ).length > 0; - } - - private IRegisterGroup[] getRegisterGroups( CRegisterManagerProxy rmp ) { - return rmp.getRegisterGroups(); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerModelProxy.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerModelProxy.java deleted file mode 100644 index 88aaa6cd47b..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerModelProxy.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; -import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; -import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; -import org.eclipse.jface.viewers.Viewer; - -public class CRegisterManagerModelProxy extends AbstractModelProxy { - - private CRegisterManagerProxy fRegisterManagerProxy; - - public CRegisterManagerModelProxy( CRegisterManagerProxy rmp ) { - super(); - fRegisterManagerProxy = rmp; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer) - */ - @Override - public void installed( Viewer viewer ) { - fRegisterManagerProxy.setModelProxy( this ); - super.installed( viewer ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy#dispose() - */ - @Override - public synchronized void dispose() { - fRegisterManagerProxy.setModelProxy( null ); - fRegisterManagerProxy = null; - super.dispose(); - } - - public void update() { - ModelDelta delta = new ModelDelta( fRegisterManagerProxy, IModelDelta.CONTENT ); - fireModelChanged( delta ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerProxy.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerProxy.java deleted file mode 100644 index 637236b738a..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerProxy.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.cdt.debug.internal.core.CRegisterManager; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.model.IRegister; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.eclipse.debug.ui.contexts.DebugContextEvent; -import org.eclipse.debug.ui.contexts.IDebugContextListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; - -/** - * Acts as a viewer input for the Registers view - */ -public class CRegisterManagerProxy implements IDebugEventSetListener, IDebugContextListener { - - private CRegisterManager fRegisterManager; - private ICDebugElement fContext; - private CRegisterManagerModelProxy fModelProxy; - - public CRegisterManagerProxy( CRegisterManager registerManager ) { - super(); - fRegisterManager = registerManager; - } - - public void dispose() { - fRegisterManager = null; - fContext = null; - fModelProxy = null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent) - */ - @Override - public void debugContextChanged( DebugContextEvent event ) { - ICDebugElement context = null; - ISelection s = event.getContext(); - if ( s instanceof IStructuredSelection ) { - IStructuredSelection selection = (IStructuredSelection)s; - context = - ( selection.size() == 1 ) ? - ( selection.getFirstElement() instanceof ICDebugElement ) ? - (ICDebugElement)selection.getFirstElement() : null - : null; - } - setContext( context ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) - */ - @Override - public void handleDebugEvents( DebugEvent[] events ) { - CRegisterManagerModelProxy modelProxy = getModelProxy(); - for( int i = 0; i < events.length; i++ ) { - DebugEvent event = events[i]; - if ( !containsEvent( event ) ) - continue; - Object source = event.getSource(); - if ( source instanceof ICDebugTarget - && (( event.getKind() == DebugEvent.SUSPEND ) - || event.getKind() == DebugEvent.TERMINATE ) ) { - if ( modelProxy != null ) - modelProxy.update(); - } - else if ( source instanceof ICDebugTarget - && (( event.getKind() == DebugEvent.CHANGE ) - && event.getDetail() == DebugEvent.CONTENT ) ) { - if ( modelProxy != null ) - modelProxy.update(); - } - else if ( source instanceof IRegisterGroup - && event.getKind() == DebugEvent.CHANGE ) { - if ( modelProxy != null ) - modelProxy.update(); - } - else if ( source instanceof IRegister - && event.getKind() == DebugEvent.CHANGE ) { - if ( modelProxy != null ) - modelProxy.update(); - } - else if ( source instanceof ICVariable - && event.getKind() == DebugEvent.CHANGE ) { - if ( modelProxy != null ) - modelProxy.update(); - } - else if ( source instanceof ICThread - && event.getKind() == DebugEvent.SUSPEND ) { - if ( modelProxy != null ) - modelProxy.update(); - } - } - } - - public IRegisterGroup[] getRegisterGroups() { - return fRegisterManager.getRegisterGroups(); - } - - public void setModelProxy( CRegisterManagerModelProxy modelProxy ) { - fModelProxy = modelProxy; - } - - public CRegisterManagerModelProxy getModelProxy() { - return fModelProxy; - } - - public String getModelIdentifier() { - return fRegisterManager.getDebugTarget().getModelIdentifier(); - } - - public void setContext( ICDebugElement context ) { - if ( fContext == null || !fContext.equals( context ) ) { - fContext = context; - try { - fRegisterManager.setCurrentFrame( ( fContext instanceof ICStackFrame ) ? (ICStackFrame)context : null ); - } - catch( DebugException e ) { - // TODO: should we pass the error up? - } - CRegisterManagerModelProxy modelProxy = getModelProxy(); - if ( modelProxy != null ) - modelProxy.update(); - } - } - - private boolean containsEvent( DebugEvent event ) { - Object source = event.getSource(); - if ( source instanceof ICDebugElement ) { - return fRegisterManager.getDebugTarget().equals( ((ICDebugElement)source).getDebugTarget() ); - } - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerProxyMementoProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerProxyMementoProvider.java deleted file mode 100644 index e14f096be76..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CRegisterManagerProxyMementoProvider.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.internal.ui.model.elements.DebugElementMementoProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class CRegisterManagerProxyMementoProvider extends DebugElementMementoProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.DebugElementMementoProvider#getElementName(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - @Override - protected String getElementName( Object element, IPresentationContext context ) throws CoreException { - if ( element instanceof CRegisterManagerProxy ) { - if ( IDebugUIConstants.ID_REGISTER_VIEW.equals( context.getId() ) ) { - return ((CRegisterManagerProxy)element).getModelIdentifier(); - } - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameContentProvider.java deleted file mode 100644 index 854f75fcefa..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameContentProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider; -import org.eclipse.debug.internal.ui.model.elements.StackFrameContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Delegating provider implementation. If the memento request is for the - * modules view, the provider impelementation delegates the request to the - * modules view-specific provider. Otherwise, it calls the default superclass - * implementation. - */ -public class CStackFrameContentProvider extends StackFrameContentProvider { - private ModuleContentProvider fModuleContentProvider = new ModuleContentProvider(); - - @Override - public void update(IChildrenCountUpdate[] updates) { - if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleContentProvider.update(updates); - } else { - super.update(updates); - } - } - - @Override - public void update(IHasChildrenUpdate[] updates) { - if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleContentProvider.update(updates); - } else { - super.update(updates); - } - } - - @Override - public void update(IChildrenUpdate[] updates) { - if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleContentProvider.update(updates); - } else { - super.update(updates); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameMementoProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameMementoProvider.java deleted file mode 100644 index 8001b7e5c4d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameMementoProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider; -import org.eclipse.debug.internal.ui.model.elements.StackFrameMementoProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Delegating provider implementation. If the memento request is for the - * modules view, the provider impelementation delegates the request to the - * modules view-specific provider. Otherwise, it calls the default superclass - * implementation. - */ -public class CStackFrameMementoProvider extends StackFrameMementoProvider { - private ModuleMementoProvider fModuleMementoProvider = new ModuleMementoProvider(); - - @Override - public void encodeElements(IElementMementoRequest[] requests) { - if (requests[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleMementoProvider.encodeElements(requests); - } else { - super.encodeElements(requests); - } - } - - - @Override - public void compareElements(IElementCompareRequest[] requests) { - if (requests[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleMementoProvider.compareElements(requests); - } else { - super.compareElements(requests); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameViewerInputProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameViewerInputProvider.java deleted file mode 100644 index 78b194ce452..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameViewerInputProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.internal.ui.CRegisterManagerProxies; -import org.eclipse.cdt.debug.ui.ICDebugUIConstants; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.internal.ui.elements.adapters.StackFrameViewerInputProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class CStackFrameViewerInputProvider extends StackFrameViewerInputProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.elements.adapters.StackFrameViewerInputProvider#getViewerInput(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - @Override - protected Object getViewerInput( Object source, IPresentationContext context, IViewerUpdate update ) throws CoreException { - if ( IDebugUIConstants.ID_REGISTER_VIEW.equals( context.getId() ) && source instanceof ICStackFrame ) { - ICDebugTarget target = (ICDebugTarget)((ICStackFrame)source).getDebugTarget(); - return CRegisterManagerProxies.getInstance().getRegisterManagerProxy( target ); - } - if ( ICDebugUIConstants.ID_SIGNALS_VIEW.equals( context.getId() ) && source instanceof ICDebugElement ) { - ICDebugTarget target = (ICDebugTarget)((ICDebugElement)source).getDebugTarget(); - return target; - } - return super.getViewerInput( source, context, update ); - } - - @Override - protected boolean supportsContextId(String id) { - if ( ICDebugUIConstants.ID_SIGNALS_VIEW.equals( id ) ) - return true; - return super.supportsContextId(id); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CThreadContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CThreadContentProvider.java deleted file mode 100644 index 4cba0755395..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CThreadContentProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider; -import org.eclipse.debug.internal.ui.model.elements.ThreadContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Delegating provider implementation. If the memento request is for the - * modules view, the provider impelementation delegates the request to the - * modules view-specific provider. Otherwise, it calls the default superclass - * implementation. - */ -public class CThreadContentProvider extends ThreadContentProvider { - private ModuleContentProvider fModuleContentProvider = new ModuleContentProvider(); - - @Override - public void update(IChildrenCountUpdate[] updates) { - if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleContentProvider.update(updates); - } else { - super.update(updates); - } - } - - @Override - public void update(IHasChildrenUpdate[] updates) { - if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleContentProvider.update(updates); - } else { - super.update(updates); - } - } - - @Override - public void update(IChildrenUpdate[] updates) { - if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) { - fModuleContentProvider.update(updates); - } else { - super.update(updates); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CVariableLabelProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CVariableLabelProvider.java deleted file mode 100644 index af052b5dc69..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CVariableLabelProvider.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.model.IVariable; -import org.eclipse.debug.internal.ui.elements.adapters.VariableColumnPresentation; -import org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.RGB; - -/** - * Label provider for variables and registers. - * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981 - * - * Using the internal platform classes because the API hasn't been defined. - * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=187500 and - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=187502 - */ -public class CVariableLabelProvider extends DebugElementLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider#getLabel(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - @Override - protected String getLabel( TreePath elementPath, IPresentationContext context, String columnId ) throws CoreException { - if ( columnId != null ) { - IVariable variable = (IVariable)elementPath.getLastSegment(); - IValue value = variable.getValue(); - return getColumnText( variable, value, context, columnId ); - } - return super.getLabel( elementPath, context, columnId ); - } - - protected String getValueText( IVariable variable, IValue value, IPresentationContext context ) throws CoreException { - if ( value instanceof ICValue ) { - return CDebugUIUtils.getValueText( value ); - } - return null; - } - - protected String getVariableTypeName( IVariable variable, IPresentationContext context ) throws CoreException { - if ( variable instanceof ICVariable ) { - return CDebugUIUtils.getVariableTypeName( ((ICVariable)variable).getType() ); - } - return null; - } - - protected String getVariableName( IVariable variable, IPresentationContext context ) throws CoreException { - return CDebugUIUtils.getVariableName( variable ); - } - - protected String getColumnText( IVariable variable, IValue value, IPresentationContext context, String columnId ) throws CoreException { - if ( VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals( columnId ) ) { - return getVariableName( variable, context ); - } - else if ( VariableColumnPresentation.COLUMN_VARIABLE_TYPE.equals( columnId ) ) { - return getVariableTypeName( variable, context ); - } - else if ( VariableColumnPresentation.COLUMN_VARIABLE_VALUE.equals( columnId ) ) { - return getValueText( variable, value, context ); - } - return null; // super.getColumnText( variable, value, context, columnId ); - } - - @Override - protected ImageDescriptor getImageDescriptor( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException { - if ( columnId == null || VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals( columnId ) ) { - return super.getImageDescriptor( elementPath, presentationContext, columnId ); - } - return null; // super.getImageDescriptor( elementPath, presentationContext, columnId ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider#getBackground(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - @Override - protected RGB getBackground( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException { - Object element = elementPath.getLastSegment(); - if ( columnId != null ) { - if ( element instanceof IVariable ) { - IVariable variable = (IVariable)element; - if ( variable.hasValueChanged() ) { - // No public access to the changed value background color of the Variables view. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=187509 - return DebugUITools.getPreferenceColor( IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND ).getRGB(); - } - } - } - return super.getBackground( elementPath, presentationContext, columnId ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider#getFontData(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - @Override - protected FontData getFontData( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException { - // No public access to the Variables view text font id. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=187509 - return JFaceResources.getFontDescriptor( IDebugUIConstants.PREF_VARIABLE_TEXT_FONT ).getFontData()[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider#getForeground(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - @Override - protected RGB getForeground( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException { - Object element = elementPath.getLastSegment(); - if ( columnId == null ) { - if ( element instanceof IVariable ) { - IVariable variable = (IVariable)element; - if ( variable.hasValueChanged() ) { - return DebugUITools.getPreferenceColor( IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR ).getRGB(); - } - } - } - return super.getForeground( elementPath, presentationContext, columnId ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CWatchExpressionFactoryAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CWatchExpressionFactoryAdapter.java deleted file mode 100644 index 753491ade18..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CWatchExpressionFactoryAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 ARM and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IVariable; -import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapterExtension; - -public class CWatchExpressionFactoryAdapter implements IWatchExpressionFactoryAdapterExtension { - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapterExtension#canCreateWatchExpression(org.eclipse.debug.core.model.IVariable) - */ - @Override - public boolean canCreateWatchExpression( IVariable variable ) { - return ( variable instanceof ICVariable ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter#createWatchExpression(org.eclipse.debug.core.model.IVariable) - */ - @Override - public String createWatchExpression( IVariable variable ) throws CoreException { - return ( variable instanceof ICVariable ) ? ((ICVariable)variable).getExpressionString() : null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CWatchExpressionFactoryAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CWatchExpressionFactoryAdapterFactory.java deleted file mode 100644 index 1c143f6608a..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CWatchExpressionFactoryAdapterFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 ARM and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.ICVariable; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter; - -public class CWatchExpressionFactoryAdapterFactory implements IAdapterFactory { - - private static IWatchExpressionFactoryAdapter fgWatchExpressionFactoryAdapter = new CWatchExpressionFactoryAdapter(); - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - @Override - public Object getAdapter( Object adaptableObject, Class adapterType ) { - if ( adapterType.equals( IWatchExpressionFactoryAdapter.class ) ) { - if ( adaptableObject instanceof ICVariable ) { - return fgWatchExpressionFactoryAdapter; - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - @Override - public Class[] getAdapterList() { - return new Class[] { - IWatchExpressionFactoryAdapter.class, - }; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DefaultViewColumnPresentationFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DefaultViewColumnPresentationFactory.java deleted file mode 100644 index 05c9f615a35..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DefaultViewColumnPresentationFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.internal.ui.views.signals.SignalsViewColumnPresentation; -import org.eclipse.cdt.debug.ui.ICDebugUIConstants; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; - -public class DefaultViewColumnPresentationFactory implements IColumnPresentationFactory { - - @Override - public IColumnPresentation createColumnPresentation( IPresentationContext context, Object element ) { - if ( context.getId().equals( ICDebugUIConstants.ID_SIGNALS_VIEW ) ) - return new SignalsViewColumnPresentation(); - return null; - } - - @Override - public String getColumnPresentationId( IPresentationContext context, Object element ) { - if ( context.getId().equals( ICDebugUIConstants.ID_SIGNALS_VIEW ) ) - return SignalsViewColumnPresentation.ID; - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementContentProvider.java deleted file mode 100644 index 0f69629ef54..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementContentProvider.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.IDisassemblyLine; -import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval; -import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorPresentation; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentBaseChangeUpdate; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentProvider; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentUpdate; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugException; - -public class DisassemblyElementContentProvider implements IDocumentElementContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentProvider#updateContent(org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentUpdate) - */ - @Override - public void updateContent( final IDocumentElementContentUpdate update ) { - Job job = new Job( "Source content update" ) { //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected IStatus run( IProgressMonitor monitor ) { - if ( !update.isCanceled() ) { - retrieveDisassembly( update ); - } - update.done(); - return Status.OK_STATUS; - } - }; - job.setSystem( true ); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentProvider#updateInput(org.eclipse.cdt.debug.ui.disassembly.IDocumentBaseChangeUpdate) - */ - @Override - public void updateInput( final IDocumentBaseChangeUpdate update ) { - Job job = new Job( "Input update" ) { //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected IStatus run( IProgressMonitor monitor ) { - if ( !update.isCanceled() ) { - changeBaseElement( update ); - } - update.done(); - return Status.OK_STATUS; - } - }; - job.setSystem( true ); - job.schedule(); - } - - protected void changeBaseElement( IDocumentBaseChangeUpdate update ) { - Object root = update.getRootElement(); - if ( root instanceof DisassemblyRetrieval ) { - DisassemblyRetrieval retrieval = (DisassemblyRetrieval)root; - try { - retrieval.changeBase( update.getElement(), update.getOriginalOffset(), getPresentationFlags( (IDocumentPresentation)update.getPresentationContext() ) ); - update.setBaseElement( retrieval.getBaseElement() ); - update.setOffset( retrieval.getCurrentOffset() ); - } - catch( DebugException e ) { - update.setStatus( e.getStatus() ); - } - } - } - - protected void retrieveDisassembly( IDocumentElementContentUpdate update ) { - Object root = update.getRootElement(); - if ( root instanceof DisassemblyRetrieval ) { - DisassemblyRetrieval retrieval = (DisassemblyRetrieval)root; - try { - retrieval.retrieveDisassembly( - update.getElement(), - update.getBaseElement(), - update.getOriginalOffset(), - update.getRequestedLineCount(), - update.reveal(), - getPresentationFlags( (IDocumentPresentation)update.getPresentationContext() ) ); - IDisassemblyLine[] lines = retrieval.getLines(); - update.setOffset( retrieval.getCurrentOffset() ); - update.setLineCount( lines.length ); - for( int i = 0; i < lines.length; ++i ) { - update.addElement( i, lines[i] ); - } - } - catch( DebugException e ) { - update.setStatus( e.getStatus() ); - } - } - } - - private int getPresentationFlags( IDocumentPresentation presentation ) { - int flags = 0; - if ( presentation instanceof DisassemblyEditorPresentation ) { - DisassemblyEditorPresentation dep = (DisassemblyEditorPresentation)presentation; - if ( dep.showIntstructions() ) - flags |= DisassemblyRetrieval.FLAGS_SHOW_INSTRUCTIONS; - if ( dep.showSource() ) - flags |= DisassemblyRetrieval.FLAGS_SHOW_SOURCE; - } - return flags; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementLabelProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementLabelProvider.java deleted file mode 100644 index 44b9580bc82..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementLabelProvider.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - * IBM Corporation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.math.BigInteger; -import com.ibm.icu.text.MessageFormat; - -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction; -import org.eclipse.cdt.debug.core.model.IDisassemblySourceLine; -import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorPresentation; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementLabelProvider; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementLabelUpdate; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; - -/** - * org.eclipse.cdt.debug.internal.ui.elements.adapters.DisassemblyElementLabelProvider: - * //TODO Add description. - */ -public class DisassemblyElementLabelProvider implements IDocumentElementLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.ui.disassembly.IDocumentElementLabelProvider#update(org.eclipse.cdt.debug.ui.disassembly.IDocumentElementLabelUpdate[]) - */ - @Override - public void update( final IDocumentElementLabelUpdate[] updates ) { - Job job = new Job( "Label update" ) { //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected IStatus run( IProgressMonitor monitor ) { - for( int i = 0; i < updates.length; i++ ) { - IDocumentElementLabelUpdate update = updates[i]; - if ( !update.isCanceled() ) { - retrieveLabel( update ); - } - update.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem( true ); - job.schedule(); - } - - protected void retrieveLabel( IDocumentElementLabelUpdate update ) { - IPresentationContext context = update.getPresentationContext(); - if ( context instanceof DisassemblyEditorPresentation ) { - DisassemblyEditorPresentation presentation = (DisassemblyEditorPresentation)context; - Object element = update.getElement(); - if ( element instanceof IDisassemblyInstruction ) { - IDisassemblyInstruction instruction = (IDisassemblyInstruction)element; - StringBuilder sb = new StringBuilder(); - if ( presentation.showAddresses() ) { - BigInteger address = instruction.getAdress().getValue(); - sb.append( "0x" ); //$NON-NLS-1$ - sb.append( CDebugUtils.prependString( Long.toHexString( address.longValue() ), 8, '0' ) ); - sb.append( '\t' ); - } - sb.append( instruction.getInstructionText() ); - update.setLabel( DisassemblyEditorPresentation.ATTR_LINE_LABEL, sb.toString() ); - } - else if ( element instanceof IDisassemblySourceLine ) { - IDisassemblySourceLine line = (IDisassemblySourceLine)element; - StringBuilder sb = new StringBuilder(); - if ( presentation.showLineNumbers() ) { - sb.append( line.getLineNumber() ); - sb.append( '\t' ); - } - sb.append( getSourceLineText( line ) ); - update.setLabel( DisassemblyEditorPresentation.ATTR_LINE_LABEL, sb.toString() ); - } - } - } - - private String getSourceLineText( IDisassemblySourceLine line ) { - File file = line.getFile(); - String text = MessageFormat.format( "File {0} not found.", new Object[] {file.getPath()} ); - ISourceLocator locator = line.getDebugTarget().getLaunch().getSourceLocator(); - if ( locator instanceof ISourceLookupDirector ) { - ISourceLookupDirector director = (ISourceLookupDirector)locator; - Object sourceElement = director.getSourceElement( file.getPath() ); - if ( sourceElement != null ) { - File lookupFile = null; - if ( sourceElement instanceof IFile ) { - lookupFile = ((IFile)sourceElement).getLocation().toFile(); - } - else if ( sourceElement instanceof IStorage ) { - lookupFile = ((IStorage)sourceElement).getFullPath().toFile(); - } - if ( lookupFile != null ) { - try { - text = readLine( lookupFile, line.getLineNumber() - 1 ); - } - catch( IOException e ) { - text = e.getLocalizedMessage(); - } - } - } - } - return text; - } - - private String readLine( File file, int lineNumber ) throws IOException { - FileReader fr = new FileReader( file ); - BufferedReader br = new BufferedReader( fr ); - - try { - int count = 0; - String result = null; - do { - result = br.readLine(); - if ( count++ == lineNumber ) - return result; - } - while( result != null ); - } - finally { - br.close(); - } - - throw new IOException( MessageFormat.format( "Line {0} doesn't exist in {1}.", new Object[] {Integer.valueOf( lineNumber ), file.getPath()}) ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementProxy.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementProxy.java deleted file mode 100644 index fd3335bc180..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementProxy.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.core.model.IDisassemblyLine; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; -import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; -import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; -import org.eclipse.jface.viewers.Viewer; - -/** - * org.eclipse.cdt.debug.internal.ui.elements.adapters.DisassemblyElementProxy: - * //TODO Add description. - */ -public class DisassemblyElementProxy extends AbstractModelProxy implements IDebugEventSetListener { - - private Object fElement; - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) - */ - public DisassemblyElementProxy( Object element ) { - super(); - fElement = element; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer) - */ - @Override - public void installed( Viewer viewer ) { - super.installed( viewer ); - DebugPlugin.getDefault().addDebugEventListener( this ); - fireModelChanged( new ModelDelta( fElement, IModelDelta.CONTENT ) ); - } - - @Override - public void handleDebugEvents( DebugEvent[] events ) { - for ( DebugEvent event : events ) { - Object source = event.getSource(); - int kind = event.getKind(); - int detail = event.getDetail(); - if ( source instanceof IDisassemblyLine ) { - if ( kind == DebugEvent.CHANGE && detail == DebugEvent.STATE ) { - IDisassemblyLine line = (IDisassemblyLine)source; - DisassemblyRetrieval dr = ((CDebugTarget)line.getDebugTarget()).getDisassemblyRetrieval(); - if ( getElement().equals( dr ) ) { - fireModelChanged( createDelta( line ) ); - } - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#dispose() - */ - @Override - public synchronized void dispose() { - DebugPlugin.getDefault().removeDebugEventListener( this ); - super.dispose(); - } - - protected Object getElement() { - return fElement; - } - - protected IModelDelta createDelta( IDisassemblyLine line ) { - DisassemblyRetrieval dr = ((CDebugTarget)line.getDebugTarget()).getDisassemblyRetrieval(); - ModelDelta delta = new ModelDelta( dr, IModelDelta.NO_CHANGE ); - delta.addNode( line, IModelDelta.STATE ); - return delta; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyToggleBreakpointAdapter.java deleted file mode 100644 index a41e7983e10..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyToggleBreakpointAdapter.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import java.math.BigInteger; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction; -import org.eclipse.cdt.debug.ui.disassembly.IElementToggleBreakpointAdapter; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; - -/** - * org.eclipse.cdt.debug.internal.ui.elements.adapters.DisassemblyToggleBreakpointAdapter: - * //TODO Add description. - */ -public class DisassemblyToggleBreakpointAdapter implements IElementToggleBreakpointAdapter { - - - /* (non-Javadoc) - * @see com.arm.eclipse.rvd.ui.disassembly.IElementToggleBreakpointAdapter#canToggleLineBreakpoints(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - @Override - public boolean canToggleLineBreakpoints( IPresentationContext presentationContext, Object element ) { - if ( element instanceof IDisassemblyInstruction ) { - return true; - } - return false; - } - - /* (non-Javadoc) - * @see com.arm.eclipse.rvd.ui.disassembly.IElementToggleBreakpointAdapter#toggleLineBreakpoints(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - @Override - public void toggleLineBreakpoints( IPresentationContext presentationContext, Object element ) throws CoreException { - if ( element instanceof IDisassemblyInstruction ) { - IDisassemblyInstruction instruction = (IDisassemblyInstruction)element; - IBreakpoint breakpoint = findBreakpoint( instruction ); - if ( breakpoint != null ) { - DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); - } - else { - IAddress address = instruction.getAdress(); - CDIDebugModel.createAddressBreakpoint( - null, - "", //$NON-NLS-1$ - ResourcesPlugin.getWorkspace().getRoot(), - ICBreakpointType.REGULAR, - -1, - address, - true, - 0, - "", //$NON-NLS-1$ - true ); - } - } - } - - private IBreakpoint findBreakpoint( IDisassemblyInstruction instruction ) { - BigInteger address = instruction.getAdress().getValue(); - IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(); - for ( IBreakpoint bp : breakpoints ) { - if ( bp instanceof ICLineBreakpoint ) { - try { - IAddress bpAddress = ((ICDebugTarget)instruction.getDebugTarget()).getBreakpointAddress( (ICLineBreakpoint)bp ); - if ( bpAddress != null && address.compareTo( bpAddress.getValue() ) == 0 ) - return bp; - } - catch( DebugException e ) { - } - } - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/ElementAdapterMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/ElementAdapterMessages.java deleted file mode 100644 index 2acb0ac831f..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/ElementAdapterMessages.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.osgi.util.NLS; - -public class ElementAdapterMessages extends NLS { - public static String RegistersViewColumnPresentation_0; - public static String RegistersViewColumnPresentation_1; - public static String RegistersViewColumnPresentation_2; - - static { - // initialize resource bundle - NLS.initializeMessages(ElementAdapterMessages.class.getName(), ElementAdapterMessages.class); - } - - private ElementAdapterMessages() { - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/ElementAdapterMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/ElementAdapterMessages.properties deleted file mode 100644 index 4c599b8cc0d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/ElementAdapterMessages.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2010 ARM Limited and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# ARM Limited - Initial API and implementation -############################################################################### -RegistersViewColumnPresentation_0=Type -RegistersViewColumnPresentation_1=Name -RegistersViewColumnPresentation_2=Value diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/RegistersViewColumnPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/RegistersViewColumnPresentation.java deleted file mode 100644 index dc2a9e7f469..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/RegistersViewColumnPresentation.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.debug.internal.ui.elements.adapters.VariableColumnPresentation; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Registers View columns - */ -public class RegistersViewColumnPresentation implements IColumnPresentation { - - private static final String PREFIX = CDebugUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$ - - public static final String ID = PREFIX + "registersViewColumnPresentationId"; //$NON-NLS-1$ - - private static final String COLUMN_ID_NAME = VariableColumnPresentation.COLUMN_VARIABLE_NAME; - private static final String COLUMN_ID_TYPE = VariableColumnPresentation.COLUMN_VARIABLE_TYPE; - private static final String COLUMN_ID_VALUE = VariableColumnPresentation.COLUMN_VARIABLE_VALUE; - - private static final String[] ALL_COLUMNS = new String[] { - COLUMN_ID_NAME, - COLUMN_ID_TYPE, - COLUMN_ID_VALUE - }; - - private static final String[] INITIAL_COLUMNS = new String[] { - COLUMN_ID_NAME, - COLUMN_ID_VALUE - }; - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#init(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - @Override - public void init( IPresentationContext context ) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#dispose() - */ - @Override - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getAvailableColumns() - */ - @Override - public String[] getAvailableColumns() { - return ALL_COLUMNS; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getInitialColumns() - */ - @Override - public String[] getInitialColumns() { - return INITIAL_COLUMNS; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getHeader(java.lang.String) - */ - @Override - public String getHeader( String id ) { - if ( COLUMN_ID_TYPE.equals( id ) ) { - return ElementAdapterMessages.RegistersViewColumnPresentation_0; - } - if ( COLUMN_ID_NAME.equals( id ) ) { - return ElementAdapterMessages.RegistersViewColumnPresentation_1; - } - if ( COLUMN_ID_VALUE.equals( id ) ) { - return ElementAdapterMessages.RegistersViewColumnPresentation_2; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getImageDescriptor(java.lang.String) - */ - @Override - public ImageDescriptor getImageDescriptor( String id ) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getId() - */ - @Override - public String getId() { - return ID; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#isOptional() - */ - @Override - public boolean isOptional() { - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/RegistersViewColumnPresentationFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/RegistersViewColumnPresentationFactory.java deleted file mode 100644 index 88f98844824..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/RegistersViewColumnPresentationFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 CodeSourcery and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CodeSourcery - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class RegistersViewColumnPresentationFactory implements IColumnPresentationFactory { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#createColumnPresentation(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - @Override - public IColumnPresentation createColumnPresentation( IPresentationContext context, Object element ) { - if ( context.getId().equals( IDebugUIConstants.ID_REGISTER_VIEW ) ) - return new RegistersViewColumnPresentation(); - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#getColumnPresentationId(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - @Override - public String getColumnPresentationId( IPresentationContext context, Object element ) { - if ( context.getId().equals( IDebugUIConstants.ID_REGISTER_VIEW ) ) - return RegistersViewColumnPresentation.ID; - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java index 4f925ebf1c2..6808cbbb4b1 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java @@ -23,15 +23,11 @@ import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICDebugConfiguration; import org.eclipse.cdt.debug.core.executables.Executable; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.cdt.debug.ui.ICDebuggerPage; import org.eclipse.cdt.ui.CElementLabelProvider; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -40,7 +36,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; @@ -57,7 +52,6 @@ import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorInput; @@ -121,53 +115,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { // user to choose one. int candidateCount = candidateConfigs.size(); if (candidateCount < 1) { - // Set the default debugger based on the active toolchain on the project (if possible) - ICDebugConfiguration debugConfig = null; - IProject project = bin.getResource().getProject(); - ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project); - ICConfigurationDescription configDesc = projDesc.getActiveConfiguration(); - String configId = configDesc.getId(); - ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations(); - int matchLength = 0; - for (int i = 0; i < debugConfigs.length; ++i) { - ICDebugConfiguration dc = debugConfigs[i]; - String[] patterns = dc.getSupportedBuildConfigPatterns(); - if (patterns != null) { - for (int j = 0; j < patterns.length; ++j) { - if (patterns[j].length() > matchLength && configId.matches(patterns[j])) { - debugConfig = dc; - matchLength = patterns[j].length(); - } - } - } - } - - if (debugConfig == null) { - // Prompt the user if more then 1 debugger. - String programCPU = bin.getCPU(); - String os = Platform.getOS(); - debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations(); - List<ICDebugConfiguration> debugList = new ArrayList<ICDebugConfiguration>(debugConfigs.length); - for (int i = 0; i < debugConfigs.length; i++) { - String platform = debugConfigs[i].getPlatform(); - if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) { - if (platform.equals("*") || platform.equals(os)) { //$NON-NLS-1$ - if (debugConfigs[i].supportsCPU(programCPU)) - debugList.add(debugConfigs[i]); - } - } - } - debugConfigs = debugList.toArray(new ICDebugConfiguration[0]); - if (debugConfigs.length == 1) { - debugConfig = debugConfigs[0]; - } else if (debugConfigs.length > 1) { - debugConfig = chooseDebugConfig(debugConfigs, mode); - } - } - - if (debugConfig != null) { - configuration = createConfiguration(bin, debugConfig, mode); - } + configuration = createConfiguration(bin, mode); } else if (candidateCount == 1) { configuration = candidateConfigs.get(0); } else { @@ -184,7 +132,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { * @param bin * @return ILaunchConfiguration */ - private ILaunchConfiguration createConfiguration(IBinary bin, ICDebugConfiguration debugConfig, String mode) { + private ILaunchConfiguration createConfiguration(IBinary bin, String mode) { ILaunchConfiguration config = null; try { String projectName = bin.getResource().getProjectRelativePath().toString(); @@ -197,7 +145,6 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null); wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN); - wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, debugConfig.getID()); ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(bin.getCProject().getProject()); if (projDes != null) { @@ -205,11 +152,6 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID); } - // Load up the debugger page to set the defaults. There should probably be a separate - // extension point for this. - ICDebuggerPage page = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID()); - page.setDefaults(wc); - config = wc.doSave(); } catch (CoreException ce) { CDebugUIPlugin.log(ce); @@ -241,55 +183,6 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { } /** - * Method chooseDebugConfig. - * @param debugConfigs - * @param mode - * @return ICDebugConfiguration - */ - private ICDebugConfiguration chooseDebugConfig(ICDebugConfiguration[] debugConfigs, String mode) { - ILabelProvider provider = new LabelProvider() { - /** - * The <code>LabelProvider</code> implementation of this - * <code>ILabelProvider</code> method returns the element's <code>toString</code> - * string. Subclasses may override. - */ - @Override - public String getText(Object element) { - if (element == null) { - return ""; //$NON-NLS-1$ - } else if (element instanceof ICDebugConfiguration) { - return ((ICDebugConfiguration) element).getName(); - } - return element.toString(); - } - }; - ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), provider); - dialog.setElements(debugConfigs); - dialog.setTitle(getDebugConfigDialogTitleString(debugConfigs, mode)); - dialog.setMessage(getDebugConfigDialogMessageString(debugConfigs, mode)); - dialog.setMultipleSelection(false); - int result = dialog.open(); - provider.dispose(); - if (result == Window.OK) { - return (ICDebugConfiguration) dialog.getFirstResult(); - } - return null; - } - - protected String getDebugConfigDialogTitleString(ICDebugConfiguration [] configList, String mode) { - return LaunchMessages.getString("CApplicationLaunchShortcut.LaunchDebugConfigSelection"); //$NON-NLS-1$ - } - - protected String getDebugConfigDialogMessageString(ICDebugConfiguration [] configList, String mode) { - if (mode.equals(ILaunchManager.DEBUG_MODE)) { - return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseConfigToDebug"); //$NON-NLS-1$ - } else if (mode.equals(ILaunchManager.RUN_MODE)) { - return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseConfigToRun"); //$NON-NLS-1$ - } - return LaunchMessages.getString("CApplicationLaunchShortcut.Invalid_launch_mode_1"); //$NON-NLS-1$ - } - - /** * Show a selection dialog that allows the user to choose one of the specified * launch configurations. Return the chosen config, or <code>null</code> if the * user cancelled the dialog. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java index d923a5aba9f..af3e825d6be 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java @@ -9,6 +9,7 @@ * QNX Software Systems - Initial API and implementation * Ken Ryall (Nokia) - 207675 * Mathias Kunter - Support for different charsets (bug 370462) + * Jonah Graham (Kichwa Coders) - Remove CDI *******************************************************************************/ package org.eclipse.cdt.debug.internal.ui.preferences; @@ -16,7 +17,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePreferenceConstants; import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.cdi.ICDIFormat; import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.utils.ui.controls.ControlFactory; @@ -38,7 +38,6 @@ import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; @@ -57,32 +56,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr private IWorkbench fWorkbench; - private Combo fVariableFormatCombo; - - private Combo fExpressionFormatCombo; - - private Combo fRegisterFormatCombo; - private EncodingFieldEditor fCharsetEditor; private EncodingFieldEditor fWideCharsetEditor; - - // Format constants - private static int[] fFormatIds = new int[] { - ICDIFormat.NATURAL, - ICDIFormat.HEXADECIMAL, - ICDIFormat.DECIMAL, - ICDIFormat.OCTAL, - ICDIFormat.BINARY - }; - - private static String[] fFormatLabels = new String[] { - PreferenceMessages.getString( "CDebugPreferencePage.0" ), //$NON-NLS-1$ - PreferenceMessages.getString( "CDebugPreferencePage.1" ), //$NON-NLS-1$ - PreferenceMessages.getString( "CDebugPreferencePage.2" ), //$NON-NLS-1$ - PreferenceMessages.getString( "CDebugPreferencePage.17" ), //$NON-NLS-1$ - PreferenceMessages.getString( "CDebugPreferencePage.14" ) //$NON-NLS-1$ - }; private PropertyChangeListener fPropertyChangeListener; @@ -148,8 +124,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr data.horizontalAlignment = GridData.FILL; composite.setLayoutData( data ); createSpacer( composite, 1 ); - createViewSettingPreferences( composite ); - createSpacer( composite, 1 ); createCharsetSettingPreferences( composite ); createSpacer( composite, 1 ); createBinarySettings( composite ); @@ -158,30 +132,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr } /** - * Creates composite group and sets the default layout data. - * - * @param parent - * the parent of the new composite - * @param numColumns - * the number of columns for the new composite - * @param labelText - * the text label of the new composite - * @return the newly-created composite - */ - private Composite createGroupComposite( Composite parent, int numColumns, String labelText ) { - return ControlFactory.createGroup( parent, labelText, numColumns ); - } - - /** * Set the values of the component widgets based on the values in the preference store */ private void setValues() { - // Set the number format combo boxes. - fVariableFormatCombo.select(getFormatIndex(Platform.getPreferencesService().getInt(CDebugCorePlugin.PLUGIN_ID, ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, ICDIFormat.NATURAL, null))); - fExpressionFormatCombo.select(getFormatIndex(Platform.getPreferencesService().getInt(CDebugCorePlugin.PLUGIN_ID, ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, ICDIFormat.NATURAL, null))); - fRegisterFormatCombo.select(getFormatIndex(Platform.getPreferencesService().getInt(CDebugCorePlugin.PLUGIN_ID, ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, ICDIFormat.NATURAL, null))); - - // Set the charset editors. // Create a temporary preference store. @@ -265,18 +218,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr getPreferenceStore().removePropertyChangeListener( getPropertyChangeListener() ); } - /** - * Create the view setting preferences composite widget - */ - private void createViewSettingPreferences( Composite parent ) { - Composite comp = createGroupComposite( parent, 1, PreferenceMessages.getString( "CDebugPreferencePage.4" ) ); //$NON-NLS-1$ - Composite formatComposite = ControlFactory.createCompositeEx( comp, 2, 0 ); - ((GridLayout)formatComposite.getLayout()).makeColumnsEqualWidth = true; - fVariableFormatCombo = createComboBox( formatComposite, PreferenceMessages.getString( "CDebugPreferencePage.8" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$ - fExpressionFormatCombo = createComboBox( formatComposite, PreferenceMessages.getString( "CDebugPreferencePage.9" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$ - fRegisterFormatCombo = createComboBox( formatComposite, PreferenceMessages.getString( "CDebugPreferencePage.10" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$ - } - private void createCharsetSettingPreferences( Composite parent ) { // Create containing composite Composite formatComposite = ControlFactory.createComposite( parent, 2); @@ -310,16 +251,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr return button; } - /** - * Creates a button with the given label and sets the default configuration data. - */ - private Combo createComboBox( Composite parent, String label, String[] items, String selection ) { - ControlFactory.createLabel( parent, label ); - Combo combo = ControlFactory.createSelectCombo( parent, items, selection ); - combo.setLayoutData( new GridData() ); - return combo; - } - protected void createSpacer( Composite composite, int columnSpan ) { Label label = new Label( composite, SWT.NONE ); GridData gd = new GridData(); @@ -389,11 +320,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr * Store the preference values based on the state of the component widgets */ private void storeValues() { - // Store the number formats. - InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).putInt(ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, getFormatId(fVariableFormatCombo.getSelectionIndex())); - InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).putInt(ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, getFormatId(fExpressionFormatCombo.getSelectionIndex())); - InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).putInt(ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, getFormatId(fRegisterFormatCombo.getSelectionIndex())); - // Store the charset. if (fCharsetEditor.presentsDefaultValue()) { InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_CHARSET); @@ -426,25 +352,11 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr } private void setDefaultValues() { - fVariableFormatCombo.select(getFormatIndex(DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).getInt(ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, ICDIFormat.NATURAL))); - fExpressionFormatCombo.select(getFormatIndex(DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).getInt(ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, ICDIFormat.NATURAL))); - fRegisterFormatCombo.select(getFormatIndex(DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).getInt(ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, ICDIFormat.NATURAL))); fCharsetEditor.loadDefault(); fWideCharsetEditor.loadDefault(); fShowBinarySourceFilesButton.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).getBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true)); } - private static int getFormatId( int index ) { - return (index >= 0 && index < fFormatIds.length) ? fFormatIds[index] : fFormatIds[0]; - } - - private static int getFormatIndex( int id ) { - for( int i = 0; i < fFormatIds.length; ++i ) - if ( fFormatIds[i] == id ) - return i; - return -1; - } - private IWorkbench getWorkbench() { return fWorkbench; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DebuggerTypesPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DebuggerTypesPage.java deleted file mode 100644 index 66dfe31bbbe..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DebuggerTypesPage.java +++ /dev/null @@ -1,266 +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.internal.ui.preferences; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDebugConfiguration; -import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; -import org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField; -import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField; -import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.layout.PixelConverter; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -import com.ibm.icu.text.MessageFormat; - -/** - * The "Debugger Types" preference page. - */ -public class DebuggerTypesPage extends PreferencePage implements IWorkbenchPreferencePage { - - protected static String[] fgButtonLabels = new String[] { PreferenceMessages.getString( "DebuggerTypesPage.0" ), PreferenceMessages.getString( "DebuggerTypesPage.1" ), PreferenceMessages.getString( "DebuggerTypesPage.2" ) }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * Comment for DebuggerTypesPage. - */ - class DebuggerTypesDialogField extends CheckedListDialogField { - - public DebuggerTypesDialogField() { - super( new IListAdapter() { - @Override - public void customButtonPressed( DialogField field, int index ) { - } - - @Override - public void selectionChanged( DialogField field ) { - } - }, fgButtonLabels, new DebuggerTypeLabelProvider() ); - } - - @Override - public Control[] doFillIntoGrid( Composite parent, int nColumns ) { - PixelConverter converter = new PixelConverter( parent ); - assertEnoughColumns( nColumns ); - Control list = getListControl( parent ); - GridData gd = new GridData(); - gd.horizontalAlignment = GridData.FILL; - gd.grabExcessHorizontalSpace = true; - gd.verticalAlignment = GridData.FILL; - gd.grabExcessVerticalSpace = true; - gd.horizontalSpan = nColumns - 2; - gd.widthHint = converter.convertWidthInCharsToPixels( 50 ); - gd.heightHint = converter.convertHeightInCharsToPixels( 6 ); - list.setLayoutData( gd ); - Composite buttons = getButtonBox( parent ); - gd = new GridData(); - gd.horizontalAlignment = GridData.FILL; - gd.grabExcessHorizontalSpace = false; - gd.verticalAlignment = GridData.FILL; - gd.grabExcessVerticalSpace = true; - gd.horizontalSpan = 1; - buttons.setLayoutData( gd ); - return new Control[]{ list, buttons }; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#getManagedButtonState(org.eclipse.jface.viewers.ISelection, int) - */ - @Override - protected boolean getManagedButtonState( ISelection sel, int index ) { - // Enable/disable the "Default" button - if ( index == 2 && sel instanceof IStructuredSelection ) { - Object o = ((IStructuredSelection)sel).getFirstElement(); - return o != null && isChecked( o ); - } - return super.getManagedButtonState( sel, index ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#managedButtonPressed(int) - */ - @Override - protected boolean managedButtonPressed( int index ) { - if ( index == 2 ) { - List list = getSelectedElements(); - if ( !list.isEmpty() ) - setDefault( ((ICDebugConfiguration)list.get( 0 )).getID() ); - else - setDefault( null ); - refresh(); - } - return super.managedButtonPressed( index ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField#getListStyle() - */ - @Override - protected int getListStyle() { - return SWT.BORDER + SWT.SINGLE + SWT.H_SCROLL + SWT.V_SCROLL; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#doCheckStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) - */ - @Override - protected void doCheckStateChanged( CheckStateChangedEvent e ) { - super.doCheckStateChanged( e ); - ICDebugConfiguration dc = (ICDebugConfiguration)e.getElement(); - if ( dc.getID().equals( getDefault() ) && !e.getChecked() ) { - List list = getCheckedElements(); - setDefault( ( list.size() > 0 ) ? ((ICDebugConfiguration)list.get( 0 )).getID() : null ); - refresh(); - } - else if ( e.getChecked() && getDefault() == null ) { - setDefault( ((ICDebugConfiguration)e.getElement()).getID() ); - refresh(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#checkAll(boolean) - */ - @Override - public void checkAll( boolean state ) { - super.checkAll( state ); - List list = getCheckedElements(); - setDefault( ( list.size() > 0 ) ? ((ICDebugConfiguration)list.get( 0 )).getID() : null ); - refresh(); - } - } - - /** - * Comment for DebuggerTypesPage. - */ - class DebuggerTypeLabelProvider extends LabelProvider { - - @Override - public String getText( Object element ) { - if ( element instanceof ICDebugConfiguration ) { - ICDebugConfiguration dc = (ICDebugConfiguration)element; - String label = dc.getName(); - if ( dc.getID().equals( getDefault() ) ) - label += MessageFormat.format( " ({0})", new String[] { PreferenceMessages.getString( "DebuggerTypesPage.3" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ - return label; - } - return super.getText( element ); - } - } - - private DebuggerTypesDialogField fListField; - private IWorkbench fWorkbench; - private String fDefault; - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createContents( Composite parent ) { - Font font = parent.getFont(); - Composite comp = new Composite( parent, SWT.NONE ); - GridLayout topLayout = new GridLayout(); - topLayout.numColumns = 3; - comp.setLayout( topLayout ); - GridData gd = new GridData( GridData.FILL_BOTH ); - comp.setLayoutData( gd ); - comp.setFont( font ); - Label viewerLabel = new Label( comp, SWT.LEFT ); - viewerLabel.setText( PreferenceMessages.getString( "DebuggerTypesPage.4" ) ); //$NON-NLS-1$ - gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL ); - gd.horizontalSpan = 3; - viewerLabel.setLayoutData( gd ); - viewerLabel.setFont( font ); - fListField = new DebuggerTypesDialogField(); - fListField.setCheckAllButtonIndex( 0 ); - fListField.setUncheckAllButtonIndex( 1 ); - Dialog.applyDialogFont( comp ); - fListField.doFillIntoGrid( comp, 3 ); - initialize(); - getWorkbench().getHelpSystem().setHelp( comp, ICDebugHelpContextIds.DEBUGGER_TYPES_PAGE ); - return comp; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - @Override - public void init( IWorkbench workbench ) { - fWorkbench = workbench; - } - - private IWorkbench getWorkbench() { - return fWorkbench; - } - - private void initialize() { - ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration(); - setDefault( ( dc != null ) ? dc.getID() : null ); - fListField.addElements( Arrays.asList( CDebugCorePlugin.getDefault().getDebugConfigurations() ) ); - fListField.setCheckedElements( Arrays.asList( CDebugCorePlugin.getDefault().getActiveDebugConfigurations() ) ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performOk() - */ - @Override - public boolean performOk() { - CDebugCorePlugin.getDefault().saveDefaultDebugConfiguration( getDefault() ); - List elements = fListField.getElements(); - elements.removeAll( fListField.getCheckedElements() ); - CDebugCorePlugin.getDefault().saveFilteredDebugConfigurations( (ICDebugConfiguration[])elements.toArray( new ICDebugConfiguration[elements.size()] ) ); - return super.performOk(); - } - - protected String getDefault() { - return fDefault; - } - - protected void setDefault( String defaultConfiguration ) { - fDefault = defaultConfiguration; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - @Override - protected void performDefaults() { - fListField.setCheckedElements( Arrays.asList( CDebugCorePlugin.getDefault().getDefaultActiveDebugConfigurations() ) ); - ICDebugConfiguration defaultConfiguration = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration(); - if ( defaultConfiguration != null ) { - setDefault( defaultConfiguration.getID() ); - } - else { - List list = fListField.getCheckedElements(); - if ( !list.isEmpty() ) { - setDefault( ((ICDebugConfiguration)list.get( 0 )).getID() ); - } - } - fListField.refresh(); - super.performDefaults(); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties index 7723772da27..b49542245b3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties @@ -12,21 +12,15 @@ ############################################################################### CDebugPreferencePage.Color_of_disassembly_source_lines_1=Color of source lines: -CDebugPreferencePage.0=Default -CDebugPreferencePage.1=Hexadecimal -CDebugPreferencePage.2=Decimal CDebugPreferencePage.3=General settings for C/C++ Debugging. -CDebugPreferencePage.4=Default number format CDebugPreferencePage.8=Variables: CDebugPreferencePage.9=Expressions: CDebugPreferencePage.10=Registers: CDebugPreferencePage.11=Disassembly options CDebugPreferencePage.12=Maximum number of displayed instructions: CDebugPreferencePage.13=Value must be an integer between {0} and {1}. -CDebugPreferencePage.14=Binary CDebugPreferencePage.15=Show source files in binaries CDebugPreferencePage.16=Wide character encoding -CDebugPreferencePage.17=Octal CDebugPreferencePage.18=Character encoding CDebugPreferencePage.19=The selected character encoding is not supported. CDebugPreferencePage.20=The selected wide character encoding is not supported. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/AddMemoryBlocks.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/AddMemoryBlocks.java index 4ba2fb11fa1..b7f626430ba 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/AddMemoryBlocks.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/AddMemoryBlocks.java @@ -15,11 +15,8 @@ import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; -import org.eclipse.cdt.debug.core.model.ICVariable; import org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval; -import org.eclipse.cdt.debug.internal.core.CMemoryBlockRetrievalExtension; import org.eclipse.cdt.debug.internal.core.CRequest; -import org.eclipse.cdt.debug.internal.core.model.CRegister; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -355,56 +352,6 @@ public class AddMemoryBlocks implements IAddMemoryBlocksTarget { container.addMemoryRendering(rendering); } - public void addMemoryBlocksForVariables(ICVariable[] variables, IMemoryRenderingSite memSite) throws DebugException { - - IAdaptable debugViewElement = DebugUITools.getDebugContext(); - - - CMemoryBlockRetrievalExtension cdtRetrieval = null; - - { - IMemoryBlockRetrieval retrieval = debugViewElement.getAdapter(IMemoryBlockRetrieval.class); - - if (retrieval == null && debugViewElement instanceof IDebugElement) - retrieval = ((IDebugElement)debugViewElement).getDebugTarget(); - - if (retrieval == null || !(retrieval instanceof CMemoryBlockRetrievalExtension)) - return; - - cdtRetrieval = (CMemoryBlockRetrievalExtension) retrieval; - } - - String[] expressions = new String[variables.length]; - for (int i = 0; i < variables.length; i++) { - - String exp = variables[i].getExpressionString(); - - if (variables[i].getType().isPointer() || variables[i].getType().isArray() || - variables[i].getType().isReference() || variables[i] instanceof CRegister) - expressions[i] = exp; - else - expressions[i] = "&" + exp; //$NON-NLS-1$ - } - - ParamHolder params; - params = new ExpressionsHolder(expressions); - - final IAdaptable debugViewElement_f = debugViewElement; - final CMemoryBlockRetrievalExtension retrieval_f = cdtRetrieval; - final ParamHolder params_f = params; - final IMemoryRenderingSite memRendSite = memSite; - Job job = new Job("Add Memory Block") { //$NON-NLS-1$ - @Override - protected IStatus run(IProgressMonitor monitor) { - addMemoryBlocks(debugViewElement_f, retrieval_f, params_f, - memRendSite); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - /** * Helper function to open an error dialog. * @param title diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleMementoProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleMementoProvider.java deleted file mode 100644 index 919dfd2a245..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleMementoProvider.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2015 ARM and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ARM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.modules; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICModule; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.ICThread; -import org.eclipse.cdt.debug.core.model.IModuleRetrieval; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.internal.ui.model.elements.ElementMementoProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.ui.IMemento; - -/** - * org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider: - * //TODO Add description. - */ -public class ModuleMementoProvider extends ElementMementoProvider { - - /** - * memento attribute - */ - private static final String ELEMENT_NAME = "ELEMENT_NAME"; //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementMementoProvider#encodeElement(java.lang.Object, org.eclipse.ui.IMemento, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - @Override - protected boolean encodeElement( Object element, IMemento memento, IPresentationContext context ) throws CoreException { - if ( element instanceof ICDebugTarget || element instanceof ICThread || element instanceof ICStackFrame ) { - IModuleRetrieval mr = ((IAdaptable)element).getAdapter( IModuleRetrieval.class ); - if ( mr != null ) { - memento.putString( ELEMENT_NAME, mr.toString() ); - } - else { - // shouldn't happen - memento.putString( ELEMENT_NAME, CDIDebugModel.getPluginIdentifier() ); - } - } - else if ( element instanceof ICModule ) { - memento.putString( ELEMENT_NAME, ((ICModule)element).getName() ); - } - else if ( element instanceof ICElement ) { - memento.putString( ELEMENT_NAME, ((ICElement)element).getElementName() ); - } - else { - return false; - } - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementMementoProvider#isEqual(java.lang.Object, org.eclipse.ui.IMemento, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - @Override - protected boolean isEqual( Object element, IMemento memento, IPresentationContext context ) throws CoreException { - String mementoName = memento.getString( ELEMENT_NAME ); - if ( mementoName != null ) { - String elementName = null; - if ( element instanceof ICDebugTarget || element instanceof ICThread || element instanceof ICStackFrame ) { - IModuleRetrieval mr = ((IAdaptable)element).getAdapter( IModuleRetrieval.class ); - elementName = ( mr != null ) ? mr.toString() : CDIDebugModel.getPluginIdentifier(); - } - else if ( element instanceof ICModule ) { - elementName = ((ICModule)element).getName(); - } - else if ( element instanceof ICElement ) { - elementName = ((ICElement)element).getElementName(); - } - if ( elementName != null ) { - return elementName.equals( mementoName ); - } - } - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsContentProvider.java deleted file mode 100644 index 59557fbda0d..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsContentProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 - * Wind River Systems - flexible hierarchy Signals view (bug 338908) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.signals; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.cdt.debug.ui.ICDebugUIConstants; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; - -public class SignalsContentProvider extends ElementContentProvider { - - @Override - protected int getChildCount( Object element, IPresentationContext context, IViewerUpdate monitor ) throws CoreException { - return getAllChildren( element, context ).length; - } - - @Override - protected Object[] getChildren( Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor ) throws CoreException { - return getElements( getAllChildren( parent, context ), index, length ); - } - - @Override - protected boolean supportsContextId( String id ) { - return ICDebugUIConstants.ID_SIGNALS_VIEW.equals( id ); - } - - protected Object[] getAllChildren(Object parent, IPresentationContext context) throws CoreException { - if (parent instanceof ICDebugTarget) { - ICDebugTarget target = (ICDebugTarget) parent; - try { - Object[] signals = target.getSignals(); - if (signals != null) - return signals; - } catch (DebugException e) { - CDebugUIPlugin.log(e); - } - } - return EMPTY; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsView.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsView.java deleted file mode 100644 index c1d7e871129..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsView.java +++ /dev/null @@ -1,241 +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.internal.ui.views.signals; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICSignal; -import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; -import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView; -import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.ui.IDebugModelPresentation; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.INullSelectionListener; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPart; - - -/** - * Displays signals. - * - * @since: Mar 8, 2004 - */ -public class SignalsView extends AbstractDebugEventHandlerView - implements ISelectionListener, - INullSelectionListener, - IPropertyChangeListener, - IDebugExceptionHandler { - - public class SignalsViewLabelProvider extends LabelProvider implements ITableLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) - */ - @Override - public Image getColumnImage( Object element, int columnIndex ) { - if ( columnIndex == 0 ) - return getModelPresentation().getImage( element ); - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - @Override - public String getColumnText( Object element, int columnIndex ) { - if ( element instanceof ICSignal ) { - try { - switch( columnIndex ) { - case 0: - return ((ICSignal)element).getName(); - case 1: - return (((ICSignal)element).isPassEnabled()) ? SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE; - case 2: - return (((ICSignal)element).isStopEnabled()) ? SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE; - case 3: - return ((ICSignal)element).getDescription(); - } - } catch( DebugException e ) { - } - } - return null; - } - - private IDebugModelPresentation getModelPresentation() { - return CDebugUIPlugin.getDebugModelPresentation(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Viewer createViewer( Composite parent ) { - - // add tree viewer - final SignalsViewer vv = new SignalsViewer( parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL ); - vv.setContentProvider( createContentProvider() ); - vv.setLabelProvider( new SignalsViewLabelProvider() ); - vv.setUseHashlookup( true ); - - // listen to preference changes - CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this ); - - // listen to selection in debug view - getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - setEventHandler( new SignalsViewEventHandler( this ) ); - - return vv; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createActions() - */ - @Override - protected void createActions() { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId() - */ - @Override - protected String getHelpContextId() { - return ICDebugHelpContextIds.SIGNALS_VIEW; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(org.eclipse.jface.action.IMenuManager) - */ - @Override - protected void fillContextMenu( IMenuManager menu ) { - menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) ); - updateObjects(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager) - */ - @Override - protected void configureToolBar( IToolBarManager tbm ) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - @Override - public void selectionChanged( IWorkbenchPart part, ISelection selection ) { - if ( !isAvailable() || !isVisible() ) - return; - if ( selection == null ) - setViewerInput( new StructuredSelection() ); - else if ( selection instanceof IStructuredSelection ) - setViewerInput( (IStructuredSelection)selection ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - @Override - public void propertyChange( PropertyChangeEvent event ) { - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(org.eclipse.debug.core.DebugException) - */ - @Override - public void handleException( DebugException e ) { - showMessage( e.getMessage() ); - } - - /** - * Creates this view's content provider. - * - * @return a content provider - */ - private IContentProvider createContentProvider() { - SignalsViewContentProvider cp = new SignalsViewContentProvider(); - cp.setExceptionHandler( this ); - return cp; - } - - protected void setViewerInput( IStructuredSelection ssel ) { - ICDebugTarget target = null; - if ( ssel != null && ssel.size() == 1 ) { - Object input = ssel.getFirstElement(); - if ( input instanceof IDebugElement && ((IDebugElement)input).getDebugTarget() instanceof ICDebugTarget ) - target = (ICDebugTarget)((IDebugElement)input).getDebugTarget(); - } - - if ( getViewer() == null ) - return; - - Object current = getViewer().getInput(); - if ( current != null && current.equals( target ) ) { - updateObjects(); - return; - } - - showViewer(); - getViewer().setInput( target ); - updateObjects(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden() - */ - @Override - protected void becomesHidden() { - setViewerInput( new StructuredSelection() ); - super.becomesHidden(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible() - */ - @Override - protected void becomesVisible() { - super.becomesVisible(); - IViewPart part = getSite().getPage().findView( IDebugUIConstants.ID_DEBUG_VIEW ); - if ( part != null ) { - ISelection selection = getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW ); - selectionChanged( part, selection ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - @Override - public void dispose() { - getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this ); - super.dispose(); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsViewContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsViewContentProvider.java deleted file mode 100644 index cff6e01170b..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/signals/SignalsViewContentProvider.java +++ /dev/null @@ -1,90 +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.internal.ui.views.signals; - -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.debug.core.DebugException; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.Viewer; - - -/** - * Provides content for the signals view. - * - * @since: Mar 8, 2004 - */ -public class SignalsViewContentProvider implements IStructuredContentProvider { - - /** - * Handler for exceptions as content is retrieved - */ - private IDebugExceptionHandler fExceptionHandler = null; - - public SignalsViewContentProvider() { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - @Override - public Object[] getElements( Object inputElement ) { - if ( inputElement instanceof ICDebugTarget ) { - ICDebugTarget target = (ICDebugTarget)inputElement; - try { - Object[] signals = target.getSignals(); - if ( signals != null ) - return signals; - } - catch( DebugException e ) { - if ( getExceptionHandler() != null ) - getExceptionHandler().handleException( e ); - else - CDebugUIPlugin.log( e ); - } - } - return new Object[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - @Override - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - @Override - public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) { - } - - /** - * Sets an exception handler for this content provider. - * - * @param handler debug exception handler or <code>null</code> - */ - protected void setExceptionHandler(IDebugExceptionHandler handler) { - fExceptionHandler = handler; - } - - /** - * Returns the exception handler for this content provider. - * - * @return debug exception handler or <code>null</code> - */ - protected IDebugExceptionHandler getExceptionHandler() { - return fExceptionHandler; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java index 56e767ca6b4..0e5d387606a 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java @@ -16,16 +16,12 @@ import java.util.HashMap; import java.util.Map; import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.model.ICDebugElement; import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry; import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation; import org.eclipse.cdt.debug.internal.ui.CDebuggerPageAdapter; -import org.eclipse.cdt.debug.internal.ui.CRegisterManagerProxies; import org.eclipse.cdt.debug.internal.ui.ColorManager; -import org.eclipse.cdt.debug.internal.ui.EvaluationContextManager; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointUpdater; -import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyBackendCdiFactory; import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorManager; import org.eclipse.cdt.debug.internal.ui.pinclone.ViewIDCounterManager; import org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator; @@ -292,9 +288,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin { fDisassemblyEditorManager = new DisassemblyEditorManager(); CDebugCorePlugin.getDefault().addCBreakpointListener( CBreakpointUpdater.getInstance() ); - // Register the CDI backend for DSF's disassembly view - Platform.getAdapterManager().registerAdapters(new DisassemblyBackendCdiFactory(), ICDebugElement.class); - WorkbenchJob wjob = new WorkbenchJob("Initializing CDT Debug UI") { //$NON-NLS-1$ @Override public IStatus runInUIThread(IProgressMonitor monitor) { @@ -306,7 +299,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin { } private void startupInUIThread() { - EvaluationContextManager.startup(); ViewIDCounterManager.getInstance().init(); // We contribute actions to the platform's Variables view with a @@ -339,7 +331,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin { @Override public void stop( BundleContext context ) throws Exception { CDebugCorePlugin.getDefault().removeCBreakpointListener( CBreakpointUpdater.getInstance() ); - CRegisterManagerProxies.getInstance().dispose(); fDisassemblyEditorManager.dispose(); if ( fImageDescriptorRegistry != null ) { fImageDescriptorRegistry.dispose(); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java index 95b04e7897c..df35adf8e2f 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java @@ -34,7 +34,6 @@ import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.internal.core.CRequest; -import org.eclipse.cdt.debug.internal.core.model.CMemoryBlockExtension; import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages; @@ -487,9 +486,7 @@ abstract public class AbstractToggleBreakpointAdapter } private String getMemorySpace(IMemoryBlock memBlock, String def) { - if (memBlock != null && memBlock instanceof CMemoryBlockExtension) { - return ((CMemoryBlockExtension)memBlock).getMemorySpaceID(); - } + // XXX: In pre-CDI removal this retrieved memory space from CMemoryBlockExtension return def; } diff --git a/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF index 48328775ce8..7a57350a15b 100644 --- a/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF @@ -11,4 +11,4 @@ Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.cdt.gdb.eventbkpts, org.eclipse.cdt.gdb.internal;x-internal:=true, - org.eclipse.cdt.gdb.internal.eventbkpts;x-friends:="org.eclipse.cdt.debug.mi.core,org.eclipse.cdt.dsf.gdb,org.eclipse.cdt.tests.dsf.gdb" + org.eclipse.cdt.gdb.internal.eventbkpts;x-friends:="org.eclipse.cdt.dsf.gdb,org.eclipse.cdt.tests.dsf.gdb" diff --git a/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml b/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml index 890658eba8b..e4e4f28c591 100644 --- a/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml +++ b/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml @@ -20,20 +20,6 @@ </license> <plugin - id="org.eclipse.cdt.debug.mi.core" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.cdt.debug.mi.ui" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin id="org.eclipse.cdt.launch" download-size="0" install-size="0" diff --git a/debug/org.eclipse.cdt.gnu.debug.source-feature/feature.xml b/debug/org.eclipse.cdt.gnu.debug.source-feature/feature.xml index ee43e47e3b2..739e0cc11da 100644 --- a/debug/org.eclipse.cdt.gnu.debug.source-feature/feature.xml +++ b/debug/org.eclipse.cdt.gnu.debug.source-feature/feature.xml @@ -20,20 +20,6 @@ </license> <plugin - id="org.eclipse.cdt.debug.mi.core.source" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.cdt.debug.mi.ui.source" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin id="org.eclipse.cdt.launch.source" download-size="0" install-size="0" |