home *** CD-ROM | disk | FTP | other *** search
- !!include "Library\jdkUtilities.script"
- !!Script
- // Copyright ⌐ 1997-2002 - Modelworks Software
-
- /**
- @Tool: debugJPDAExternal~debug using the IDE's visual
- debugger. You must start the external program using the
- following options: "-Xdebug -Xnoagent -Djava.compiler=NONE
- -Xrunjdwp:transport=dt_socket,server=y,address=nnnn".
- @EndTool:
- @Summary: debugExternal~runs the JPDA java debugger
- */
-
- var gOutput = getOutput("Debug");
- var gHelpers = getMapFile("ApplicationHelpers");
- var gOptions = getMapFile("JDKToolsStandardOptions");
-
- // Define the following variables - only the port has to be defined.
- var gWorkingdirectory = "";
- var gVMport = "53006";
- var gVMhost = "";
-
- function DoCommand()
- {
- if (getGlobal("JDKDebugger", null) != null)
- {
- alert("A debug session is already open");
- return;
- }
-
-
- RunDebugger();
- }
-
- function RunDebugger()
- {
- if (gVMport == "")
- {
- alert("You must edit this script before running it.");
- return;
- }
-
- // Save all open files
- saveAll();
-
- gOutput.clear();
- gOutput.setActive();
-
- var jpdaOptions = "server=y,address=";
- if (gVMhost != "")
- {
- jpdaOptions += gVMhost + ":";
- }
- jpdaOptions += gVMport;
-
- if (gWorkingdirectory.length > 0)
- {
- File.setDirectory(gWorkingdirectory);
- }
-
- gOutput.writeLine("Starting debugger... ");
- if (gOptions.lookup("showCommandLine",false)==true)
- {
- gOutput.writeLine("The current directory is: " + File.getDirectory().path);
- }
-
- // Invoke visual debugger for JDK
- var utilities = getScriptObject("\\Java\\Jdk\\Debugger\\utilities.script");
- if (utilities)
- {
- var verbose = gOptions.lookup("ShowAllDebugOutput", 1);
- var jdkDebugger = utilities.CreateJDKDebugger("", "",
- verbose, gOutput, jpdaOptions);
- if (jdkDebugger)
- {
- // Add standard Debug menu
- utilities.AddDebugMenu();
-
- // Set all current breakpoints
- if (utilities.SetBreakpoints(jdkDebugger) == 0)
- {
- gOutput.writeLine("No breakpoints set");
- }
-
- // Go!
- jdkDebugger.sendCommand("run\n");
- }
- }
- }
-
- !!/Script
-