home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 67 / IOPROG_67A.ISO / soft / Tools / mwsppv4.exe / DEBUGEXTERNALJPDA.SCRIPT < prev    next >
Encoding:
Text File  |  2002-10-08  |  2.3 KB  |  92 lines

  1. !!include "Library\jdkUtilities.script"
  2. !!Script
  3. // Copyright ⌐ 1997-2002 - Modelworks Software
  4.  
  5. /**   
  6. @Tool: debugJPDAExternal~debug using the IDE's visual 
  7. debugger. You must start the external program using the
  8. following options: "-Xdebug -Xnoagent -Djava.compiler=NONE 
  9. -Xrunjdwp:transport=dt_socket,server=y,address=nnnn". 
  10. @EndTool: 
  11. @Summary: debugExternal~runs the JPDA java debugger
  12. */
  13.  
  14. var gOutput = getOutput("Debug");
  15. var gHelpers = getMapFile("ApplicationHelpers");   
  16. var gOptions = getMapFile("JDKToolsStandardOptions");
  17.  
  18. // Define the following variables - only the port has to be defined.
  19. var gWorkingdirectory = "";
  20. var gVMport = "53006";
  21. var gVMhost = "";
  22.  
  23. function DoCommand()
  24. {
  25.     if (getGlobal("JDKDebugger", null) != null)
  26.     {
  27.         alert("A debug session is already open");
  28.         return;
  29.     }
  30.     
  31.     
  32.     RunDebugger();
  33.  
  34. function RunDebugger()
  35. {
  36.     if (gVMport == "")
  37.     {
  38.         alert("You must edit this script before running it.");
  39.         return;
  40.     }
  41.     
  42.     // Save all open files
  43.     saveAll();
  44.     
  45.     gOutput.clear();
  46.     gOutput.setActive();
  47.  
  48.     var jpdaOptions = "server=y,address=";
  49.     if (gVMhost != "")
  50.     {
  51.         jpdaOptions += gVMhost + ":";
  52.     }
  53.     jpdaOptions += gVMport;
  54.     
  55.     if (gWorkingdirectory.length > 0)
  56.     {
  57.         File.setDirectory(gWorkingdirectory);
  58.     }
  59.     
  60.     gOutput.writeLine("Starting debugger... ");
  61.     if (gOptions.lookup("showCommandLine",false)==true)
  62.     {
  63.         gOutput.writeLine("The current directory is: " + File.getDirectory().path);
  64.     }
  65.     
  66.     // Invoke visual debugger for JDK
  67.     var utilities = getScriptObject("\\Java\\Jdk\\Debugger\\utilities.script");
  68.     if (utilities)
  69.     {
  70.         var verbose = gOptions.lookup("ShowAllDebugOutput", 1);
  71.         var jdkDebugger = utilities.CreateJDKDebugger("", "", 
  72.             verbose, gOutput, jpdaOptions); 
  73.         if (jdkDebugger)
  74.         {
  75.             // Add standard Debug menu
  76.             utilities.AddDebugMenu();
  77.             
  78.             // Set all current breakpoints
  79.             if (utilities.SetBreakpoints(jdkDebugger) == 0)
  80.             {
  81.                 gOutput.writeLine("No breakpoints set");
  82.             }
  83.             
  84.             // Go!
  85.             jdkDebugger.sendCommand("run\n");
  86.         }
  87.     }
  88. }
  89.  
  90. !!/Script
  91.