diff options
author | Jeff Johnston | 2014-05-01 18:42:16 +0000 |
---|---|---|
committer | Jeff Johnston | 2014-05-05 19:39:30 +0000 |
commit | 6acb6dbc70ea67cbea3467709f41c4ffad9288c0 (patch) | |
tree | 4fb4e78059dd89deafdb1fbdfaf4acaccde65d48 /debug/org.eclipse.cdt.debug.application | |
parent | 4353aad6d5ae63c82977ca830e52a372d6e7774a (diff) | |
download | org.eclipse.cdt-6acb6dbc70ea67cbea3467709f41c4ffad9288c0.tar.gz org.eclipse.cdt-6acb6dbc70ea67cbea3467709f41c4ffad9288c0.tar.xz org.eclipse.cdt-6acb6dbc70ea67cbea3467709f41c4ffad9288c0.zip |
Add CDT Standalone Debugger
- add org.eclipse.cdt.debug.application plugin which supports running
CDT debugger as Eclipse application
- add org.eclipse.cdt.debug.application.docs plugin which is the
modified
CDT docs
- add org.eclipse.cdt.debug.standalone-feature which bundles the
two aforementioned plugins
- add org.eclipse.cdt.debug.standlone.source-feature
Change-Id: I1a1ae855ab3912e678b7d9e3465e2fbbfe949e13
Reviewed-on: https://git.eclipse.org/r/25845
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
Tested-by: Jeff Johnston <jjohnstn@redhat.com>
Diffstat (limited to 'debug/org.eclipse.cdt.debug.application')
57 files changed, 4210 insertions, 0 deletions
diff --git a/debug/org.eclipse.cdt.debug.application/.classpath b/debug/org.eclipse.cdt.debug.application/.classpath new file mode 100644 index 00000000000..f96aed716d9 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/debug/org.eclipse.cdt.debug.application/.gitignore b/debug/org.eclipse.cdt.debug.application/.gitignore new file mode 100644 index 00000000000..04f7f3ebf80 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/.gitignore @@ -0,0 +1,169 @@ +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin +/bin diff --git a/debug/org.eclipse.cdt.debug.application/.project b/debug/org.eclipse.cdt.debug.application/.project new file mode 100644 index 00000000000..768ee968f41 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.cdt.debug.application</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.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/debug/org.eclipse.cdt.debug.application/.settings/org.eclipse.jdt.core.prefs b/debug/org.eclipse.cdt.debug.application/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..8000cd6ca61 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +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.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/debug/org.eclipse.cdt.debug.application/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.application/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..c0cbae92232 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/META-INF/MANIFEST.MF @@ -0,0 +1,36 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %bundleName +Bundle-SymbolicName: org.eclipse.cdt.debug.application;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.cdt.debug.application.Activator +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", + org.eclipse.cdt.dsf.ui;bundle-version="2.4.0", + org.eclipse.cdt.gdb;bundle-version="7.0.0", + org.eclipse.cdt.gdb.ui;bundle-version="7.0.0", + org.eclipse.cdt.launch;bundle-version="7.1.0", + org.eclipse.ui.ide, + org.eclipse.cdt.core, + org.eclipse.cdt.managedbuilder.core;bundle-version="8.2.1", + org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="8.2.0", + org.eclipse.cdt.debug.core, + org.eclipse.ui.workbench +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-Localization: plugin +Bundle-ActivationPolicy: lazy +Eclipse-BundleShape: dir +Import-Package: org.eclipse.cdt.core.model, + org.eclipse.cdt.debug.core, + org.eclipse.cdt.debug.core.executables, + org.eclipse.core.resources, + org.eclipse.debug.core, + org.eclipse.debug.ui, + org.eclipse.debug.ui.actions diff --git a/debug/org.eclipse.cdt.debug.application/about.html b/debug/org.eclipse.cdt.debug.application/about.html new file mode 100644 index 00000000000..7ceab074a2b --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/about.html @@ -0,0 +1,29 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html lang="en" 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"> +<div role="main"> +<h1>About This Content</h1> + +<p>June 22, 2007</p> +<h2>License</h2> + +<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> +</div> +</body> +</html>
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/build.properties b/debug/org.eclipse.cdt.debug.application/build.properties new file mode 100644 index 00000000000..fb41d50a276 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/build.properties @@ -0,0 +1,16 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + plugin.properties,\ + eclipse.gif,\ + eclipse.png,\ + eclipse32.gif,\ + eclipse_lg.gif,\ + eclipse48.png,\ + eclipse48.gif,\ + eclipse32.png,\ + intro-eclipse.png,\ + scripts/, + about.html diff --git a/debug/org.eclipse.cdt.debug.application/eclipse.gif b/debug/org.eclipse.cdt.debug.application/eclipse.gif Binary files differnew file mode 100644 index 00000000000..7d7e32b2c0d --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse.gif diff --git a/debug/org.eclipse.cdt.debug.application/eclipse.png b/debug/org.eclipse.cdt.debug.application/eclipse.png Binary files differnew file mode 100644 index 00000000000..25e3bb5ea62 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse.png diff --git a/debug/org.eclipse.cdt.debug.application/eclipse16.gif b/debug/org.eclipse.cdt.debug.application/eclipse16.gif Binary files differnew file mode 100644 index 00000000000..abefafcb663 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse16.gif diff --git a/debug/org.eclipse.cdt.debug.application/eclipse16.png b/debug/org.eclipse.cdt.debug.application/eclipse16.png Binary files differnew file mode 100644 index 00000000000..8bd31d1cf3a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse16.png diff --git a/debug/org.eclipse.cdt.debug.application/eclipse256.png b/debug/org.eclipse.cdt.debug.application/eclipse256.png Binary files differnew file mode 100644 index 00000000000..941ab0b3e32 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse256.png diff --git a/debug/org.eclipse.cdt.debug.application/eclipse32.gif b/debug/org.eclipse.cdt.debug.application/eclipse32.gif Binary files differnew file mode 100644 index 00000000000..29edaa00634 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse32.gif diff --git a/debug/org.eclipse.cdt.debug.application/eclipse32.png b/debug/org.eclipse.cdt.debug.application/eclipse32.png Binary files differnew file mode 100644 index 00000000000..71ea8f9b2bf --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse32.png diff --git a/debug/org.eclipse.cdt.debug.application/eclipse48.gif b/debug/org.eclipse.cdt.debug.application/eclipse48.gif Binary files differnew file mode 100644 index 00000000000..ba596ce3e78 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse48.gif diff --git a/debug/org.eclipse.cdt.debug.application/eclipse48.png b/debug/org.eclipse.cdt.debug.application/eclipse48.png Binary files differnew file mode 100644 index 00000000000..6845e673d60 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse48.png diff --git a/debug/org.eclipse.cdt.debug.application/eclipse_lg.gif b/debug/org.eclipse.cdt.debug.application/eclipse_lg.gif Binary files differnew file mode 100644 index 00000000000..c004bf2452e --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/eclipse_lg.gif diff --git a/debug/org.eclipse.cdt.debug.application/gdbstandalone.zip b/debug/org.eclipse.cdt.debug.application/gdbstandalone.zip Binary files differnew file mode 100644 index 00000000000..d11fb9f235a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/gdbstandalone.zip diff --git a/debug/org.eclipse.cdt.debug.application/icons/alt_about.gif b/debug/org.eclipse.cdt.debug.application/icons/alt_about.gif Binary files differnew file mode 100644 index 00000000000..20d9ad2d98d --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/icons/alt_about.gif diff --git a/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.icns b/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.icns Binary files differnew file mode 100644 index 00000000000..b77a6a63938 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.icns diff --git a/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.ico b/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.ico Binary files differnew file mode 100644 index 00000000000..d548f710934 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.ico diff --git a/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.xpm b/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.xpm new file mode 100644 index 00000000000..b0c139e0633 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/icons/alt_launcher.xpm @@ -0,0 +1,307 @@ +/* XPM */
+static char * icon48_xpm[] = {
+"48 48 256 2",
+" c #4B4B3B3B9090",
+". c #0D0D0E0E5454",
+"X c #11110E0E5B5B",
+"o c #17170F0F6363",
+"O c #1D1D13136969",
+"+ c #212114146C6C",
+"@ c #252514147171",
+"# c #282811116C6C",
+"$ c #26260D0D6363",
+"% c #22220B0B5E5E",
+"& c #1C1C0B0B5A5A",
+"* c #1C1C0B0B5252",
+"= c #1B1B05055353",
+"- c #161606064D4D",
+"; c #161605054949",
+": c #111104044848",
+"> c #131304044545",
+", c #131305054242",
+"< c #141410105E5E",
+"1 c #2C2C15157373",
+"2 c #2B2B1B1B7575",
+"3 c #343416167272",
+"4 c #313113136E6E",
+"5 c #222209095757",
+"6 c #1B1B06064D4D",
+"7 c #15150B0B4242",
+"8 c #13130C0C5555",
+"9 c #2E2E1B1B7878",
+"0 c #33331F1F7C7C",
+"q c #343418187878",
+"w c #3B3B1C1C7575",
+"e c #2E2E10106767",
+"r c #1B1B07074747",
+"t c #18180B0B4646",
+"y c #151513136262",
+"u c #1A1A15156464",
+"i c #34341F1F7777",
+"p c #40401E1E8080",
+"a c #42421B1B7A7A",
+"s c #3B3B15157474",
+"d c #2B2B0B0B5B5B",
+"f c #222207075252",
+"g c #373727277A7A",
+"h c #474724248484",
+"j c #393915156E6E",
+"k c #373711116A6A",
+"l c #343413136363",
+"z c #232319196E6E",
+"x c #292919197070",
+"c c #3C3C2C2C8282",
+"v c #444431318585",
+"b c #494934348A8A",
+"n c #505026268A8A",
+"m c #3D3D1B1B6E6E",
+"M c #31310E0E5C5C",
+"N c #2B2B0D0D5353",
+"B c #222207074A4A",
+"V c #52523C3C9292",
+"C c #58583C3C9494",
+"Z c #5D5D44449797",
+"A c #5C5C2E2E9292",
+"S c #676733339595",
+"D c #424228287575",
+"F c #29290A0A4F4F",
+"G c #6C6C4A4A9E9E",
+"H c #72725454A7A7",
+"J c #8C8C6D6DB2B2",
+"K c #343424246E6E",
+"L c #3A3A23236A6A",
+"P c #3A3A1C1C6767",
+"I c #24240A0A4B4B",
+"U c #151518186161",
+"Y c #76766F6FA5A5",
+"T c #ADAD9191CCCC",
+"R c #98988989D3D3",
+"E c #45453B3B8686",
+"W c #3C3C35357979",
+"Q c #363631317575",
+"! c #32322D2D6B6B",
+"~ c #323229296363",
+"^ c #30301F1F6262",
+"/ c #323218185E5E",
+"( c #272707074B4B",
+") c #202028286C6C",
+"_ c #1E1E1D1D6868",
+"` c #9A9A8282BBBB",
+"' c #C8C8B3B3D3D3",
+"] c #B3B3AFAFE7E7",
+"[ c #84847272C6C6",
+"{ c #58585757A3A3",
+"} c #3F3F3C3C8A8A",
+"| c #3B3B3A3A8484",
+" . c #414139397D7D",
+".. c #3D3D39397A7A",
+"X. c #37372E2E6E6E",
+"o. c #2C2C21215A5A",
+"O. c #2E2E1B1B5B5B",
+"+. c #F5F5EFEFF5F5",
+"@. c #656566669A9A",
+"#. c #47474B4B8E8E",
+"$. c #3C3C44447B7B",
+"%. c #444442428080",
+"&. c #45453E3E8181",
+"*. c #40403C3C8181",
+"=. c #3D3D33337474",
+"-. c #3B3B30306E6E",
+";. c #38382D2D6969",
+":. c #303026265D5D",
+">. c #2C2C15155A5A",
+",. c #1F1F1C1C7070",
+"<. c #25251E1E7171",
+"1. c #59595C5C9191",
+"2. c #4D4D53538989",
+"3. c #4C4C49498484",
+"4. c #484845458585",
+"5. c #494941418585",
+"6. c #494940408181",
+"7. c #2F2F1C1C5353",
+"8. c #2B2B28287676",
+"9. c #323231317F7F",
+"0. c #545452528B8B",
+"q. c #51514E4E8989",
+"w. c #4E4E4B4B8C8C",
+"e. c #4C4C47478686",
+"r. c #46463D3D7E7E",
+"t. c #434336367A7A",
+"y. c #2B2B13135555",
+"u. c #47473D3D8D8D",
+"i. c #575757578E8E",
+"p. c #48483E3E7F7F",
+"a. c #46463A3A7D7D",
+"s. c #424235357575",
+"d. c #404034347171",
+"f. c #BFBFCBCBFAFA",
+"g. c #B8B8A8A8DDDD",
+"h. c #5E5E60609292",
+"j. c #565655558C8C",
+"k. c #4B4B44448282",
+"l. c #454539397B7B",
+"z. c #434338387878",
+"x. c #3F3F32326D6D",
+"c. c #3D3D30306969",
+"v. c #3A3A2E2E6363",
+"b. c #36362A2A5C5C",
+"n. c #343424245555",
+"m. c #30301E1E4D4D",
+"M. c #49493C3C8282",
+"N. c #5E5E4F4F8C8C",
+"B. c #56563B3B8B8B",
+"V. c #545407078585",
+"C. c #424234347272",
+"Z. c #9797A4A4F7F7",
+"A. c #444436367676",
+"S. c #7D7D7979D5D5",
+"D. c #464640408A8A",
+"F. c #44444B4B8282",
+"G. c #414107077777",
+"H. c #71716161C1C1",
+"J. c #303039397979",
+"K. c #8E8E8E8EE6E6",
+"L. c #404033338B8B",
+"P. c #4A4A45458C8C",
+"I. c #46463A3A8080",
+"U. c #363629295454",
+"Y. c #303022224848",
+"T. c #424237377575",
+"R. c #2E2E1D1D6363",
+"E. c #79798383EAEA",
+"W. c #74747B7BE4E4",
+"Q. c #6D6D7676D6D6",
+"!. c #6A6A7171CECE",
+"~. c #66666969C6C6",
+"^. c #62626565BCBC",
+"/. c #5F5F6060B5B5",
+"(. c #5B5B5B5BACAC",
+"). c #535353539898",
+"_. c #4F4F4F4FA4A4",
+"`. c #54544D4DA4A4",
+"'. c #323204046B6B",
+"]. c #303035357979",
+"[. c #313122224343",
+"{. c #5A5A5B5BB7B7",
+"}. c #484846468080",
+"|. c #454541417575",
+" X c #4B4B31318282",
+".X c #47473C3C8484",
+"XX c #3E3E35356E6E",
+"oX c #2F2F26264040",
+"OX c #2B2B23233A3A",
+"+X c #262619195C5C",
+"@X c #252515155A5A",
+"#X c #55555151B3B3",
+"$X c #3C3C2D2D5D5D",
+"%X c #39392F2F5656",
+"&X c #37372D2D5050",
+"*X c #25251F1F3030",
+"=X c #24241D1D4343",
+"-X c #202013135656",
+";X c #41413B3B6C6C",
+":X c #444442429696",
+">X c #212100005E5E",
+",X c #444436367272",
+"<X c #444436366F6F",
+"1X c #424236366868",
+"2X c #3F3F34346161",
+"3X c #3C3C32325A5A",
+"4X c #34342A2A4A4A",
+"5X c #21211B1B2121",
+"6X c #22221C1C6363",
+"7X c #2D2D01015E5E",
+"8X c #20201B1B2525",
+"9X c #49492F2F7B7B",
+"0X c #434334346C6C",
+"qX c #323229294545",
+"wX c #1C1C10104F4F",
+"eX c #222217176363",
+"rX c #37371E1E6B6B",
+"tX c #424232326E6E",
+"yX c #444433336969",
+"uX c #424233336565",
+"iX c #1E1E1A1A1E1E",
+"pX c #161601014C4C",
+"aX c #1C1C11115454",
+"sX c #252503035B5B",
+"dX c #414131316A6A",
+"fX c #22221F1F7878",
+"gX c #272724246767",
+"hX c #1D1D16165E5E",
+"jX c #131305055151",
+"kX c #40402F2F6464",
+"lX c #111107074E4E",
+"zX c #0C0C05054B4B",
+"xX c #22221E1E5757",
+"cX c #1A1A0D0D4D4D",
+"vX c #16160B0B4D4D",
+"bX c #060604044747",
+"nX c #040403034343",
+"mX c #3B3B27276565",
+"MX c #0E0E03034141",
+"NX c #111106064A4A",
+"BX c #0E0E04044646",
+"VX c #111105053B3B",
+"CX c #0D0D01013A3A",
+"ZX c #030305053F3F",
+"AX c #0F0F0F0F4C4C",
+"SX c #020207073B3B",
+"DX c #0D0D03034646",
+"FX c #0B0B02023F3F",
+"GX c #0D0D02023434",
+"HX c #0A0A0E0E4444",
+"JX c #161614145252",
+"KX c #0B0B04044646",
+"LX c #0A0A03034444",
+"PX c #1D1D21215757",
+"IX c #090910104040",
+"UX c #18181E1E5353",
+" ",
+" . . . . X X o o o o O + + @ @ @ @ @ @ @ # # # # # # $ $ % % & & & & * = - - - ; : > > , , , ",
+" . . X X < < o o O O + @ 1 2 2 1 1 1 1 1 1 1 1 3 4 # # $ $ $ % % % 5 = = 6 6 - ; ; > > , , 7 ",
+" . 8 < < < o O O + @ @ 2 9 9 0 0 q q q q q q q w 3 4 4 e e $ $ $ $ % 5 = = 6 6 6 ; ; > > r t ",
+" . X < y u O O + @ 1 2 i 0 0 p p p p p p p a a p a s 3 4 4 e e e e d 5 5 f f 6 6 6 ; ; r r t ",
+" X < y u O + + @ 2 9 0 g p p h h h h h h h p h h a a s s j k k j l d d 5 5 f f 6 6 r r r r r ",
+" X < y O z x x 9 0 g c v b n n n n n n n n n n n h a a s s j j m l M d d N f f B B B B r r r ",
+" < y u + z 2 0 c c b V C Z C C A A A A A S S S n h D w w m m m m k l M d d N f F F F B r r r ",
+" < y O z z 9 c b V Z G H H H G S G G J J H V v c g g K K K K L P l l l M M N N N N I B B r r ",
+" U u + z x i v C H Y J J J J H J T R H V E W W Q Q Q Q ! ! ! ~ ^ ^ / / M M M M M N ( B B r r ",
+" ) _ z x 9 g b Z Y ` ' ' ' T T ] [ { } | .........W W Q Q X.! ~ ~ o.O./ / / / N F ( B B B r ",
+" ) ) z x i c V G J ' +.+.+.+.] [ @.#.$.%.%.%.&.*. . .....W =.-.X.;.~ :.o.O.^ >.N F ( B B B B ",
+" ) ,.<.2 g v C H J ' +.+.+.+.T Y 1.2.3.4.4.4.5.6.&.&. . ...W =.=.-.;.~ :.o.7.>.N F F ( B I I ",
+" ) ,.<.8.9.b C H J T +.+.+.' J @.1.0.q.q.w.e.4.5.6.&.r. . .t.W =.=.-.;.~ :.o.7.y.N F ( ( I I ",
+" 8.8.8.9.| u.C G J T +.+.' ` Y @.1.i.0.q.q.e.e.5.6.p.r.a. .t.t.s.d.d.-.;.~ :.7.7.y.F F ( I I ",
+" 9.c c c v b A S H ' f.g.` Y @.h.1.i.j.0.q.q.e.k.6.p.r.a.l.t.z.s.s.d.x.c.v.b.n.m.7.N F F F I ",
+" <.g M.N.B.B.n V.J f.R J @.h.h.1.i.i.j.j.0.q.3.k.6.p.r.a.l.l.z.s.C.d.x.x.c.v.b.n.m.y.N F F F ",
+" + x i v B.Z Z G g.Z.[ @.2.i.i.j.j.j.j.j.0.q.3.k.6.p.p.a.l.l.A.s.C.C.d.x.c.v.b.n.m.7.y.N N y. ",
+" O # 3 w p n Z ` f.S.H D.F.q.0.0.0.0.j.0.q.q.3.k.6.p.r.a.a.l.A.s.s.C.d.x.x.c.v.b.n.m.y.y.y.y. ",
+" O # 4 s a G.V.T Z.H.V J.%.e.w.q.0.0.0.0.q.q.e.k.6.p.r.a.a.l.z.A.s.C.d.d.x.c.v.b.n.m.7.>.y.y. ",
+" O # 4 s w G.A f.K.H L...4.P.w.w.w.q.q.q.q.e.e.5.6.M.I.I.a.a.l.z.A.s.d.d.x.c.v.v.U.Y.7.O.>.y. ",
+" $ # 4 3 s G.G f.S.Z 9.*.D.P.P.w.w.w.w.w.e.e.5.5.M.M.I.I.a.a.l.z.T.s.d.d.x.x.c.v.U.Y.m.R.>.>. ",
+" E.E.W.W.W.W.E.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { )._.`._. ",
+" + # 3 w s '.` f.H.V ].*.D.P.P.P.P.P.P.P.5.5.5.M.M.M.I.I.a.l.z.z.T.T.s.d.d.x.c.v.U.Y.[.^ O.>. ",
+" ~.~.~.~.~.~.K.Z.S.~.{.^.^.^.^.^.^.^.^././././././.(.(.(.(.(.(.{ { { { { ).).).w.w.}.|.P.u.} ",
+" .I.6. X X XT f.H.b ].*.E D.D.D.D.5.5..X.XM.M.I.I.a.a.l.l.z.z.T.T.T.d.XXx.c.v.b.U.oXOXR.+X@X ",
+" E.E.E.W.W.W.K.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { ).).#X_._. ",
+" & % $ e '.= H f.H.b 8.W *.E E E .X.X.XI.I.I.I.a.a.l.l.z.z.T.T.T.C.XXXXc.v.$X%X&XY.*X=X2 @X-X ",
+" {.{.{.{.{.#X~.Z.W.~.{.{./././././././././.(.(.(.(.(.(.(.{ { { { { { ).).).w.w.3.}.;X%.:X} } ",
+" & & % $ e >XV.f.S.C K X.W t. . .l.l.t.t.t.t.A.A.A.,X,X,X,X,X<X;X1X1X2X3X%X&X4XoX*X5Xo.6X-X-X ",
+" & & % $ $ >X7X` Z.Z D ! =.=.s.t.t.t.A.A.s.A.,X,X,X,X<X<X<X<X;X1X2X2X3X%X&X4XoXOX8X5X<.@X-X-X ",
+" 8 & & $ e K 9XJ f.^. XK X.=.=.s.s.s.s.s.C.C.C.C.<X0X0X0X1X1X1X2X2X3X%X&X4XqXOX*X8X=X<.-X-XwX ",
+" 8 & eXK k.@.M. Xg.E.B.rX~ -.d.d.C.C.C.C.C.tX0X0X0XyXyX1X1XuX2X2X3X%X&X4XqXoXOX8XiX6XeX-X-XwX ",
+" 6XQ h.Y N.K e pXB.f./.9Xo.;.-.x.d.tXtXtXtXtX0X0XyXyXyXuXuX2X2X3X%X&X4XqXoXOX*XiX=X_ aX-XaXwX ",
+" Y Y .R.@X% sX= 7XT Z.V P :.;.c.x.x.x.tXdXdXdXyXyXuXuX2X2X3X3X%X&X4XqXoXOX*X8X*XfXaXaXaXwXwX ",
+" gXhX& * & 5 5 sXjXa ] S.9X/ ~ v.c.dXdXdXdXdXuXuXuXkX2X2X3X%X%X&X4XqXoXOX*X8XiX<.hXwXwXaXwXwX ",
+" 8 lXlXjX= * 5 5 = zX9X] H.D 7.b.v.v.kXc.kXkXkXkXkX2X$X3X%X&X&X4XqXoXOX*X8XiXxXhXwXcXcXwXwXwX ",
+" zXzXlXlXjX= = f f sXD Y ] ~.D 7.n.b.v.v.kXkXkXkX$X$X%X%X&X4XqXoXoXOX*X8X5XgXu cXvXvXcXcXwXwX ",
+" bXbXzXlXlX- = * @XX.h.e D T S.D n.m.b.$X$X$X$X$X%X%X&X&X4XqXoXOX*X8X8X*X<.hXvX; ; vXvXvXcXwX ",
+" nXbXzXzXlXlX- -XX.Y R.pXpXP J K.Z mXm.n.U.U.U.U.U.4X4XY.oXOX*X8X8X8X=X,.aXvX; > > > t t t cX ",
+" nXbXbXzXzXlXaXXXY +Xf = f = 7XtXR R mXn.Y.[.[.[.[.OX*X*X8X5X*X=X,.u vXvX; > > MXMX, 7 t t ",
+" nXnXnXbXzXvX-.Y +XcX6 6 = = = d L B.G H `.X.:.7.m.=X=X=X=X=X6X,.u cXvXNX: BX> MXVXCXVX7 7 7 ",
+" ZXZXnXbXAXgX@.+XvX; - - - - * @XR.>.sX>.R.i 0 x eXeXeXeXO hXaXcXvXNX: BXMXMXMXVXCXCXCXVX7 7 ",
+" SXZXZXAXgXN.aXNX: : NXNXNX- * +X+X* 6 6 6 * * * * * * * vXvX- NX: DXBXMXMXFXCXCXCXCXGXVXVX7 ",
+" SXSXHXgX0.JXKXLXKXKXDX: : NX* @X-X- - - - - - - - - - - NX: DXDXDXMXMXFXFXCXCXCXCXGXGXGXVXVX ",
+" SXHXPX3.JXnXnXnXnXbXLXKXKXNXaX-XvX: : NX: : : : : : : BXDXDXLXMXMXFXFXCXCXCXCXGXGXGXGXGXGXGX ",
+" IXUX$.AXZXZXZXZXnXnXnXLXLXNXJXvXBXDXBXBXBXBXDXDXDXDXLXDXLXLXFXFXFXFXCXCXCXCXGXGXGXGXGXGXGXGX ",
+" "};
diff --git a/debug/org.eclipse.cdt.debug.application/icons/alt_window_16.gif b/debug/org.eclipse.cdt.debug.application/icons/alt_window_16.gif Binary files differnew file mode 100644 index 00000000000..05626b17d81 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/icons/alt_window_16.gif diff --git a/debug/org.eclipse.cdt.debug.application/icons/alt_window_32.gif b/debug/org.eclipse.cdt.debug.application/icons/alt_window_32.gif Binary files differnew file mode 100644 index 00000000000..b432f883391 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/icons/alt_window_32.gif diff --git a/debug/org.eclipse.cdt.debug.application/intro-eclipse.png b/debug/org.eclipse.cdt.debug.application/intro-eclipse.png Binary files differnew file mode 100644 index 00000000000..015e7fc6ca4 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/intro-eclipse.png diff --git a/debug/org.eclipse.cdt.debug.application/plugin.properties b/debug/org.eclipse.cdt.debug.application/plugin.properties new file mode 100644 index 00000000000..a46064d1c3e --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/plugin.properties @@ -0,0 +1,39 @@ +################################################################################# +# Copyright (c) 2014 Red Hat, 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: +# Red Hat Incorporated - initial API and implementation +################################################################################# +bundleName=C/C++ Stand-alone Debugger +provider=Eclipse CDT +DwarfSettingEntries.name=Binary Debug Data Entries +FilterMenus.name=Filter Menus +ExitMenu.label=E&xit +WindowMenu.label=&Window +FileMenu.label=&File +HelpMenu.label=&Help +ShowView.label=Show &View +CustomizePerspective.label=Customi&ze Perspective... +ResetPerspective.label=&Reset Perspective... +AboutEclipse.label=&About Eclipse +HelpContents.label=&Help Contents +HelpSearch.label=S&earch +DynamicHelp.label=&Dynamic Help +Preferences.label=&Preferences +DummyUnusedPage.name=Dummy page +DebugNewExecutable.description=Debug a new executable +DebugNewExecutable.name=Debug New Executable +DebugNewExecutableMenu.label=&New Executable... +DebugAttachedExecutable.description=Debug an attached executable +DebugAttachedExecutable.name=Debug Attached Executable +DebugAttachedExecutableMenu.label=&Attach Executable... +DebugCore.description=Debug a corefile +DebugCore.name=Debug Core File +DebugCoreMenu.label=Debug &Core File... +aboutText=Eclipse Stand-alone C/C++ GDB Graphical Debugger\n\nRelease 1.0.0\n +ProductDesc=Eclipse Stand-alone C/C++ GDB Debugger +ProductName=Stand-alone C/C++ GDB Debugger
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/plugin.xml b/debug/org.eclipse.cdt.debug.application/plugin.xml new file mode 100644 index 00000000000..5aab488af59 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/plugin.xml @@ -0,0 +1,250 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + + <extension + id="app" + point="org.eclipse.core.runtime.applications"> + <application + cardinality="singleton-global" + thread="main" + visible="true"> + <run + class="org.eclipse.cdt.debug.application.Application"> + </run> + </application> + </extension> + <extension + point="org.eclipse.cdt.core.LanguageSettingsProvider"> + <provider + class="org.eclipse.cdt.debug.application.GCCCompileOptionsParser" + id="org.eclipse.cdt.debug.application.DwarfLanguageSettingsProvider" + name="%DwarfSettingEntries.name" + prefer-non-shared="true"> + </provider> + </extension> + <extension + point="org.eclipse.ui.propertyPages"> + <page + class="org.eclipse.cdt.debug.application.DummyPage" + id="org.eclipse.cdt.managedbuilder.ui.properties.Page_head_build" + name="%DummyUnusedPage.name"> + <enabledWhen> + <adapt type="org.eclipse.core.resources.IResource"> + <test property="org.eclipse.core.resources.projectNature" + value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"/> + </adapt> + </enabledWhen> + </page> + </extension> + <extension + point="org.eclipse.ui.activities"> + <category + id="org.eclipse.cdt.debug.application.activity.category" + name="%FilterMenus.name"> + </category> + <activity + id="org.eclipse.cdt.debug.application.activity.filterMenus" + name="%FilterMenus.name"> + </activity> + <categoryActivityBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + categoryId="org.eclipse.cdt.debug.application.activity.category"> + </categoryActivityBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + isEqualityPattern="true" + pattern="org.eclipse.cdt.ui/org.eclipse.jdt.ui.refactoring.menu"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + isEqualityPattern="true" + pattern="org.eclipse.cdt.ui/org.eclipse.jdt.ui.source.menu"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + isEqualityPattern="true" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.CodingActionSet"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ExtractConstant"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + isEqualityPattern="true" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ExtractLocalVariable"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.Rename"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.HideMethod"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ExtractMethod"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.createRefactoringScript"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.applyRefactoringScript"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.RefactoringHistory"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ToggleFunction"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.internal.ui.actions.SurroundWithTemplateMenuAction"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + isEqualityPattern="true" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.GettersAndSetters"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ImplementMethod"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.SortLines"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.OrganizeIncludes"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.AddInclude"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.Format"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.Indent"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ShiftLeft"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ShiftRight"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.Uncomment"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.Comment"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.RemoveBlockComment"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.AddBlockComment"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.actions.ToggleComment"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.managedbuilder.ui.properties.BuildLogPreferencePage"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.preferences.BuildSettings"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.ui/org.eclipse.cdt.ui.preferences.OrganizeIncludesPreferencePage"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.team.ui/org.eclipse.team.ui.GenericHistoryView"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.team.ui/org.eclipse.team.sync.views.SynchronizeView"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.team.ui/org.eclipse.team.ui.TeamSynchronizingPerspective"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.team.ui/org.eclipse.team.ui.TeamPreferences"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.ui.ide/org.eclipse.ui.preferencePages.BuildOrder"> + </activityPatternBinding> + <activityPatternBinding + activityId="org.eclipse.cdt.debug.application.activity.filterMenus" + pattern="org.eclipse.cdt.debug.ui/org.eclipse.cdt.debug.ui.command.debugNewExecutable"> + </activityPatternBinding> + </extension> + <extension + point="org.eclipse.ui.commands"> + <command + categoryId="org.eclipse.cdt.debug.ui.category.debugViewLayout" + defaultHandler="org.eclipse.cdt.internal.debug.application.DebugNewExecutableHandler" + description="%DebugNewExecutable.description" + id="org.eclipse.cdt.debug.application.command.debugNewExecutable" + name="%DebugNewExecutable.name"> + </command> + <command + categoryId="org.eclipse.cdt.debug.ui.category.debugViewLayout" + defaultHandler="org.eclipse.cdt.internal.debug.application.DebugAttachedExecutableHandler" + description="%DebugAttachedExecutable.description" + id="org.eclipse.cdt.debug.application.command.debugAttachedExecutable" + name="%DebugAttachedExecutable.name"> + </command> + <command + categoryId="org.eclipse.cdt.debug.ui.category.debugViewLayout" + defaultHandler="org.eclipse.cdt.internal.debug.application.DebugCoreFileHandler" + description="%DebugCore.description" + id="org.eclipse.cdt.debug.application.command.debugCore" + name="%DebugCore.name"> + </command> + </extension> + + <extension + point="org.eclipse.ui.intro"> + <introProductBinding + introId="org.eclipse.ui.intro.universal" + productId="org.eclipse.platform.ide"> + </introProductBinding> + </extension> + <extension + id="product" + point="org.eclipse.core.runtime.products"> + <product + application="org.eclipse.cdt.debug.application.app" + description="%ProductDesc" + name="%ProductName"> + <property name="windowImages" value="eclipse.gif,eclipse32.gif,eclipse48.gif"/> + <property name="aboutImage" value="eclipse_lg.gif"/> + <property name="aboutText" value="%aboutText"/> + + </product> + </extension> + +</plugin> diff --git a/debug/org.eclipse.cdt.debug.application/pom.xml b/debug/org.eclipse.cdt.debug.application/pom.xml new file mode 100644 index 00000000000..beb86631334 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/pom.xml @@ -0,0 +1,17 @@ +<?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>8.4.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + + <version>1.0.0-SNAPSHOT</version> + <artifactId>org.eclipse.cdt.debug.application</artifactId> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/debug/org.eclipse.cdt.debug.application/scripts/README b/debug/org.eclipse.cdt.debug.application/scripts/README new file mode 100644 index 00000000000..29615408067 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/scripts/README @@ -0,0 +1,53 @@ +The CDT Stand-alone Debugger brings up an minimal Eclipse instance which has all that +is needed of the CDT plug-ins to debug a C/C++ executable. Build is not supported. +Editing is allowed, but you will need to rebuild outside the Stand-alone Debugger for +those changes to manifest in your debugging session. + +To install the Stand-alone debugger locally in your $HOME directory, run the install.sh +script directly from the scripts sub-directory of the plugins directory in your +Eclipse installation: + + sh ./install.sh + +The script uses relative directories so you cannot run the script from any other working directory. + +The install script will create a cdtdebugger directory in your $HOME directory. This +directory will contain a config.ini file, a dev.properties file, and a cdtdebug.sh script. +The cdtdebug.sh script will start the debugger from the command-line. It does not +have relative directories so you can move it around as you like. + +The script takes a few options which are mentioned below: + +-data : workspace to use for your Eclipse session if you do not want the default + $HOME/workspace-gdbstandalone + +-consoleLog : if you want error messages reported directly to the command console + +-a : specify attaching to an existing executable on system. A dialog will + be brought up to allow you to select which one. + +-b $PATH : path to build log for an executable. This will be used to figure out + include paths and compilation flags. This option assumes you will + be using the -e option described below. + +-c $CPATH : path to core-file. This option must precede a -e option to specify an + executable. + +-e $PATH [args...] : path to your executable to debug plus any optional command line + arguments to pass to main(). This option must be last and should + not precede any other arguments as they will be treated as arguments + to main. + +If no -a or -e option is specified, the last executable debugged will be offered for +debugging. Otherwise, if this is the first time, a dialog will be presented to enter +an executable, build log, and program arguments. + + e.g. sh ~/cdtdebugger/cdtdebug.sh -b ~/build.log ~/myproject/bin/a.out arg1 arg2 + +The cdtdebug.sh script that is found in the plug-in can also be run directly, but only +in this scripts directory as it uses relative directories to find the Eclipse instance and +the plugins directory. + + e.g. sh ./cdtdebug.sh -b ~/build.log ~/myproject/bin/a.out arg1 arg2 + +
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh new file mode 100755 index 00000000000..a20f1a2cd9a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh @@ -0,0 +1,32 @@ +#!/bin/sh +############################################################################### +# Copyright (c) 2014 Red Hat, 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: +# Red Hat Inc. - initial API and implementation +############################################################################### +if [ ! -d $HOME/cdtdebugger ]; then +mkdir -p $HOME/cdtdebugger +cp config.ini $HOME/cdtdebugger +cp dev.properties $HOME/cdtdebugger +fi +pushd ../.. >/dev/null +OSGI_JAR=`ls org.eclipse.osgi_*.jar` +SWT_JAR=`ls org.eclipse.swt.*.jar` +SWT_PLUGIN=`echo $SWT_JAR | sed -e "s/_[0-9]*\..*.jar//"` +FS_JAR=`ls org.eclipse.core.filesystem.*.jar` +FS_PLUGIN=`echo $FS_JAR | sed -e "s/_[0-9]*\..*.jar//"` +LINUX_JAR=`ls org.eclipse.cdt.core.linux.*.jar` +LINUX_PLUGIN=`echo $LINUX_JAR | sed -e "s/_[0-9]*\..*.jar//"` +cd ..; ECLIPSE_HOME=`pwd` +popd >/dev/null +$ECLIPSE_HOME/eclipse -clean -product org.eclipse.cdt.debug.application.product \ +-data $HOME/workspace-gdbstandlone -configuration file\:$HOME/cdtdebugger \ +-dev file\:$HOME/cdtdebugger/dev.properties $@ \ +-vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \ +-Dlinux.plugin=$LINUX_PLUGIN -Declipse.home=$ECLIPSE_HOME + diff --git a/debug/org.eclipse.cdt.debug.application/scripts/config.ini b/debug/org.eclipse.cdt.debug.application/scripts/config.ini new file mode 100644 index 00000000000..f3c575d1c4f --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/scripts/config.ini @@ -0,0 +1,7 @@ +#Configuration File +#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.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.core.runtime.compatibility.auth,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.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.eclipse.core.runtime.compatibility.registry,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 +osgi.configuration.cascaded=false +osgi.bundles.defaultStartLevel=4 diff --git a/debug/org.eclipse.cdt.debug.application/scripts/dev.properties b/debug/org.eclipse.cdt.debug.application/scripts/dev.properties new file mode 100644 index 00000000000..40ed577ba02 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/scripts/dev.properties @@ -0,0 +1,3 @@ +# +#Fri Dec 20 17:22:35 EST 2013 +@ignoredot@=true diff --git a/debug/org.eclipse.cdt.debug.application/scripts/install.sh b/debug/org.eclipse.cdt.debug.application/scripts/install.sh new file mode 100755 index 00000000000..d67df88789c --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/scripts/install.sh @@ -0,0 +1,23 @@ +#!/bin/sh +############################################################################### +# Copyright (c) 2014 Red Hat, 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: +# Red Hat Inc. - initial API and implementation +############################################################################### +if [ ! -d $HOME/cdtdebugger ]; then +mkdir -p $HOME/cdtdebugger +fi +cp config.ini $HOME/cdtdebugger +cp dev.properties $HOME/cdtdebugger +cp cdtdebug.sh $HOME/cdtdebugger +chmod +x $HOME/cdtdebugger/cdtdebug.sh +pushd ../.. >/dev/null +PLUGINS_DIR=`pwd` +popd >/dev/null +sed -i -e "s,pushd ../..,pushd $PLUGINS_DIR," $HOME/cdtdebugger/cdtdebug.sh +echo "Installation complete"
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Activator.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Activator.java new file mode 100644 index 00000000000..d1b3a9eeecf --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Activator.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "GDBStandalone"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Application.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Application.java new file mode 100644 index 00000000000..327e385ff16 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Application.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; + +/** + * This class controls all aspects of the application's execution + */ +public class Application implements IApplication { + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) + */ + @Override + public Object start(IApplicationContext context) throws Exception { + Display display = PlatformUI.createDisplay(); + try { + int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); + if (returnCode == PlatformUI.RETURN_RESTART) + return IApplication.EXIT_RESTART; + else + return IApplication.EXIT_OK; + } finally { + display.dispose(); + } + + } + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#stop() + */ + @Override + public void stop() { + if (!PlatformUI.isWorkbenchRunning()) + return; + final IWorkbench workbench = PlatformUI.getWorkbench(); + final Display display = workbench.getDisplay(); + display.syncExec(new Runnable() { + @Override + public void run() { + if (!display.isDisposed()) + workbench.close(); + } + }); + } +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationActionBarAdvisor.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationActionBarAdvisor.java new file mode 100644 index 00000000000..3d6d2a7e342 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationActionBarAdvisor.java @@ -0,0 +1,442 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.util.Util; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; +import org.eclipse.ui.actions.ContributionItemFactory; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.ide.IDEActionFactory; +import org.eclipse.ui.internal.IWorkbenchHelpContextIds; +import org.eclipse.ui.internal.actions.CommandAction; +import org.eclipse.ui.internal.handlers.IActionCommandMappingService; +import org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages; +import org.eclipse.ui.menus.CommandContributionItem; +import org.eclipse.ui.menus.CommandContributionItemParameter; + +@SuppressWarnings("restriction") +public class ApplicationActionBarAdvisor extends ActionBarAdvisor { + + public static String COREFILE_COMMAND_ID = "org.eclipse.cdt.debug.application.command.debugCore"; //$NON-NLS-1$ + public static String NEW_EXECUTABLE_COMMAND_ID = "org.eclipse.cdt.debug.application.command.debugNewExecutable"; //$NON-NLS-1$ + public static String ATTACH_EXECUTABLE_COMMAND_ID = "org.eclipse.cdt.debug.application.command.debugAttachedExecutable"; //$NON-NLS-1$ + + private final IWorkbenchWindow window; + + private IWorkbenchAction corefileAction; + private IWorkbenchAction newExecutableAction; + private IWorkbenchAction attachExecutableAction; + private IWorkbenchAction quitAction; + + private IWorkbenchAction openPreferencesAction; + private IWorkbenchAction editActionSetAction; + + private IWorkbenchAction helpContentsAction; + private IWorkbenchAction helpSearchAction; + private IWorkbenchAction dynamicHelpAction; + private IWorkbenchAction aboutAction; + + private IWorkbenchAction undoAction; + private IWorkbenchAction redoAction; + + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + window = configurer.getWindowConfigurer().getWindow(); + } + + /** + * Returns the window to which this action builder is contributing. + */ + private IWorkbenchWindow getWindow() { + return window; + } + + @Override + protected void makeActions(IWorkbenchWindow window) { + quitAction = ActionFactory.QUIT.create(window); + register(quitAction); + + newExecutableAction = NEW_EXECUTABLE.create(window); + register(newExecutableAction); + + attachExecutableAction = ATTACH_EXECUTABLE.create(window); + register(attachExecutableAction); + + corefileAction = COREFILE.create(window); + register(corefileAction); + + editActionSetAction = ActionFactory.EDIT_ACTION_SETS + .create(window); + register(editActionSetAction); + + helpContentsAction = ActionFactory.HELP_CONTENTS.create(window); + register(helpContentsAction); + + helpSearchAction = ActionFactory.HELP_SEARCH.create(window); + register(helpSearchAction); + + dynamicHelpAction = ActionFactory.DYNAMIC_HELP.create(window); + register(dynamicHelpAction); + + undoAction = ActionFactory.UNDO.create(window); + register(undoAction); + + redoAction = ActionFactory.REDO.create(window); + register(redoAction); + + aboutAction = ActionFactory.ABOUT.create(window); + aboutAction + .setImageDescriptor(IDEInternalWorkbenchImages + .getImageDescriptor(IDEInternalWorkbenchImages.IMG_OBJS_DEFAULT_PROD)); + register(aboutAction); + + openPreferencesAction = ActionFactory.PREFERENCES.create(window); + register(openPreferencesAction); + } + + @Override + protected void fillMenuBar(IMenuManager menuBar) { + menuBar.add(createFileMenu()); + menuBar.add(createEditMenu()); + menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + menuBar.add(createWindowMenu()); + menuBar.add(createHelpMenu()); + } + + /** + * Creates and returns the File menu. + */ + private MenuManager createFileMenu() { + MenuManager menu = new MenuManager(Messages.FileMenuName, IWorkbenchActionConstants.M_FILE); + menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); + + ActionContributionItem newExecutableItem = new ActionContributionItem(newExecutableAction); + menu.add(newExecutableItem); + + ActionContributionItem attachExecutableItem = new ActionContributionItem(attachExecutableAction); + menu.add(attachExecutableItem); + + ActionContributionItem corefileItem = new ActionContributionItem(corefileAction); + menu.add(corefileItem); + + menu.add(new Separator()); + + // If we're on OS X we shouldn't show this command in the File menu. It + // should be invisible to the user. However, we should not remove it - + // the carbon UI code will do a search through our menu structure + // looking for it when Cmd-Q is invoked (or Quit is chosen from the + // application menu. + ActionContributionItem quitItem = new ActionContributionItem(quitAction); + quitItem.setVisible(!Util.isMac()); + menu.add(quitItem); + menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); + return menu; + } + + /** + * Creates and returns the Edit menu. + */ + private MenuManager createEditMenu() { + MenuManager menu = new MenuManager(Messages.EditMenuName, IWorkbenchActionConstants.M_EDIT); + menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); + + menu.add(undoAction); + menu.add(redoAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); + menu.add(new Separator()); + + menu.add(getCutItem()); + menu.add(getCopyItem()); + menu.add(getPasteItem()); + menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); + menu.add(new Separator()); + + menu.add(getDeleteItem()); + menu.add(getSelectAllItem()); + menu.add(new Separator()); + + menu.add(getFindItem()); + menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); + menu.add(new Separator()); + + menu.add(getBookmarkItem()); + menu.add(getTaskItem()); + menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT)); + + menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); + menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + return menu; + } + + /** + * Creates and returns the Window menu. + */ + private MenuManager createWindowMenu() { + MenuManager menu = new MenuManager( + Messages.WindowMenuName, IWorkbenchActionConstants.M_WINDOW); + + + addPerspectiveActions(menu); + Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS); + sep.setVisible(!Util.isMac()); + menu.add(sep); + + // See the comment for quit in createFileMenu + ActionContributionItem openPreferencesItem = new ActionContributionItem(openPreferencesAction); + openPreferencesItem.setVisible(!Util.isMac()); + menu.add(openPreferencesItem); + + menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow())); + return menu; + } + + /** + * Creates and returns the Help menu. + */ + private MenuManager createHelpMenu() { + MenuManager menu = new MenuManager(Messages.HelpMenuName, IWorkbenchActionConstants.M_HELP); + menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$ + menu.add(new GroupMarker("group.main")); //$NON-NLS-1$ + menu.add(helpContentsAction); + menu.add(helpSearchAction); + menu.add(dynamicHelpAction); + menu.add(new GroupMarker("group.assist")); //$NON-NLS-1$ + // HELP_START should really be the first item, but it was after + // quickStartAction and tipsAndTricksAction in 2.1. + menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START)); + menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$ + menu.add(new GroupMarker("group.tutorials")); //$NON-NLS-1$ + menu.add(new GroupMarker("group.tools")); //$NON-NLS-1$ + menu.add(new GroupMarker("group.updates")); //$NON-NLS-1$ + menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END)); + menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + // about should always be at the bottom + menu.add(new Separator("group.about")); //$NON-NLS-1$ + + ActionContributionItem aboutItem = new ActionContributionItem(aboutAction); + aboutItem.setVisible(!Util.isMac()); + menu.add(aboutItem); + menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$ + return menu; + } + /** + * Adds the perspective actions to the specified menu. + */ + private void addPerspectiveActions(MenuManager menu) { + { + MenuManager showViewMenuMgr = new MenuManager(Messages.ShowViewMenuName, "showView"); //$NON-NLS-1$ + IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST + .create(getWindow()); + showViewMenuMgr.add(showViewMenu); + menu.add(showViewMenuMgr); + } + menu.add(new Separator()); + menu.add(editActionSetAction); + menu.add(getResetPerspectiveItem()); + } + + private IContributionItem getItem(String actionId, String commandId, + String image, String disabledImage, String label, String tooltip, String helpContextId) { + ISharedImages sharedImages = getWindow().getWorkbench() + .getSharedImages(); + + IActionCommandMappingService acms = (IActionCommandMappingService) getWindow() + .getService(IActionCommandMappingService.class); + acms.map(actionId, commandId); + + CommandContributionItemParameter commandParm = new CommandContributionItemParameter( + getWindow(), actionId, commandId, null, sharedImages + .getImageDescriptor(image), sharedImages + .getImageDescriptor(disabledImage), null, label, null, + tooltip, CommandContributionItem.STYLE_PUSH, null, false); + return new CommandContributionItem(commandParm); + } + + private IContributionItem getResetPerspectiveItem() { + return getItem( + ActionFactory.RESET_PERSPECTIVE.getId(), + ActionFactory.RESET_PERSPECTIVE.getCommandId(), + null, + null, + Messages.ResetPerspective_text, + Messages.ResetPerspective_toolTip, + IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION); + } + + private IContributionItem getCutItem() { + return getItem( + ActionFactory.CUT.getId(), + ActionFactory.CUT.getCommandId(), + ISharedImages.IMG_TOOL_CUT, + ISharedImages.IMG_TOOL_CUT_DISABLED, + Messages.Workbench_cut, + Messages.Workbench_cutToolTip, null); + } + + private IContributionItem getCopyItem() { + return getItem( + ActionFactory.COPY.getId(), + ActionFactory.COPY.getCommandId(), + ISharedImages.IMG_TOOL_COPY, + ISharedImages.IMG_TOOL_COPY_DISABLED, + Messages.Workbench_copy, + Messages.Workbench_copyToolTip, null); + } + + private IContributionItem getPasteItem() { + return getItem( + ActionFactory.PASTE.getId(), + ActionFactory.PASTE.getCommandId(), + ISharedImages.IMG_TOOL_PASTE, + ISharedImages.IMG_TOOL_PASTE_DISABLED, + Messages.Workbench_paste, + Messages.Workbench_pasteToolTip, null); + } + + + private IContributionItem getSelectAllItem() { + return getItem( + ActionFactory.SELECT_ALL.getId(), + ActionFactory.SELECT_ALL.getCommandId(), + null, null, Messages.Workbench_selectAll, + Messages.Workbench_selectAllToolTip, null); + } + + private IContributionItem getFindItem() { + return getItem( + ActionFactory.FIND.getId(), + ActionFactory.FIND.getCommandId(), + null, null, Messages.Workbench_findReplace, + Messages.Workbench_findReplaceToolTip, null); + } + + private IContributionItem getBookmarkItem() { + return getItem( + IDEActionFactory.BOOKMARK.getId(), + IDEActionFactory.BOOKMARK.getCommandId(), + null, null, Messages.Workbench_addBookmark, + Messages.Workbench_addBookmarkToolTip, null); + } + + private IContributionItem getTaskItem() { + return getItem( + IDEActionFactory.ADD_TASK.getId(), + IDEActionFactory.ADD_TASK.getCommandId(), + null, null, Messages.Workbench_addTask, + Messages.Workbench_addTaskToolTip, null); + } + + private IContributionItem getDeleteItem() { + return getItem(ActionFactory.DELETE.getId(), + ActionFactory.DELETE.getCommandId(), + ISharedImages.IMG_TOOL_DELETE, + ISharedImages.IMG_TOOL_DELETE_DISABLED, + Messages.Workbench_delete, + Messages.Workbench_deleteToolTip, + IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION); + } + + private static class WorkbenchCommandAction extends CommandAction implements + IWorkbenchAction { + /** + * @param commandIdIn + * @param window + */ + public WorkbenchCommandAction(String commandIdIn, + IWorkbenchWindow window) { + super(window, commandIdIn); + } + } + + /** + * Workbench action (id: "corefile", commandId: "org.eclipse.cdt.debug.application.command.debugCore"): + * Debug an executable with a core file. This action maintains its enablement state. + */ + private static final ActionFactory COREFILE = new ActionFactory("corefile", //$NON-NLS-1$ + COREFILE_COMMAND_ID) { + + /* (non-Javadoc) + * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow) + */ + @Override + public IWorkbenchAction create(IWorkbenchWindow window) { + if (window == null) { + throw new IllegalArgumentException(); + } + WorkbenchCommandAction action = new WorkbenchCommandAction( + getCommandId(), window); + action.setId(getId()); + action.setText(Messages.CoreFileMenuName); + action.setToolTipText(Messages.CoreFile_toolTip); + return action; + } + }; + + /** + * Workbench action (id: "newexecutable", commandId: "org.eclipse.cdt.debug.application.command.debugNewExecutable"): + * Debug an executable. This action maintains its enablement state. + */ + private static final ActionFactory NEW_EXECUTABLE = new ActionFactory("newexecutable", //$NON-NLS-1$ + NEW_EXECUTABLE_COMMAND_ID) { + + /* (non-Javadoc) + * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow) + */ + @Override + public IWorkbenchAction create(IWorkbenchWindow window) { + if (window == null) { + throw new IllegalArgumentException(); + } + WorkbenchCommandAction action = new WorkbenchCommandAction( + getCommandId(), window); + action.setId(getId()); + action.setText(Messages.NewExecutableMenuName); + action.setToolTipText(Messages.NewExecutable_toolTip); + return action; + } + }; + + /** + * Workbench action (id: "attachexecutable", commandId: "org.eclipse.cdt.debug.application.command.debugAttachedExecutable"): + * Attach and debug an existing executable. This action maintains its enablement state. + */ + private static final ActionFactory ATTACH_EXECUTABLE = new ActionFactory("attachexecutable", //$NON-NLS-1$ + ATTACH_EXECUTABLE_COMMAND_ID) { + + /* (non-Javadoc) + * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow) + */ + @Override + public IWorkbenchAction create(IWorkbenchWindow window) { + if (window == null) { + throw new IllegalArgumentException(); + } + WorkbenchCommandAction action = new WorkbenchCommandAction( + getCommandId(), window); + action.setId(getId()); + action.setText(Messages.AttachedExecutableMenuName); + action.setToolTipText(Messages.AttachedExecutable_toolTip); + return action; + } + }; + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchAdvisor.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchAdvisor.java new file mode 100644 index 00000000000..78c8b83221f --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchAdvisor.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { + + private static final String PERSPECTIVE_ID = "org.eclipse.debug.ui.DebugPerspective"; //$NON-NLS-1$ + + @Override + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + return new ApplicationWorkbenchWindowAdvisor(configurer); + } + + @Override + public String getInitialWindowPerspectiveId() { + return PERSPECTIVE_ID; + } +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchWindowAdvisor.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchWindowAdvisor.java new file mode 100644 index 00000000000..0c94e45ea69 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ApplicationWorkbenchWindowAdvisor.java @@ -0,0 +1,418 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import java.io.File; +import java.io.FileNotFoundException; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.internal.debug.application.DebugAttachedExecutable; +import org.eclipse.cdt.internal.debug.application.DebugCoreFile; +import org.eclipse.cdt.internal.debug.application.DebugExecutable; +import org.eclipse.cdt.internal.debug.application.JobContainer; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.QualifiedName; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + + private static final String STANDALONE_QUALIFIER = "org.eclipse.cdt.debug.application"; //$NON-NLS-1$ + private static final String LAST_LAUNCH = "lastLaunch"; //$NON-NLS-1$ + private ILaunchConfiguration config; + + private class StartupException extends FileNotFoundException { + /** + * + */ + private static final long serialVersionUID = 1L; + + public StartupException(String s) { + super(); + } + } + + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + @Override + public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + @Override + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); +// configurer.setInitialSize(new Point(400, 300)); + configurer.setShowCoolBar(true); + configurer.setShowStatusLine(true); + configurer.setShowMenuBar(true); + configurer.setShowProgressIndicator(true); + configurer.setTitle(Messages.Debugger_Title); + } + +// private class CWDTracker implements IWorkingDirectoryTracker { +// +// @Override +// public URI getWorkingDirectoryURI() { +// return null; +// } +// +// } + + + + @Override + public void postWindowCreate() { + super.postWindowCreate(); + try { + IRunnableWithProgress op = new PostWindowCreateRunnable(); + new ProgressMonitorDialog(getWindowConfigurer().getWindow().getShell()).run(true, true, op); + } catch (InvocationTargetException e) { + // handle exception + } catch (InterruptedException e) { + // handle cancelation + } + } + + public class PostWindowCreateRunnable implements IRunnableWithProgress { + + @Override + public void run(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + monitor.beginTask(Messages.InitializingDebugger, 10); + boolean attachExecutable = false; + String executable = null; + String corefile = null; + String buildLog = null; + String arguments = null; + String[] args = Platform.getCommandLineArgs(); +// System.out.println("program args length is " + args.length); + try { + for (int i = 0; i < args.length; ++i) { +// System.out.println("arg <" + i + "> is " + args[i]); + if ("-application".equals(args[i])) + i++; // ignore the application specifier + else if ("-product".equals(args[i])) + i++; // ignore the product specifier + else if ("-b".equals(args[i])) { + ++i; + if (i < args.length) + buildLog = args[i]; + } + else if ("-a".equals(args[i])) { + attachExecutable = true; + } + else if ("-c".equals(args[i])) { + ++i; + corefile = ""; + executable = ""; + if (i < args.length) + corefile = args[i]; + } + else if ("-e".equals(args[i])) { + ++i; + if (i < args.length) + executable = args[i]; + ++i; + StringBuffer argBuffer = new StringBuffer(); + // Remaining values are arguments to the executable + if (i < args.length) + argBuffer.append(args[i++]); + while (i < args.length) { + argBuffer.append(" "); + argBuffer.append(args[i++]); + } + arguments = argBuffer.toString(); + } + } + // Verify any core file or executable path is valid. + if (corefile != null) { + File executableFile = new File(executable); + File coreFile = new File(corefile); + if (!executableFile.exists() || !coreFile.exists()) { + final CoreFileInfo info = new CoreFileInfo("", "", ""); //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ + final IStatus errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, + Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist, null); + final String executablePath = executable; + final String coreFilePath = buildLog; + + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + + CoreFileDialog dialog = new CoreFileDialog(getWindowConfigurer().getWindow().getShell(), + 0, executablePath, coreFilePath); + dialog.setBlockOnOpen(true); + if (dialog.open() == IDialogConstants.OK_ID) { + CoreFileInfo info2 = dialog.getCoreFileInfo(); + info.setHostPath(info2.getHostPath()); + info.setCoreFilePath(info2.getCoreFilePath()); + } else { + ErrorDialog.openError(null, + Messages.DebuggerInitializingProblem, null, errorStatus, + IStatus.ERROR | IStatus.WARNING); + } + } + }); + // Check and see if we failed above and if so, quit + if (info.getHostPath().equals("")) { + monitor.done(); + // throw internal exception which will be caught below + throw new StartupException(errorStatus.getMessage()); + } + executable = info.getHostPath(); + corefile = info.getCoreFilePath(); + } + } else if (executable != null) { + File executableFile = new File(executable); + if (!executableFile.exists()) { + final NewExecutableInfo info = new NewExecutableInfo("", "", "", ""); //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ + final IStatus errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, + Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist, null); + final String executablePath = executable; + final String executableArgs = arguments; + final String buildLogPath = buildLog; + + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + + NewExecutableDialog dialog = new NewExecutableDialog(getWindowConfigurer().getWindow().getShell(), + 0, executablePath, buildLogPath, executableArgs); + dialog.setBlockOnOpen(true); + if (dialog.open() == IDialogConstants.OK_ID) { + NewExecutableInfo info2 = dialog.getExecutableInfo(); + info.setHostPath(info2.getHostPath()); + info.setArguments(info2.getArguments()); + } else { + ErrorDialog.openError(null, + Messages.DebuggerInitializingProblem, null, errorStatus, + IStatus.ERROR | IStatus.WARNING); + } + } + }); + // Check and see if we failed above and if so, quit + if (info.getHostPath().equals("")) { + monitor.done(); + // throw internal exception which will be caught below + throw new StartupException(errorStatus.getMessage()); + } + executable = info.getHostPath(); + arguments = info.getArguments(); + } + } + monitor.worked(1); + if (attachExecutable) { + config = DebugAttachedExecutable.createLaunchConfig(monitor, buildLog); + } else if (corefile != null && corefile.length() > 0) { + config = DebugCoreFile.createLaunchConfig(monitor, buildLog, executable, corefile); + } else if (executable != null && executable.length() > 0) { + config = DebugExecutable.importAndCreateLaunchConfig(monitor, executable, buildLog, arguments); + } else { + // No executable specified, look for last launch + // and offer that to the end-user. + monitor.subTask(Messages.RestorePreviousLaunch); + String memento = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(new QualifiedName(STANDALONE_QUALIFIER, LAST_LAUNCH)); + if (memento != null) + config = DebugExecutable.getLaunchManager().getLaunchConfiguration(memento); + String oldExecutable = ""; + String oldArguments = ""; + String oldBuildLog = ""; + if (config != null) { + oldExecutable = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$ + oldArguments = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$ + oldBuildLog = config.getAttribute(ICDTStandaloneDebugLaunchConstants.BUILD_LOG_LOCATION, ""); //$NON-NLS-1$ + } + final NewExecutableInfo info = new NewExecutableInfo("", "", "", ""); //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ + final IStatus errorStatus = new Status(IStatus.WARNING, Activator.PLUGIN_ID, 0, + Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist, null); + final String executablePath = oldExecutable; + final String executableArgs = oldArguments; + final String buildLogPath = oldBuildLog; + // Bring up New Executable dialog with values from + // the last launch. + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + + NewExecutableDialog dialog = new NewExecutableDialog(getWindowConfigurer().getWindow().getShell(), + 0, executablePath, buildLogPath, executableArgs); + dialog.setBlockOnOpen(true); + if (dialog.open() == IDialogConstants.OK_ID) { + NewExecutableInfo info2 = dialog.getExecutableInfo(); + info.setHostPath(info2.getHostPath()); + info.setArguments(info2.getArguments()); + info.setBuildLog(info2.getBuildLog()); + } else { + ErrorDialog.openError(null, + Messages.DebuggerInitializingProblem, null, errorStatus, + IStatus.ERROR | IStatus.WARNING); + } + } + }); + // Check and see if we failed above and if so, quit + if (info.getHostPath().equals("")) { + monitor.done(); + // throw internal exception which will be caught below + throw new StartupException(errorStatus.getMessage()); + } + executable = info.getHostPath(); + arguments = info.getArguments(); + buildLog = info.getBuildLog(); + // If no last configuration or user has changed + // the executable, we need to create a new configuration + // and remove artifacts from the old one. + if (config == null || !executable.equals(oldExecutable)) + config = DebugExecutable.importAndCreateLaunchConfig(monitor, executable, buildLog, arguments); + ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); + wc.setAttribute(ICDTStandaloneDebugLaunchConstants.BUILD_LOG_LOCATION, + buildLog); + if (arguments != null) + wc.setAttribute( + ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, + arguments); + config = wc.doSave(); + + monitor.worked(7); + } + if (config != null) { +// System.out.println("about to add job change listener"); + final JobContainer LaunchJobs = new JobContainer(); + Job.getJobManager().addJobChangeListener(new JobChangeAdapter() { + + @Override + public void scheduled(IJobChangeEvent event) { + Job job = event.getJob(); +// System.out.println("Job name is " + job.getName()); + if (job.getName().contains(config.getName())) + LaunchJobs.setLaunchJob(job); + } + + @Override + public void done(IJobChangeEvent event) { +// System.out.println("Job " + event.getJob().getName() + " is done"); + } + }); + monitor.subTask(Messages.LaunchingConfig); + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); +// System.out.println("about to join " + LaunchJobs.getLaunchJob()); + } + }); + if (LaunchJobs.getLaunchJob() != null) { + try { + LaunchJobs.getLaunchJob().join(); + } catch (InterruptedException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, + Messages.LaunchInterruptedError, e); + ResourcesPlugin.getPlugin().getLog().log(status); + } + } + } +// System.out.println("end"); + } catch (InterruptedException e) { +// System.out.println("Interrupted exception"); + throw e; // rethrow exception + } catch (CoreException e) { +// System.out.println("Core Exception"); + e.printStackTrace(); + } catch (StartupException e) { + // do nothing..just quit + } catch (Exception e) { +// System.out.println("Exception"); + e.printStackTrace(); + } finally { +// System.out.println("Finally"); + monitor.done(); + } + } + + } + + @Override + public void postWindowClose() { + super.postWindowClose(); + if (ResourcesPlugin.getWorkspace() != null) + disconnectFromWorkspace(); + } + + private void disconnectFromWorkspace() { + + // save the workspace + final MultiStatus status = new MultiStatus( + Activator.PLUGIN_ID, 1, + Messages.ProblemSavingWorkbench, null); + try { + final ProgressMonitorDialog p = new ProgressMonitorDialog( + null); + IRunnableWithProgress runnable = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) { + try { + status.merge(ResourcesPlugin + .getWorkspace().save(true, monitor)); + } catch (CoreException e) { + status.merge(e.getStatus()); + } + } + }; + p.run(true, false, runnable); + } catch (InvocationTargetException e) { + status.merge(new Status(IStatus.ERROR, + Activator.PLUGIN_ID, 1, + Messages.InternalError, + e.getTargetException())); + } catch (InterruptedException e) { + status.merge(new Status(IStatus.ERROR, + Activator.PLUGIN_ID, 1, + Messages.InternalError, e)); + } + + ErrorDialog.openError(null, + Messages.ProblemsSavingWorkspace, null, status, + IStatus.ERROR | IStatus.WARNING); + + if (!status.isOK()) { + ResourcesPlugin.getPlugin().getLog().log(status); + } + + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/CoreFileDialog.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/CoreFileDialog.java new file mode 100644 index 00000000000..3cfc916b132 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/CoreFileDialog.java @@ -0,0 +1,226 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 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 + * Red Hat Inc. - modified for use in Standalone Debugger + *******************************************************************************/ + +package org.eclipse.cdt.debug.application; + +import java.io.File; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.resource.JFaceResources; +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.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class CoreFileDialog extends TitleAreaDialog { + + public static final int REMOTE = 0x1; + + private int fFlags = 0; + private CoreFileInfo fInfo = null; + + private Text fHostBinaryText; + private Text fTargetBinaryText; + private Text fCoreFileText; + + private final String fHostBinary; + private final String fCoreFile; + + public CoreFileDialog (Shell parentShell) { + this(parentShell, 0); + } + + public CoreFileDialog( Shell parentShell, int flags ) { + this(parentShell, flags, null, null); + } + + public CoreFileDialog( Shell parentShell, int flags, String hostBinary, String coreFile) { + super( parentShell ); + setShellStyle( getShellStyle() | SWT.RESIZE ); + fFlags = flags; + fHostBinary = hostBinary; + fCoreFile = coreFile; + } + + @Override + protected Control createContents( Composite parent ) { + Control control = super.createContents( parent ); + validate(); + return control; + } + + @Override + protected Control createDialogArea( Composite parent ) { + boolean remote = (fFlags & REMOTE) > 0; + + getShell().setText( Messages.GdbDebugCoreFileCommand_Debug_Core_File ); + setTitle( Messages.GdbDebugNewExecutableCommand_Select_Binary ); + String message = ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target : + Messages.GdbDebugCoreFileCommand_Select_binary_and_specify_corefile; + setMessage( message ); + + Composite control = (Composite)super.createDialogArea( parent ); + Composite comp = new Composite( control, SWT.NONE ); + GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true ); + GridLayout layout = new GridLayout( 3, false ); + comp.setLayout( layout ); + comp.setLayoutData( gd ); + + new Label( comp, SWT.None ).setText( remote ? Messages.GdbDebugNewExecutableCommand_Binary_on_host : Messages.GdbDebugNewExecutableCommand_Binary ); + fHostBinaryText = new Text( comp, SWT.BORDER ); + if (fHostBinary != null) + fHostBinaryText.setText(fHostBinary); + fHostBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) ); + fHostBinaryText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + Button browseButton = new Button( comp, SWT.PUSH ); + browseButton.setText( Messages.GdbDebugNewExecutableCommand_Browse ); + browseButton.setFont( JFaceResources.getDialogFont() ); + setButtonLayoutData( browseButton ); + browseButton.addSelectionListener( new SelectionAdapter() { + + @Override + public void widgetSelected( SelectionEvent e ) { + FileDialog dialog = new FileDialog( getShell() ); + dialog.setFileName( fHostBinaryText.getText() ); + String result = dialog.open(); + if ( result != null ) { + fHostBinaryText.setText( result ); + } + } + } ); + + if ( remote ) { + new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Binary_on_target ); + fTargetBinaryText = new Text( comp, SWT.BORDER ); + fTargetBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); + fTargetBinaryText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + } + + + new Label( comp, SWT.None ).setText( Messages.GdbDebugCoreFileCommand_CoreFile ); + fCoreFileText = new Text( comp, SWT.BORDER ); + if (fCoreFile != null) + fCoreFileText.setText(fCoreFile); + fCoreFileText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) ); + fCoreFileText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + + Button browseButton2 = new Button( comp, SWT.PUSH ); + browseButton2.setText( Messages.GdbDebugNewExecutableCommand_Browse ); + browseButton2.setFont( JFaceResources.getDialogFont() ); + setButtonLayoutData( browseButton2 ); + browseButton2.addSelectionListener( new SelectionAdapter() { + + @Override + public void widgetSelected( SelectionEvent e ) { + FileDialog dialog = new FileDialog( getShell() ); + dialog.setFileName( fCoreFileText.getText() ); + String result = dialog.open(); + if ( result != null ) { + fCoreFileText.setText( result ); + } + } + } ); + + return control; + } + + @Override + protected void okPressed() { + String targetPath = ( fTargetBinaryText != null ) ? fTargetBinaryText.getText().trim() : null; + String coreFile = fCoreFileText.getText().trim(); + fInfo = new CoreFileInfo( fHostBinaryText.getText().trim(), targetPath, coreFile ); + super.okPressed(); + } + + public CoreFileInfo getCoreFileInfo() { + return fInfo; + } + + private void validate() { + boolean remote = (fFlags & REMOTE) > 0; + StringBuilder sb = new StringBuilder(); + String hostBinary = fHostBinaryText.getText().trim(); + String corefile = fCoreFileText.getText(); + if ( hostBinary.isEmpty() ) { + sb.append( ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified : + Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified ); + } + else { + File file = new File( hostBinary ); + if ( !file.exists() ) { + sb.append( ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist : + Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist ); + } + else if ( file.isDirectory() ) { + sb.append( ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Invalid_host_binary : + Messages.GdbDebugNewExecutableCommand_Invalid_binary ); + } + } + if ( sb.length() == 0 && corefile.isEmpty() ) { + sb.append( ( remote ) ? + Messages.GdbDebugCoreFileCommand_Core_file_must_be_specified : + Messages.GdbDebugCoreFileCommand_Core_file_must_be_specified ); + } + else if (sb.length() == 0 && !corefile.isEmpty()) { + File file = new File( corefile ); + if ( !file.exists() ) { + sb.append( Messages.GdbDebugCoreFileCommand_Core_file_does_not_exist ); + } + else if ( file.isDirectory() ) { + sb.append( Messages.GdbDebugCoreFileCommand_Invalid_core_file ); + } + } + if (sb.length() == 0 && fTargetBinaryText != null) { + if ( fTargetBinaryText.getText().trim().length() == 0 ) { + if ( sb.length() != 0 ) { + sb.append( "\n " ); //$NON-NLS-1$ + } + sb.append( Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified ); + } + } + setErrorMessage( ( sb.length() != 0 ) ? sb.toString() : null ); + getButton( IDialogConstants.OK_ID ).setEnabled( getErrorMessage() == null ); + } +}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/CoreFileInfo.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/CoreFileInfo.java new file mode 100644 index 00000000000..2731d52677a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/CoreFileInfo.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 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 + * Red Hat Inc. - modified for use in Standalone Debugger + *******************************************************************************/ + +package org.eclipse.cdt.debug.application; + +/** + * This class provides information required to start + * debugging an executable. + */ +public class CoreFileInfo { + private String fHostPath; + private String fTargetPath; + private String fCoreFilePath; + + public CoreFileInfo(String hostPath, String targetPath, String coreFilePath) { + super(); + fHostPath = hostPath; + fTargetPath = targetPath; + fCoreFilePath = coreFilePath; + } + + /** + * Returns the path of the executable on the host + */ + public String getHostPath() { + return fHostPath; + } + + /** + * Sets the path of the executable on the host + */ + public void setHostPath(String path) { + fHostPath = path; + } + + /** + * For remote sessions returns the path of the executable + * on the target. Otherwise returns null. + */ + public String getTargetPath() { + return fTargetPath; + } + + /** + * Sets the path of the executable on the target for remote executables + */ + public void setTargetPath(String path) { + fTargetPath = path; + } + + /** + * Get the build log path. + * + * @return the build log path or null + */ + public String getCoreFilePath() { + return fCoreFilePath; + } + + /** + * Sets the build log path. + * + * @param path + */ + public void setCoreFilePath(String path) { + fCoreFilePath = path; + } + +}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/DummyPage.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/DummyPage.java new file mode 100644 index 00000000000..7b1b142fc75 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/DummyPage.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.IWorkbenchPropertyPage; +import org.eclipse.ui.dialogs.PropertyPage; + +// This class is just to replace a category reference in org.eclipse.cdt.ui that +// we exclude because we do not bring in the org.eclipse.cdt.managedbuild.ui plug-in. +public class DummyPage extends PropertyPage implements IWorkbenchPropertyPage { + + public DummyPage() { + // do nothing + } + + @Override + protected Control createContents(Composite parent) { + return null; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/GCCCompileOptionsParser.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/GCCCompileOptionsParser.java new file mode 100644 index 00000000000..d07e3b5b3ea --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/GCCCompileOptionsParser.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser; + +public class GCCCompileOptionsParser extends GCCBuildCommandParser { + + private String currentResourceName; + + public GCCCompileOptionsParser() { + super(); + } + + public String getCurrentResourceName() { + return currentResourceName; + } + + public void setCurrentResourceName(String name) { + currentResourceName = name; + } + + @Override + protected String parseResourceName(String line) { + return getCurrentResourceName(); + } + + @Override + public GCCCompileOptionsParser cloneShallow() throws CloneNotSupportedException { + return (GCCCompileOptionsParser) super.cloneShallow(); + } + + @Override + public GCCCompileOptionsParser clone() throws CloneNotSupportedException { + return (GCCCompileOptionsParser) super.clone(); + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ICDTStandaloneDebugLaunchConstants.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ICDTStandaloneDebugLaunchConstants.java new file mode 100644 index 00000000000..ab0af727123 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/ICDTStandaloneDebugLaunchConstants.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +/** + * Constants used for attributes in CDT Stand-alone Debugger launch configurations. + * + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ICDTStandaloneDebugLaunchConstants { + + public static final String BUILD_LOG_LOCATION = "org.eclipse.cdt.debug.application.launch.build.log"; //$NON-NLS-1$ + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Messages.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Messages.java new file mode 100644 index 00000000000..d52e2700e2d --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/Messages.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.application; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.application.messages"; //$NON-NLS-1$ + public static String ExecutablesView_ImportExecutables; + public static String Debugger_Title; + public static String GetCompilerOptions; + public static String GetBuildOptions; + public static String ProblemSavingWorkbench; + public static String ProblemsSavingWorkspace; + public static String InternalError; + public static String InitializingDebugger; + public static String ImportExecutable; + public static String SetLanguageProviders; + public static String RestorePreviousLaunch; + public static String RemoveOldExecutable; + public static String LaunchingConfig; + public static String LaunchInterruptedError; + public static String LaunchMissingError; + public static String DebuggerInitializingProblem; + + public static String GdbDebugNewExecutableCommand_Arguments; + public static String GdbDebugNewExecutableCommand_Binary; + public static String GdbDebugNewExecutableCommand_Binary_file_does_not_exist; + public static String GdbDebugNewExecutableCommand_Binary_must_be_specified; + public static String GdbDebugNewExecutableCommand_Binary_on_host; + public static String GdbDebugNewExecutableCommand_Binary_on_target; + public static String GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified; + public static String GdbDebugNewExecutableCommand_Browse; + public static String GdbDebugNewExecutableCommand_BuildLog; + public static String GdbDebugNewExecutableCommand_BuildLog_file_does_not_exist; + public static String GdbDebugNewExecutableCommand_Debug_New_Executable; + public static String GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist; + public static String GdbDebugNewExecutableCommand_Host_binary_must_be_specified; + public static String GdbDebugNewExecutableCommand_Invalid_binary; + public static String GdbDebugNewExecutableCommand_Invalid_buildLog; + public static String GdbDebugNewExecutableCommand_Invalid_host_binary; + public static String GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target; + public static String GdbDebugNewExecutableCommand_Select_Binary; + public static String GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments; + public static String GdbDebugCoreFileCommand_CoreFile; + public static String GdbDebugCoreFileCommand_Debug_Core_File; + public static String GdbDebugCoreFileCommand_Select_binary_and_specify_corefile; + public static String GdbDebugCoreFileCommand_Core_file_must_be_specified; + public static String GdbDebugCoreFileCommand_Core_file_does_not_exist; + public static String GdbDebugCoreFileCommand_Invalid_core_file; + + public static String FileMenuName; + public static String EditMenuName; + public static String WindowMenuName; + public static String HelpMenuName; + + public static String ShowViewMenuName; + + public static String ResetPerspective_text; + public static String ResetPerspective_toolTip; + public static String Workbench_cut; + public static String Workbench_cutToolTip; + public static String Workbench_copy; + public static String Workbench_copyToolTip; + public static String Workbench_paste; + public static String Workbench_pasteToolTip; + public static String Workbench_selectAll; + public static String Workbench_selectAllToolTip; + public static String Workbench_findReplace; + public static String Workbench_findReplaceToolTip; + public static String Workbench_addBookmark; + public static String Workbench_addBookmarkToolTip; + public static String Workbench_addTask; + public static String Workbench_addTaskToolTip; + public static String Workbench_delete; + public static String Workbench_deleteToolTip; + + public static String CoreFileMenuName; + public static String CoreFile_toolTip; + public static String NewExecutable_toolTip; + public static String NewExecutableMenuName; + public static String AttachedExecutable_toolTip; + public static String AttachedExecutableMenuName; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + + private Messages() { + } + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + 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.application/src/org/eclipse/cdt/debug/application/NewExecutableDialog.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/NewExecutableDialog.java new file mode 100644 index 00000000000..654ffc7dcfe --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/NewExecutableDialog.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 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 + * Red Hat Inc. - modified for use in Standalone Debugger + *******************************************************************************/ + +package org.eclipse.cdt.debug.application; + +import java.io.File; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.resource.JFaceResources; +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.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class NewExecutableDialog extends TitleAreaDialog { + + public static final int REMOTE = 0x1; + + private int fFlags = 0; + private NewExecutableInfo fInfo = null; + + private Text fHostBinaryText; + private Text fTargetBinaryText; + private Text fBuildLogText; + private Text fArgumentsText; + + private final String fHostBinary; + private final String fBuildLog; + private final String fArgs; + + public NewExecutableDialog (Shell parentShell) { + this(parentShell, 0); + } + + public NewExecutableDialog( Shell parentShell, int flags ) { + this(parentShell, flags, null, null, null); + } + + public NewExecutableDialog( Shell parentShell, int flags, String hostBinary, String buildLog, String args) { + super( parentShell ); + setShellStyle( getShellStyle() | SWT.RESIZE ); + fFlags = flags; + fHostBinary = hostBinary; + fBuildLog = buildLog; + fArgs = args; + } + + @Override + protected Control createContents( Composite parent ) { + Control control = super.createContents( parent ); + validate(); + return control; + } + + @Override + protected Control createDialogArea( Composite parent ) { + boolean remote = (fFlags & REMOTE) > 0; + + getShell().setText( Messages.GdbDebugNewExecutableCommand_Debug_New_Executable ); + setTitle( Messages.GdbDebugNewExecutableCommand_Select_Binary ); + String message = ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target : + Messages.GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments; + setMessage( message ); + + Composite control = (Composite)super.createDialogArea( parent ); + Composite comp = new Composite( control, SWT.NONE ); + GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true ); + GridLayout layout = new GridLayout( 3, false ); + comp.setLayout( layout ); + comp.setLayoutData( gd ); + + new Label( comp, SWT.None ).setText( remote ? Messages.GdbDebugNewExecutableCommand_Binary_on_host : Messages.GdbDebugNewExecutableCommand_Binary ); + fHostBinaryText = new Text( comp, SWT.BORDER ); + if (fHostBinary != null) + fHostBinaryText.setText(fHostBinary); + fHostBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) ); + fHostBinaryText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + Button browseButton = new Button( comp, SWT.PUSH ); + browseButton.setText( Messages.GdbDebugNewExecutableCommand_Browse ); + browseButton.setFont( JFaceResources.getDialogFont() ); + setButtonLayoutData( browseButton ); + browseButton.addSelectionListener( new SelectionAdapter() { + + @Override + public void widgetSelected( SelectionEvent e ) { + FileDialog dialog = new FileDialog( getShell() ); + dialog.setFileName( fHostBinaryText.getText() ); + String result = dialog.open(); + if ( result != null ) { + fHostBinaryText.setText( result ); + } + } + } ); + + if ( remote ) { + new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Binary_on_target ); + fTargetBinaryText = new Text( comp, SWT.BORDER ); + fTargetBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); + fTargetBinaryText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + } + + + new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Arguments ); + fArgumentsText = new Text( comp, SWT.BORDER ); + fArgumentsText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); + if (fArgs != null) + fArgumentsText.setText(fArgs); + + + new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_BuildLog ); + fBuildLogText = new Text( comp, SWT.BORDER ); + if (fBuildLog != null) + fBuildLogText.setText(fBuildLog); + fBuildLogText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); + fBuildLogText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + return control; + } + + @Override + protected void okPressed() { + String targetPath = ( fTargetBinaryText != null ) ? fTargetBinaryText.getText().trim() : null; + String args = fArgumentsText.getText().trim(); + String buildLog = fBuildLogText.getText().trim(); + fInfo = new NewExecutableInfo( fHostBinaryText.getText().trim(), targetPath, buildLog, args ); + super.okPressed(); + } + + public NewExecutableInfo getExecutableInfo() { + return fInfo; + } + + private void validate() { + boolean remote = (fFlags & REMOTE) > 0; + StringBuilder sb = new StringBuilder(); + String hostBinary = fHostBinaryText.getText().trim(); + if ( hostBinary.isEmpty() ) { + sb.append( ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified : + Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified ); + } + else { + File file = new File( hostBinary ); + if ( !file.exists() ) { + sb.append( ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist : + Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist ); + } + else if ( file.isDirectory() ) { + sb.append( ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Invalid_host_binary : + Messages.GdbDebugNewExecutableCommand_Invalid_binary ); + } + } + String buildLog = fBuildLogText.getText(); + if (sb.length() == 0 && !buildLog.isEmpty()) { + File file = new File( buildLog ); + if ( !file.exists() ) { + sb.append( Messages.GdbDebugNewExecutableCommand_BuildLog_file_does_not_exist ); + } + else if ( file.isDirectory() ) { + sb.append( Messages.GdbDebugNewExecutableCommand_Invalid_buildLog ); + } + } + if (sb.length() == 0 && fTargetBinaryText != null) { + if ( fTargetBinaryText.getText().trim().length() == 0 ) { + if ( sb.length() != 0 ) { + sb.append( "\n " ); //$NON-NLS-1$ + } + sb.append( Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified ); + } + } + setErrorMessage( ( sb.length() != 0 ) ? sb.toString() : null ); + getButton( IDialogConstants.OK_ID ).setEnabled( getErrorMessage() == null ); + } +}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/NewExecutableInfo.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/NewExecutableInfo.java new file mode 100644 index 00000000000..68457ff2288 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/NewExecutableInfo.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 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 + * Red Hat Inc. - modified for use in Standalone Debugger + *******************************************************************************/ + +package org.eclipse.cdt.debug.application; + +/** + * This class provides information required to start + * debugging an executable. + */ +public class NewExecutableInfo { + private String fHostPath; + private String fTargetPath; + private String fBuildLog; + private String fArguments; + + public NewExecutableInfo(String hostPath, String targetPath, String buildLog, String args) { + super(); + fHostPath = hostPath; + fTargetPath = targetPath; + fBuildLog = buildLog; + fArguments = args; + } + + /** + * Returns the path of the executable on the host + */ + public String getHostPath() { + return fHostPath; + } + + /** + * Sets the path of the executable on the host + */ + public void setHostPath(String path) { + fHostPath = path; + } + + /** + * For remote sessions returns the path of the executable + * on the target. Otherwise returns null. + */ + public String getTargetPath() { + return fTargetPath; + } + + /** + * Sets the path of the executable on the target for remote executables + */ + public void setTargetPath(String path) { + fTargetPath = path; + } + + /** + * Get the build log path. + * + * @return the build log path or null + */ + public String getBuildLog() { + return fBuildLog; + } + + /** + * Sets the build log path. + * + * @param path + */ + public void setBuildLog(String path) { + fBuildLog = path; + } + + /** + * Returns the arguments to pass to the executable, or null + */ + public String getArguments() { + return fArguments; + } + + /** + * Sets the arguments to pass to the executable + */ + public void setArguments(String args) { + fArguments = args; + } + +}
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/messages.properties b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/messages.properties new file mode 100644 index 00000000000..39af6b36890 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/debug/application/messages.properties @@ -0,0 +1,91 @@ +############################################################################### +# Copyright (c) 2013, 2014 Red Hat, 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: +# Red Hat Inc. - initial API and implementation +# Mentor Graphics - GDB Debug New Executable messages +############################################################################### +ExecutablesView_ImportExecutables=Importing Executables +Debugger_Title=Eclipse C/C++ Stand-alone Debugger +GetCompilerOptions=Calculating Source Compiler Options +GetBuildOptions=Process Build Log For Compile Options +ProblemSavingWorkbench = Problems occurred while trying to save the state of the workbench. +ProblemsSavingWorkspace = Problems saving workspace +InternalError = An internal error has occurred +InitializingDebugger=Initializing Debugger +ImportExecutable=Importing Executable +SetLanguageProviders=Setting Up Language Settings Providers +RestorePreviousLaunch=Restoring Previous Debug Launch Configuration +RemoveOldExecutable=Removing Previous Executables +LaunchingConfig=Launching Debug Configuration +LaunchInterruptedError=Debug launch has been interrupted +LaunchMissingError=Previous launch configuration cannot be found +DebuggerInitializingProblem=Problem occurred in start-up + +GdbDebugNewExecutableCommand_Arguments=Arguments: +GdbDebugNewExecutableCommand_Binary=Binary: +GdbDebugNewExecutableCommand_Binary_file_does_not_exist=Debugger will start up with no input +GdbDebugNewExecutableCommand_Binary_must_be_specified=Binary must be specified +GdbDebugNewExecutableCommand_Binary_on_host=Binary on host: +GdbDebugNewExecutableCommand_Binary_on_target=Binary on target: +GdbDebugNewExecutableCommand_BuildLog=Build Log path: +GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified=Binary on target must be specified +GdbDebugNewExecutableCommand_Browse=Browse... +GdbDebugNewExecutableCommand_Debug_New_Executable=Debug New Executable +GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist=Host binary file does not exist +GdbDebugNewExecutableCommand_Host_binary_must_be_specified=Host binary must be specified +GdbDebugNewExecutableCommand_Invalid_binary=Invalid binary +GdbDebugNewExecutableCommand_Invalid_host_binary=Invalid host binary +GdbDebugNewExecutableCommand_BuildLog_file_does_not_exist=Host build log file does not exist +GdbDebugNewExecutableCommand_Invalid_buildLog=Invalid build log +GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target=Select binaries on the host and the target and specify the arguments +GdbDebugNewExecutableCommand_Select_Binary=Select Binary +GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments=Select a binary and specify the arguments + +GdbDebugCoreFileCommand_CoreFile=Core File Path: +GdbDebugCoreFileCommand_Debug_Core_File=Debug Core File +GdbDebugCoreFileCommand_Select_binary_and_specify_corefile=Select a binary and specify the core file +GdbDebugCoreFileCommand_Core_file_must_be_specified=Core file must be specified +GdbDebugCoreFileCommand_Core_file_does_not_exist=Core file specified does not exist +GdbDebugCoreFileCommand_Invalid_core_file=Invalid core file + +FileMenuName=&File +EditMenuName=&Edit +WindowMenuName=&Window +HelpMenuName=&Help + +ResetPerspective_text=&Reset Perspective... +ResetPerspective_toolTip=Reset perspective + +Workbench_cut=Cu&t +Workbench_cutToolTip=Cut +Workbench_copy=&Copy +Workbench_copyToolTip=Copy +Workbench_paste=&Paste +Workbench_pasteToolTip=Paste +Workbench_selectAll=Select &All +Workbench_selectAllToolTip=Select All +Workbench_findReplace=&Find/Replace... +Workbench_findReplaceToolTip=Find/Replace +Workbench_addBookmark=Add Bookmar&k... +Workbench_addBookmarkToolTip=Add Bookmark +Workbench_addTask=Add Ta&sk... +Workbench_addTaskToolTip=Add Task +Workbench_delete=&Delete +Workbench_deleteToolTip=Delete + + + + +ShowViewMenuName=Show &View + +CoreFileMenuName=Debug &Core File... +CoreFile_toolTip=Debug an executable that has generated a core file +NewExecutable_toolTip=Load a new executable and debug it +NewExecutableMenuName=&Debug New Executable... +AttachedExecutable_toolTip=Attach to an existing executable on the system and debug +AttachedExecutableMenuName=Debug &Attached Executable... diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/BuildOptionsParser.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/BuildOptionsParser.java new file mode 100644 index 00000000000..101399c4f34 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/BuildOptionsParser.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.debug.application; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.ErrorParserManager; +import org.eclipse.cdt.core.IMarkerGenerator; +import org.eclipse.cdt.core.ProblemMarkerInfo; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; +import org.eclipse.cdt.debug.application.Messages; +import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +public class BuildOptionsParser implements IWorkspaceRunnable, IMarkerGenerator { + + private final IProject project; + private final File buildLog; + private static final String GCC_BUILD_OPTIONS_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"; //$NON-NLS-1$ + + public BuildOptionsParser (IProject project, File buildLog) { + this.project = project; + this.buildLog = buildLog; + } + + @Override + public void run(IProgressMonitor monitor) { + monitor.beginTask(Messages.GetBuildOptions, 10); + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(buildLog)); + // Calculate how many source files we have to process and use that as a basis + monitor.beginTask(Messages.GetBuildOptions, 10); + + // Find the GCCBuildCommandParser for the configuration. + ICProjectDescriptionManager projDescManager = CCorePlugin + .getDefault().getProjectDescriptionManager(); + ICProjectDescription projDesc = projDescManager + .getProjectDescription(project, + false); + ICConfigurationDescription ccdesc = projDesc + .getActiveConfiguration(); + GCCBuildCommandParser parser = null; + if (ccdesc instanceof ILanguageSettingsProvidersKeeper) { + ILanguageSettingsProvidersKeeper keeper = (ILanguageSettingsProvidersKeeper)ccdesc; + List<ILanguageSettingsProvider> list = keeper.getLanguageSettingProviders(); + for (ILanguageSettingsProvider p : list) { + // System.out.println("language settings provider " + p.getId()); + if (p.getId().equals(GCC_BUILD_OPTIONS_PROVIDER_ID)) { + parser = (GCCBuildCommandParser)p; + } + } + } + ErrorParserManager epm = new ErrorParserManager(project, this, new String[]{"org.eclipse.cdt.core.CWDLocator"}); //$NON-NLS-1$ + // Start up the parser and process lines generated from the .debug_macro section. + parser.startup(ccdesc, epm); + monitor.beginTask(Messages.GetBuildOptions, 10); + String line = br.readLine(); + while (line != null) { + parser.processLine(line); + line = br.readLine(); + } + parser.shutdown(); + if (br != null) + br.close(); + + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + monitor.done(); + } + + @Override + public void addMarker(IResource file, int lineNumber, String errorDesc, + int severity, String errorVar) { + // do nothing + } + + @Override + public void addMarker(ProblemMarkerInfo problemMarkerInfo) { + // do nothing + } + +}; diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CompilerOptionParser.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CompilerOptionParser.java new file mode 100644 index 00000000000..127867d1aaa --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CompilerOptionParser.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.debug.application; + +import java.io.IOException; +import java.net.URI; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; +import org.eclipse.cdt.core.ICompileOptionsFinder; +import org.eclipse.cdt.core.ISymbolReader; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper; +import org.eclipse.cdt.core.language.settings.providers.IWorkingDirectoryTracker; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; +import org.eclipse.cdt.debug.application.GCCCompileOptionsParser; +import org.eclipse.cdt.debug.application.Messages; +import org.eclipse.cdt.utils.elf.parser.GNUElfParser; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; + +public class CompilerOptionParser implements IWorkspaceRunnable { + + private static final String GCC_COMPILE_OPTIONS_PROVIDER_ID = "org.eclipse.cdt.debug.application.DwarfLanguageSettingsProvider"; //$NON-NLS-1$ + private final IProject project; + private final String executable; + + public CompilerOptionParser (IProject project, String executable) { + this.project = project; + this.executable = executable; + } + + private class CWDTracker implements IWorkingDirectoryTracker { + + @Override + public URI getWorkingDirectoryURI() { + return null; + } + + } + + @Override + public void run(IProgressMonitor monitor) { + try { + // Calculate how many source files we have to process and use that as a basis + // for our work estimate. + GNUElfParser binParser = new GNUElfParser(); + IBinaryFile bf = binParser + .getBinary(new Path(executable)); + ISymbolReader reader = (ISymbolReader)bf.getAdapter(ISymbolReader.class); + String[] sourceFiles = reader + .getSourceFiles(); + monitor.beginTask(Messages.GetCompilerOptions, sourceFiles.length * 2 + 1); + + for (String sourceFile : sourceFiles) { + IPath sourceFilePath = new Path( + sourceFile); + String sourceName = sourceFilePath + .lastSegment(); + IContainer c = createFromRoot(project, + new Path(sourceFile)); + Path sourceNamePath = new Path( + sourceName); + IFile source = c + .getFile(sourceNamePath); + if (!source.isLinked()) { + try { + source.createLink(sourceFilePath, 0, + null); + } catch (Exception e) { + // ignore file not found errors since certain headers might not be found + // or are a different version from that used to compile the source (e.g. std headers) + } + } + monitor.worked(1); + } + + // Find the GCCCompileOptions LanguageSettingsProvider for the configuration. + IWorkingDirectoryTracker cwdTracker = new CWDTracker(); + ICProjectDescriptionManager projDescManager = CCorePlugin + .getDefault().getProjectDescriptionManager(); + ICProjectDescription projDesc = projDescManager + .getProjectDescription(project, + false); + ICConfigurationDescription ccdesc = projDesc + .getActiveConfiguration(); + GCCCompileOptionsParser parser = null; + if (ccdesc instanceof ILanguageSettingsProvidersKeeper) { + ILanguageSettingsProvidersKeeper keeper = (ILanguageSettingsProvidersKeeper)ccdesc; + List<ILanguageSettingsProvider> list = keeper.getLanguageSettingProviders(); + for (ILanguageSettingsProvider p : list) { + // System.out.println("language settings provider " + p.getId()); + if (p.getId().equals(GCC_COMPILE_OPTIONS_PROVIDER_ID)) { + parser = (GCCCompileOptionsParser)p; + } + } + } + // Start up the parser and process lines generated from the .debug_macro section. + parser.startup(ccdesc, cwdTracker); + // Get compile options for each source file and process via the parser + // to generate LanguageSettingsEntries. + if (reader instanceof + ICompileOptionsFinder) { + ICompileOptionsFinder f = + (ICompileOptionsFinder) reader; + for (String fileName : sourceFiles) { + parser.setCurrentResourceName(fileName); +// String cmdline = f.getCompileOptions(fileName); +// System.out.println("Command line is " + cmdline); + parser.processLine(f + .getCompileOptions(fileName)); + monitor.worked(1); + } + parser.shutdown(); // this will serialize the data to an xml file and create an event. + monitor.worked(1); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + monitor.done(); + } + + private IContainer createFromRoot(IProject exeProject, IPath path) + throws CoreException { + int segmentCount = path.segmentCount() - 1; + IContainer currentFolder = exeProject; + + for (int i = 0; i < segmentCount; i++) { + currentFolder = currentFolder.getFolder(new Path(path.segment(i))); + if (!currentFolder.exists()) { + ((IFolder) currentFolder).create(IResource.VIRTUAL + | IResource.DERIVED, true, new NullProgressMonitor()); + } + } + + return currentFolder; + } + + +}; diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CustomizePerspectiveHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CustomizePerspectiveHandler.java new file mode 100644 index 00000000000..d9962879750 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CustomizePerspectiveHandler.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.debug.application; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +public class CustomizePerspectiveHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutable.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutable.java new file mode 100644 index 00000000000..6c9414adbb4 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutable.java @@ -0,0 +1,246 @@ +/******************************************************************************* + * Copyright (c) 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.debug.application; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; +import org.eclipse.cdt.debug.application.Messages; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +public class DebugAttachedExecutable { + + private static final String GCC_BUILTIN_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"; //$NON-NLS-1$ + private static final String GCC_COMPILE_OPTIONS_PROVIDER_ID = "org.eclipse.cdt.debug.application.DwarfLanguageSettingsProvider"; //$NON-NLS-1$ + private static final String GCC_BUILD_OPTIONS_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"; //$NON-NLS-1$ + private static final String DEBUG_PROJECT_ID = "org.eclipse.cdt.debug"; //$NON-NLS-1$ + + + public DebugAttachedExecutable() { + } + + public static ILaunchManager getLaunchManager() { + return DebugPlugin.getDefault().getLaunchManager(); + } + + // Create a new project that doesn't already exist. Use the base project name and add + // a numerical suffix as needed. + private static IProject createCProjectForExecutable(String projectName) throws OperationCanceledException, CoreException { + + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IProject newProjectHandle = workspace.getRoot().getProject(projectName); + + int projectSuffix = 2; + while (newProjectHandle.exists()){ + newProjectHandle = workspace.getRoot().getProject(projectName + projectSuffix); + projectSuffix++; + } + + IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName()); + description.setLocation(null); + + IProject newProject = CCorePlugin.getDefault().createCProject(description, newProjectHandle, null, + DEBUG_PROJECT_ID); + + return newProject; + } + + /** + * Import given executable into the Executables project then create a launch configuration. + * + * @param monitor + * @param executable + * @param buildLog + * @param arguments + * @throws CoreException + * @throws InterruptedException + */ + public static ILaunchConfiguration createLaunchConfig(IProgressMonitor monitor, + String buildLog) + throws CoreException, InterruptedException { + ILaunchConfiguration config = null; + String defaultProjectName = "Executables"; //$NON-NLS-1$ + + // Create a new Executablesnn project + IProject project = createCProjectForExecutable(defaultProjectName); + + monitor.worked(3); + File buildLogFile = null; + + final ICProjectDescriptionManager projDescManager = CCorePlugin + .getDefault().getProjectDescriptionManager(); + + ICProjectDescription projectDescription = projDescManager + .getProjectDescription(project, + ICProjectDescriptionManager.GET_WRITABLE); + + monitor.subTask(Messages.SetLanguageProviders); + final ICConfigurationDescription ccd = projectDescription + .getActiveConfiguration(); + String[] langProviderIds = ((ILanguageSettingsProvidersKeeper) ccd) + .getDefaultLanguageSettingsProvidersIds(); + boolean found = false; + for (int i = 0; i < langProviderIds.length; ++i) { + if (langProviderIds[i].equals(GCC_BUILTIN_PROVIDER_ID)) { + found = true; + break; + } + } + // Look for the GCC builtin LanguageSettingsProvider id. If it isn't already + // there, add it. + if (!found) { + langProviderIds = Arrays.copyOf(langProviderIds, + langProviderIds.length + 1); + langProviderIds[langProviderIds.length - 1] = GCC_BUILTIN_PROVIDER_ID; + } + found = false; + for (int i = 0; i < langProviderIds.length; ++i) { + if (langProviderIds[i].equals(GCC_COMPILE_OPTIONS_PROVIDER_ID)) { + found = true; + break; + } + } + // Look for our macro parser provider id. If it isn't added already, do so now. + if (!found) { + langProviderIds = Arrays.copyOf(langProviderIds, + langProviderIds.length + 1); + langProviderIds[langProviderIds.length - 1] = GCC_COMPILE_OPTIONS_PROVIDER_ID; + } + + if (buildLog != null) { + File f = new File(buildLog); + if (f.exists()) { + buildLogFile = f; + found = false; + for (int i = 0; i < langProviderIds.length; ++i) { + if (langProviderIds[i].equals(GCC_BUILD_OPTIONS_PROVIDER_ID)) { + found = true; + break; + } + } + // Look for our macro parser provider id. If it isn't added already, do so now. + if (!found) { + langProviderIds = Arrays.copyOf(langProviderIds, + langProviderIds.length + 1); + langProviderIds[langProviderIds.length - 1] = GCC_BUILD_OPTIONS_PROVIDER_ID; + } + } + } + + // System.out.println("creating language settings providers"); + // Create all the LanguageSettingsProviders + List<ILanguageSettingsProvider> providers = LanguageSettingsManager + .createLanguageSettingsProviders(langProviderIds); + + // Update the providers for the configuration. + ((ILanguageSettingsProvidersKeeper) ccd) + .setLanguageSettingProviders(providers); + + monitor.worked(1); + + // System.out.println("before setProjectDescription"); + + // Update the project description. + projDescManager.setProjectDescription(project, + projectDescription); + + // System.out.println("after setProjectDescription"); + + // Serialize the language settings for the project now in case we don't run a + // language settings provider which will do this in shutdown. + ICProjectDescription projDescReadOnly = projDescManager + .getProjectDescription(project, + false); + LanguageSettingsManager.serializeLanguageSettings(projDescReadOnly); + + monitor.worked(1); + + if (buildLogFile != null) + // We need to parse the build log to get compile options. We need to lock the + // workspace when we do this so we don't have multiple copies of GCCBuildOptionsParser + // LanguageSettingsProvider and we end up filling in the wrong one. + project.getWorkspace().run(new BuildOptionsParser(project, buildLogFile), + ResourcesPlugin.getWorkspace().getRoot(), IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); + + // System.out.println("about to close all editors"); + IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + final IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + if (workbenchWindow != null) { + final IWorkbenchPage activePage = workbenchWindow.getActivePage(); + if (activePage != null) + activePage.closeAllEditors(false); + } + } + // System.out.println("about to create launch configuration"); + config = createConfiguration(true); + monitor.worked(1); + return config; + } + + protected static ILaunchConfigurationType getLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType( + "org.eclipse.cdt.launch.attachLaunchType"); //$NON-NLS-1$ + } + + protected static ILaunchConfiguration createConfiguration(boolean save) { + // System.out.println("creating launch configuration"); + ILaunchConfiguration config = null; + try { + ILaunchConfigurationType configType = getLaunchConfigType(); + ILaunchConfigurationWorkingCopy wc = configType.newInstance( + null, + getLaunchManager().generateLaunchConfigurationName("CDT_DBG_ATTACH")); //$NON-NLS-1$ + + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, + ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, + "Executables"); //$NON-NLS-1$ + wc.setAttribute( + ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, + (String) null); + if (save) { + config = wc.doSave(); + } else { + config = wc; + } + } catch (CoreException e) { + e.printStackTrace(); + } + return config; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutableHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutableHandler.java new file mode 100644 index 00000000000..cee889dfb32 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugAttachedExecutableHandler.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2012, 2014 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 + * Red Hat Inc. - modified for use in Standalone Debugger + *******************************************************************************/ + +package org.eclipse.cdt.internal.debug.application; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.swt.widgets.Display; + +public class DebugAttachedExecutableHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + try { + final ILaunchConfiguration config = DebugAttachedExecutable.createLaunchConfig(new NullProgressMonitor(), null); + if (config != null) { + // System.out.println("about to add job change listener"); +// final JobContainer LaunchJobs = new JobContainer(); +// Job.getJobManager().addJobChangeListener(new JobChangeAdapter() { +// +// @Override +// public void scheduled(IJobChangeEvent event) { +// Job job = event.getJob(); +// // System.out.println("Job name is " + job.getName()); +// if (job.getName().contains(config.getName())) +// LaunchJobs.setLaunchJob(job); +// } +// +// @Override +// public void done(IJobChangeEvent event) { +// // System.out.println("Job " + event.getJob().getName() + " is done"); +// } +// }); + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); + // System.out.println("about to join " + LaunchJobs.getLaunchJob()); + } + }); +// if (LaunchJobs.getLaunchJob() != null) { +// try { +// LaunchJobs.getLaunchJob().join(); +// } catch (InterruptedException e) { +// IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, +// Messages.LaunchInterruptedError, e); +// ResourcesPlugin.getPlugin().getLog().log(status); +// } +// } + } + // System.out.println("end"); + } catch (InterruptedException e) { + // System.out.println("Interrupted exception"); + e.printStackTrace(); + } catch (CoreException e) { + // System.out.println("Core Exception"); + e.printStackTrace(); + } catch (Exception e) { + // System.out.println("Exception"); + e.printStackTrace(); + } finally { + // System.out.println("Finally"); + } + + + return null; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFile.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFile.java new file mode 100644 index 00000000000..e1a157f42a6 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFile.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.debug.application; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; + +public class DebugCoreFile { + + public DebugCoreFile() { + } + + public static ILaunchManager getLaunchManager() { + return DebugPlugin.getDefault().getLaunchManager(); + } + + /** + * Import given executable into the Executables project then create a launch configuration. + * + * @param monitor + * @param executable + * @param buildLog + * @param arguments + * @throws CoreException + * @throws InterruptedException + */ + public static ILaunchConfiguration createLaunchConfig(IProgressMonitor monitor, + String buildLog, String executable, String coreFile) + throws CoreException, InterruptedException { + ILaunchConfiguration config = null; + + // System.out.println("about to create launch configuration"); + config = createConfiguration(coreFile, executable, true); + monitor.worked(1); + return config; + } + + protected static ILaunchConfigurationType getLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType( + "org.eclipse.cdt.launch.postmortemLaunchType"); //$NON-NLS-1$ + } + + protected static ILaunchConfiguration createConfiguration(String corePath, String exePath, boolean save) { +// System.out.println("creating launch configuration"); + ILaunchConfiguration config = null; + try { + ILaunchConfigurationType configType = getLaunchConfigType(); + ILaunchConfigurationWorkingCopy wc = configType.newInstance( + null, + getLaunchManager().generateLaunchConfigurationName("CDT_DBG_CORE")); //$NON-NLS-1$ + + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, + ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, corePath); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, exePath); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, + "Executables"); //$NON-NLS-1$ + wc.setAttribute( + ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, + (String) null); + if (save) { + config = wc.doSave(); + } else { + config = wc; + } + } catch (CoreException e) { + e.printStackTrace(); + } + return config; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFileHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFileHandler.java new file mode 100644 index 00000000000..f32df8c31b2 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugCoreFileHandler.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2012, 2014 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 + * Red Hat Inc. - modified for use in Standalone Debugger + *******************************************************************************/ + +package org.eclipse.cdt.internal.debug.application; + +import org.eclipse.cdt.debug.application.CoreFileDialog; +import org.eclipse.cdt.debug.application.CoreFileInfo; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class DebugCoreFileHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + CoreFileDialog dialog = new CoreFileDialog(new Shell()); + + if (dialog.open() == IDialogConstants.OK_ID) { + CoreFileInfo info = dialog.getCoreFileInfo(); + try { + final ILaunchConfiguration config = DebugCoreFile.createLaunchConfig(new NullProgressMonitor(), null, info.getHostPath(), info.getCoreFilePath()); + if (config != null) { + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); + // System.out.println("about to join " + LaunchJobs.getLaunchJob()); + } + }); + // if (LaunchJobs.getLaunchJob() != null) { + // try { + // LaunchJobs.getLaunchJob().join(); + // } catch (InterruptedException e) { + // IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, + // Messages.LaunchInterruptedError, e); + // ResourcesPlugin.getPlugin().getLog().log(status); + // } + // } + } + // System.out.println("end"); + } catch (InterruptedException e) { + // System.out.println("Interrupted exception"); + e.printStackTrace(); + } catch (CoreException e) { + // System.out.println("Core Exception"); + e.printStackTrace(); + } catch (Exception e) { + // System.out.println("Exception"); + e.printStackTrace(); + } finally { + // System.out.println("Finally"); + } + } + + return null; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugExecutable.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugExecutable.java new file mode 100644 index 00000000000..140057a9307 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugExecutable.java @@ -0,0 +1,314 @@ +/******************************************************************************* + * Copyright (c) 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.debug.application; + +import java.io.File; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; +import org.eclipse.cdt.core.model.CoreModel; +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.core.settings.model.ICProjectDescriptionManager; +import org.eclipse.cdt.debug.application.ICDTStandaloneDebugLaunchConstants; +import org.eclipse.cdt.debug.application.Messages; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.core.executables.Executable; +import org.eclipse.cdt.debug.core.executables.ExecutablesManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +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.QualifiedName; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +public class DebugExecutable { + + private static final String GCC_BUILTIN_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"; //$NON-NLS-1$ + private static final String GCC_COMPILE_OPTIONS_PROVIDER_ID = "org.eclipse.cdt.debug.application.DwarfLanguageSettingsProvider"; //$NON-NLS-1$ + private static final String GCC_BUILD_OPTIONS_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"; //$NON-NLS-1$ + private static final String STANDALONE_QUALIFIER = "org.eclipse.cdt.debug.application"; //$NON-NLS-1$ + private static final String LAST_LAUNCH = "lastLaunch"; //$NON-NLS-1$ + + public DebugExecutable() { + } + + public static ILaunchManager getLaunchManager() { + return DebugPlugin.getDefault().getLaunchManager(); + } + + /** + * Import given executable into the Executables project then create a launch configuration. + * + * @param monitor + * @param executable + * @param buildLog + * @param arguments + * @throws CoreException + * @throws InterruptedException + */ + public static ILaunchConfiguration importAndCreateLaunchConfig(IProgressMonitor monitor, + String executable, String buildLog, String arguments) + throws CoreException, InterruptedException { + ILaunchConfiguration config = null; + File executableFile = new File(executable); + String defaultProjectName = "Executables"; //$NON-NLS-1$ + ICProject cProject = CoreModel.getDefault().getCModel() + .getCProject(defaultProjectName); + // if a valid executable is specified, remove any executables already loaded in workspace + if (cProject.exists() && executableFile.exists()) { + monitor.subTask(Messages.RemoveOldExecutable); + IProject proj = cProject.getProject(); + Collection<Executable> elist = ExecutablesManager.getExecutablesManager().getExecutablesForProject(proj); + Executable[] executables = new Executable[elist.size()]; + elist.toArray(executables); + @SuppressWarnings("unused") + IStatus rc = ExecutablesManager.getExecutablesManager().removeExecutables(executables, new NullProgressMonitor()); + // Remove all old members of the Executables project from the last run + IResource[] resources = proj.members(); + for (IResource resource : resources) { + resource.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT|IResource.FORCE, new NullProgressMonitor()); + } + + monitor.worked(1); + // Find last launch if one exists + String memento = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(new QualifiedName(STANDALONE_QUALIFIER, LAST_LAUNCH)); +// System.out.println("memento is " + memento); + if (memento != null) { + ILaunchConfiguration lastConfiguration = getLaunchManager().getLaunchConfiguration(memento); + try { + lastConfiguration.getType(); + if (lastConfiguration.exists()) + lastConfiguration.delete(); + } catch (CoreException e) { + // do nothing + } + } + // Delete project because we have deleted .cproject and settings files + // by this point so just create a new Executables C project to use for + // importing the new executable. + proj.delete(true, new NullProgressMonitor()); + monitor.worked(1); + } + final String[] fileNames = { executable }; + Job importJob = new Job(Messages.ExecutablesView_ImportExecutables) { + + @Override + public IStatus run(IProgressMonitor monitor) { + ExecutablesManager.getExecutablesManager().importExecutables( + fileNames, monitor); + return Status.OK_STATUS; + } + }; + monitor.subTask(Messages.ImportExecutable); + importJob.schedule(); + importJob.join(); + monitor.worked(3); + if (importJob.getResult() == Status.OK_STATUS) { +// System.out.println("importJob successful"); + // See if the default project exists + Collection<Executable> executables = ExecutablesManager.getExecutablesManager().getExecutables(); + for (Executable exec : executables) { + if (exec.getName().contains(executableFile.getName())) + cProject = CoreModel.getDefault().getCModel().getCProject(exec.getProject().getName()); + } + + if (cProject.exists()) { + File buildLogFile = null; + final IProject project = cProject.getProject(); + + final ICProjectDescriptionManager projDescManager = CCorePlugin + .getDefault().getProjectDescriptionManager(); + + ICProjectDescription projectDescription = projDescManager + .getProjectDescription(project, + ICProjectDescriptionManager.GET_WRITABLE); + + monitor.subTask(Messages.SetLanguageProviders); + final ICConfigurationDescription ccd = projectDescription + .getActiveConfiguration(); + String[] langProviderIds = ((ILanguageSettingsProvidersKeeper) ccd) + .getDefaultLanguageSettingsProvidersIds(); + boolean found = false; + for (int i = 0; i < langProviderIds.length; ++i) { + if (langProviderIds[i].equals(GCC_BUILTIN_PROVIDER_ID)) { + found = true; + break; + } + } + // Look for the GCC builtin LanguageSettingsProvider id. If it isn't already + // there, add it. + if (!found) { + langProviderIds = Arrays.copyOf(langProviderIds, + langProviderIds.length + 1); + langProviderIds[langProviderIds.length - 1] = GCC_BUILTIN_PROVIDER_ID; + } + found = false; + for (int i = 0; i < langProviderIds.length; ++i) { + if (langProviderIds[i].equals(GCC_COMPILE_OPTIONS_PROVIDER_ID)) { + found = true; + break; + } + } + // Look for our macro parser provider id. If it isn't added already, do so now. + if (!found) { + langProviderIds = Arrays.copyOf(langProviderIds, + langProviderIds.length + 1); + langProviderIds[langProviderIds.length - 1] = GCC_COMPILE_OPTIONS_PROVIDER_ID; + } + + if (buildLog != null) { + File f = new File(buildLog); + if (f.exists()) { + buildLogFile = f; + found = false; + for (int i = 0; i < langProviderIds.length; ++i) { + if (langProviderIds[i].equals(GCC_BUILD_OPTIONS_PROVIDER_ID)) { + found = true; + break; + } + } + // Look for our macro parser provider id. If it isn't added already, do so now. + if (!found) { + langProviderIds = Arrays.copyOf(langProviderIds, + langProviderIds.length + 1); + langProviderIds[langProviderIds.length - 1] = GCC_BUILD_OPTIONS_PROVIDER_ID; + } + } + } + +// System.out.println("creating language settings providers"); + // Create all the LanguageSettingsProviders + List<ILanguageSettingsProvider> providers = LanguageSettingsManager + .createLanguageSettingsProviders(langProviderIds); + + // Update the providers for the configuration. + ((ILanguageSettingsProvidersKeeper) ccd) + .setLanguageSettingProviders(providers); + + monitor.worked(1); + +// System.out.println("before setProjectDescription"); + + // Update the project description. + projDescManager.setProjectDescription(project, + projectDescription); + + // Serialize the language settings for the project now in case we don't run a + // language settings provider which will do this in shutdown. + ICProjectDescription projDescReadOnly = projDescManager + .getProjectDescription(project, + false); + LanguageSettingsManager.serializeLanguageSettings(projDescReadOnly); + +// System.out.println("after setProjectDescription"); + + monitor.worked(1); + + if (!("".equals(executable))) + // We need to parse the macro compile options if they exist. We need to lock the + // workspace when we do this so we don't have multiple copies of our GCCCompilerOptionsParser + // LanguageSettingsProvider and we end up filling in the wrong one. + project.getWorkspace().run(new CompilerOptionParser(project, executable), + ResourcesPlugin.getWorkspace().getRoot(), IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); + + if (buildLogFile != null) + // We need to parse the build log to get compile options. We need to lock the + // workspace when we do this so we don't have multiple copies of GCCBuildOptionsParser + // LanguageSettingsProvider and we end up filling in the wrong one. + project.getWorkspace().run(new BuildOptionsParser(project, buildLogFile), + ResourcesPlugin.getWorkspace().getRoot(), IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); + } + +// System.out.println("about to close all editors"); + IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + final IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + if (workbenchWindow != null) { + final IWorkbenchPage activePage = workbenchWindow.getActivePage(); + if (activePage != null) + activePage.closeAllEditors(false); + } + } +// System.out.println("about to create launch configuration"); + config = createConfiguration(executable, arguments, buildLog, true); + String memento = config.getMemento(); + ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(new QualifiedName(STANDALONE_QUALIFIER, LAST_LAUNCH), memento); + monitor.worked(1); + } else { + System.out.println("Import job failed"); + return null; + } + return config; + } + + protected static ILaunchConfigurationType getLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType( + "org.eclipse.cdt.launch.applicationLaunchType"); //$NON-NLS-1$ + } + + + protected static ILaunchConfiguration createConfiguration(String bin, + String arguments, String buildLog, boolean save) { +// System.out.println("creating launch configuration"); + ILaunchConfiguration config = null; + try { + String progName = bin; + ILaunchConfigurationType configType = getLaunchConfigType(); + ILaunchConfigurationWorkingCopy wc = configType.newInstance( + null, + getLaunchManager().generateLaunchConfigurationName(bin)); + + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, + progName); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, + "Executables"); //$NON-NLS-1$ + wc.setAttribute(ICDTStandaloneDebugLaunchConstants.BUILD_LOG_LOCATION, + buildLog); + wc.setAttribute( + ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, + (String) null); + if (arguments != null) + wc.setAttribute( + ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, + arguments); + if (save) { + config = wc.doSave(); + } else { + config = wc; + } + } catch (CoreException e) { + e.printStackTrace(); + } + return config; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugNewExecutableHandler.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugNewExecutableHandler.java new file mode 100644 index 00000000000..d4917fde43b --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/DebugNewExecutableHandler.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2012, 2014 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 + * Red Hat Inc. - modified for use in Standalone Debugger + *******************************************************************************/ + +package org.eclipse.cdt.internal.debug.application; + +import org.eclipse.cdt.debug.application.Activator; +import org.eclipse.cdt.debug.application.Messages; +import org.eclipse.cdt.debug.application.NewExecutableDialog; +import org.eclipse.cdt.debug.application.NewExecutableInfo; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class DebugNewExecutableHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + NewExecutableDialog dialog = new NewExecutableDialog(new Shell()); + + if (dialog.open() == IDialogConstants.OK_ID) { + NewExecutableInfo info = dialog.getExecutableInfo(); + String executable = info.getHostPath(); + String arguments = info.getArguments(); + String buildLog = info.getBuildLog(); + + try { + final ILaunchConfiguration config = DebugExecutable.importAndCreateLaunchConfig(new NullProgressMonitor(), executable, buildLog, arguments); + if (config != null) { +// System.out.println("about to add job change listener"); + final JobContainer LaunchJobs = new JobContainer(); + Job.getJobManager().addJobChangeListener(new JobChangeAdapter() { + + @Override + public void scheduled(IJobChangeEvent event) { + Job job = event.getJob(); +// System.out.println("Job name is " + job.getName()); + if (job.getName().contains(config.getName())) + LaunchJobs.setLaunchJob(job); + } + + @Override + public void done(IJobChangeEvent event) { +// System.out.println("Job " + event.getJob().getName() + " is done"); + } + }); + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); +// System.out.println("about to join " + LaunchJobs.getLaunchJob()); + } + }); + if (LaunchJobs.getLaunchJob() != null) { + try { + LaunchJobs.getLaunchJob().join(); + } catch (InterruptedException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, + Messages.LaunchInterruptedError, e); + ResourcesPlugin.getPlugin().getLog().log(status); + } + } + } +// System.out.println("end"); + } catch (InterruptedException e) { +// System.out.println("Interrupted exception"); + e.printStackTrace(); + } catch (CoreException e) { +// System.out.println("Core Exception"); + e.printStackTrace(); + } catch (Exception e) { +// System.out.println("Exception"); + e.printStackTrace(); + } finally { + // System.out.println("Finally"); + } + } + + + return null; + } + +} diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/JobContainer.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/JobContainer.java new file mode 100644 index 00000000000..20e93d9fece --- /dev/null +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/JobContainer.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2014 Red Hat, 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: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.debug.application; + +import org.eclipse.core.runtime.jobs.Job; + +public class JobContainer { + private Job launchJob; + public Job getLaunchJob() { + return launchJob; + } + + public void setLaunchJob(Job job) { + this.launchJob = job; + } + +} |