|
From: <caw...@us...> - 2007-01-20 22:05:04
|
Revision: 1829
http://svn.sourceforge.net/rubyeclipse/?rev=1829&view=rev
Author: cawilliams
Date: 2007-01-20 14:05:00 -0800 (Sat, 20 Jan 2007)
Log Message:
-----------
attempting to fix debugging support again - I may need help here, but this looks OK to me
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -59,7 +59,7 @@
public String registerRdebugExtension(String pathToRdebugExtension) throws IOException, RubyProcessingException {
// should be called before start
- if (!isRubyDebug) {
+ if (!isRubyDebug) { // Should never happen
return "false";
}
try {
@@ -71,8 +71,7 @@
String expression = "eval require '" + pathToRdebugExtension + "'";
println(expression);
EvalReader reader = new EvalReader(getMultiReaderStrategy());
- return reader.readEvalResult(); // throws
- // RubyProcessingException
+ return reader.readEvalResult(); // throws RubyProcessingException
}
public void start() throws RubyProcessingException {
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -18,7 +18,6 @@
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IThread;
-import org.rubypeople.rdt.core.SocketUtil;
import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
import org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy;
import org.rubypeople.rdt.internal.debug.core.SuspensionPoint;
@@ -29,28 +28,38 @@
// This kind of Adapter is deliverd from the DebugElementAdapterFactory.
public class RubyDebugTarget extends PlatformObject implements IRubyDebugTarget {
- private static int DEFAULT_PORT = 1098 ;
+ private static int DEFAULT_PORT = 1098;
private IProcess process;
private boolean isTerminated;
private ILaunch launch;
private RubyThread[] threads;
private RubyDebuggerProxy rubyDebuggerProxy;
- private int port = -1 ;
+ private int port;
private File debugParameterFile;
public RubyDebugTarget(ILaunch launch) {
- this(launch, null) ;
+ this(launch, null);
}
public RubyDebugTarget(ILaunch launch, IProcess process) {
+ this(launch, process, DEFAULT_PORT);
+ }
+
+ public RubyDebugTarget(ILaunch launch, IProcess process, int port) {
this.launch = launch;
+ this.port = port;
this.process = process;
this.threads = new RubyThread[0] ;
this.isTerminated = false ;
IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
manager.addBreakpointListener(this);
+ addDebugParameter("$EclipseListenPort=" + port);
}
+ public RubyDebugTarget(ILaunch launch, int port) {
+ this(launch, null, port);
+ }
+
public void updateThreads() {
// preconditions:
// 1) both threadInfos and updatedThreads are sorted by their id attribute
@@ -75,7 +84,6 @@
}
}
threads = updatedThreads;
-
}
protected RubyThread getThreadById(int id) {
@@ -244,42 +252,29 @@
RdtDebugCorePlugin.log("Could not create debugParameterFile", e) ;
}
}
- return debugParameterFile ;
+ return debugParameterFile;
}
- public boolean addDebugParameter(String line) {
+ private boolean addDebugParameter(String line) {
+ PrintWriter writer = null;
try {
- FileWriter writer = new FileWriter(this.getDebugParameterFile());
- new PrintWriter(writer).println(line);
+ writer = new PrintWriter(new FileWriter(getDebugParameterFile()));
+ writer.println(line);
writer.flush();
- writer.close();
return true;
} catch (IOException ex) {
RdtDebugCorePlugin.log(ex);
return false;
+ } finally {
+ writer.close();
}
}
public int getPort() {
- if (port == -1) {
- port = SocketUtil.findFreePort() ;
- // port can still be -1, if findFreePort fails
- if (port != -1) {
- // see eclipseDebug.rb for how $EclipseListenPort is used from ruby side
- if (!addDebugParameter("$EclipseListenPort=" + port)) {
- port = -1 ;
- }
- }
- // if we couldn't find a free port a write the free port to the file, use the default
- if (port == -1) {
- port = DEFAULT_PORT ;
- }
- RdtDebugCorePlugin.debug("Using port: " + port) ;
- }
- return port ;
+ return port;
}
public boolean isUsingDefaultPort() {
- return this.getPort() == DEFAULT_PORT ;
+ return getPort() == DEFAULT_PORT ;
}
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -74,6 +74,14 @@
public static String JavaRuntime_Classpath_references_non_existant_archive___0__4;
public static String JavaRuntime_Classpath_references_non_existant_project___0__3;
public static String JavaRuntime_Could_not_resolve_classpath_container___0__1;
+ public static String StandardVMDebugger_Launching_VM____1;
+ public static String StandardVMDebugger_Finding_free_socket____2;
+ public static String StandardVMDebugger_Could_not_find_a_free_socket_for_the_debugger_1;
+ public static String StandardVMDebugger_Constructing_command_line____3;
+ public static String StandardVMDebugger_Starting_virtual_machine____4;
+ public static String StandardVMDebugger_Establishing_debug_connection____5;
+ public static String StandardVMDebugger_Couldn__t_connect_to_VM_4;
+ public static String StandardVMDebugger_Couldn__t_connect_to_VM_5;
private LaunchingMessages() {}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties 2007-01-20 22:05:00 UTC (rev 1829)
@@ -21,10 +21,7 @@
vmInstall_assert_idNotNull=id cannot be null
vmInstall_assert_typeNotNull=VM type cannot be null
-AbstractInterpreterInstall_0=Unable to retrieve system properties
-AbstractInterpreterInstall_1=Evaluating system properties
-AbstractInterpreterInstall_3=Reading system properties
-AbstractInterpreterInstall_4=Exception retrieving system properties
+
LaunchingPlugin_33=Unable to create XML parser.
LaunchingPlugin_34=Unable to create XML parser.
vmInstallType_duplicateVM=Duplicate VM: {0}
@@ -32,4 +29,70 @@
StandardVMType_Standard_VM_not_supported_on_MacOS__1=Standard VM not supported on MacOS.
StandardVMType_Not_a_JDK_Root__Java_executable_was_not_found_1=Target is not a Ruby installation root. Ruby executable was not found
StandardVMType_ok_2=ok
-StandardVMType_Not_a_JDK_root__System_library_was_not_found__1=Target is not a Ruby installation root. System library was not found.
\ No newline at end of file
+StandardVMType_Not_a_JDK_root__System_library_was_not_found__1=Target is not a Ruby installation root. System library was not found.
+
+AbstractVMRunner_0=An IProcess could not be created for the launch
+AbstractInterpreterInstall_0=Unable to retrieve system properties
+AbstractInterpreterInstall_1=Evaluating system properties
+AbstractInterpreterInstall_3=Reading system properties
+AbstractInterpreterInstall_4=Exception retrieving system properties
+
+
+vmRunnerConfig_assert_classNotNull=classToLaunch cannot be null
+vmRunnerConfig_assert_classPathNotNull=loadPath cannot be null
+vmRunnerConfig_assert_programArgsNotNull=args cannot be null
+vmRunnerConfig_assert_vmArgsNotNull=args cannot be null
+
+
+StandardVMRunner__0____1___2={0} ({1})
+StandardVMRunner__0__at_localhost__1__1={0} at localhost:{1}
+StandardVMRunner_Specified_working_directory_does_not_exist_or_is_not_a_directory___0__3=Specified working directory does not exist or is not a directory: {0}
+StandardVMRunner_Launching_VM____1=Launching VM...
+StandardVMRunner_Constructing_command_line____2=Constructing command line...
+StandardVMRunner_Starting_virtual_machine____3=Starting virtual machine...
+StandardVMRunner_Unable_to_locate_executable_for__0__1=Unable to locate executable for {0}
+StandardVMRunner_Specified_executable__0__does_not_exist_for__1__4=Specified executable {0} does not exist for {1}
+
+JavaLocalApplicationLaunchConfigurationDelegate_Verifying_launch_attributes____1=Verifying launch attributes...
+JavaLocalApplicationLaunchConfigurationDelegate_Creating_source_locator____2=Creating source locator...
+
+AbstractJavaLaunchConfigurationDelegate_The_specified_JRE_installation_does_not_exist_4=
+AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_not_specified_for__0__5=
+AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_for__0__does_not_exist___1__6=
+JavaLocalApplicationLaunchConfigurationDelegate_0=
+JavaRuntime_Specified_VM_install_type_does_not_exist___0__2=
+JavaRuntime_Specified_VM_install_not_found__type__0___name__1__2=
+JavaRuntime_VM_not_fully_specified_in_launch_configuration__0____missing_VM_name__Reverting_to_default_VM__1=
+JavaRuntime_Launch_configuration__0__references_non_existing_project__1___1=
+AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12=
+AbstractJavaLaunchConfigurationDelegate_Main_type_not_specified_11=
+RuntimeLoadpathEntry_Illegal_classpath_entry__0__1=
+RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_type_2=
+RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_location_3=
+RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_project_name_4=
+RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_archive_path_5=
+RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_variable_name_6=
+RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8=
+
+DefaultProjectLoadpathEntry_4={0} (default loadpath)
+DefaultProjectLoadpathEntry_2={0} (default loadpath - exported entries only)
+DefaultProjectLoadpathEntry_3==Invalid memento - expecting name attribute
+
+JavaRuntime_26=Referenced classpath provider does not exist: {0}
+JavaRuntime_28=Launch configuration {0} references closed project {1}
+JavaRuntime_31=Unable to restore classpath entry.
+JavaRuntime_32=Unable to restore classpath entry.
+
+LaunchingPlugin_32=
+JavaRuntime_Classpath_references_non_existant_archive___0__4=
+JavaRuntime_Classpath_references_non_existant_project___0__3=
+JavaRuntime_Could_not_resolve_classpath_container___0__1=
+
+StandardVMDebugger_Could_not_find_a_free_socket_for_the_debugger_1=Cannot find a free socket for the debugger
+StandardVMDebugger_Couldn__t_connect_to_VM_4=Cannot connect to VM
+StandardVMDebugger_Couldn__t_connect_to_VM_5=Cannot connect to VM
+StandardVMDebugger_Launching_VM____1=Launching VM...
+StandardVMDebugger_Finding_free_socket____2=Finding free socket...
+StandardVMDebugger_Constructing_command_line____3=Constructing command line...
+StandardVMDebugger_Starting_virtual_machine____4=Starting virtual machine...
+StandardVMDebugger_Establishing_debug_connection____5=Establishing debug connection...
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -0,0 +1,64 @@
+package org.rubypeople.rdt.internal.launching;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy;
+import org.rubypeople.rdt.internal.debug.core.model.RubyDebugTarget;
+import org.rubypeople.rdt.internal.debug.core.model.RubyProcessingException;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.VMRunnerConfiguration;
+
+public class RDebugVMDebugger extends StandardVMDebugger {
+
+ public RDebugVMDebugger(IVMInstall vmInstance) {
+ super(vmInstance);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.rubypeople.rdt.launching.IVMRunner#run(org.rubypeople.rdt.launching.VMRunnerConfiguration,
+ * org.eclipse.debug.core.ILaunch,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(VMRunnerConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ // Set it up to use rdebug executable
+ Map map = config.getVMSpecificAttributesMap();
+ if (map == null) map = new HashMap();
+ map.put(IRubyLaunchConfigurationConstants.ATTR_RUBY_COMMAND, "rdebug");
+ config.setVMSpecificAttributesMap(map);
+
+ super.run(config, launch, monitor);
+ }
+
+ protected List<String> debugSpecificVMArgs(RubyDebugTarget debugTarget) {
+ List<String> arguments = new ArrayList<String>();
+ arguments.add("--server");
+ arguments.add("--port");
+ arguments.add(Integer.toString(debugTarget.getPort()));
+ arguments.add("--cport");
+ arguments.add(Integer.toString(debugTarget.getPort() + 1));
+ arguments.add("-w");
+ if (isDebuggerVerbose()) {
+ arguments.add("-d");
+ }
+ arguments.add("-f");
+ arguments.add("xml");
+ return arguments;
+ }
+
+ protected void updateProxy(RubyDebuggerProxy proxy) throws IOException, RubyProcessingException {
+ proxy.registerRdebugExtension(getDirectoryOfRubyDebuggerFile() + File.separator + "rdebugExtension.rb");
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -18,11 +18,18 @@
if (ILaunchManager.RUN_MODE.equals(mode)) {
return new StandardVMRunner(this);
} else if (ILaunchManager.DEBUG_MODE.equals(mode)) {
+ if (useRDebug()) {
+ return new RDebugVMDebugger(this);
+ }
return new StandardVMDebugger(this);
}
return null;
}
+ private boolean useRDebug() {
+ return LaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.USE_RUBY_DEBUG);
+ }
+
public String getRubyVersion() {
StandardVMType installType = (StandardVMType) getVMInstallType();
File installLocation = getInstallLocation();
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -1,13 +1,187 @@
package org.rubypeople.rdt.internal.launching;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+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.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.SocketUtil;
+import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
+import org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy;
+import org.rubypeople.rdt.internal.debug.core.model.RubyDebugTarget;
+import org.rubypeople.rdt.internal.debug.core.model.RubyProcessingException;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.IVMInstall;
import org.rubypeople.rdt.launching.IVMRunner;
+import org.rubypeople.rdt.launching.VMRunnerConfiguration;
public class StandardVMDebugger extends StandardVMRunner implements IVMRunner {
public StandardVMDebugger(IVMInstall vmInstance) {
super(vmInstance);
- // TODO Auto-generated constructor stub
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jdt.launching.IVMRunner#run(org.eclipse.jdt.launching.VMRunnerConfiguration,
+ * org.eclipse.debug.core.ILaunch,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(VMRunnerConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+ subMonitor.beginTask(LaunchingMessages.StandardVMDebugger_Launching_VM____1, 4);
+ subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Finding_free_socket____2);
+
+ int port = SocketUtil.findFreePort();
+ if (port == -1) {
+ abort(LaunchingMessages.StandardVMDebugger_Could_not_find_a_free_socket_for_the_debugger_1, null, IRubyLaunchConfigurationConstants.ERR_NO_SOCKET_AVAILABLE);
+ }
+
+ subMonitor.worked(1);
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Constructing_command_line____3);
+
+ RubyDebugTarget debugTarget = new RubyDebugTarget(launch, port);
+
+ String program = constructProgramString(config);
+
+ List<String> arguments = new ArrayList<String>(12);
+
+ arguments.add(program);
+
+ // VM args are the first thing after the ruby program so that users can
+ // specify
+ // options like '-client' & '-server' which are required to be the first
+ // options
+ String[] allVMArgs = combineVmArgs(config, fVMInstance);
+ addArguments(allVMArgs, arguments);
+
+ String[] cp = config.getLoadPath();
+ if (cp.length > 0) {
+ arguments.addAll(convertLoadPath(cp));
+ }
+
+ arguments.addAll(debugSpecificVMArgs(debugTarget));
+
+ arguments.add(StandardVMRunner.END_OF_OPTIONS_DELIMITER);
+
+ arguments.add(config.getFileToLaunch());
+ addArguments(config.getProgramArguments(), arguments);
+ String[] cmdLine = new String[arguments.size()];
+ arguments.toArray(cmdLine);
+
+ String[] envp = config.getEnvironment();
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ subMonitor.worked(1);
+ subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Starting_virtual_machine____4);
+
+ Process p = null;
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ File workingDir = getWorkingDir(config);
+ p = exec(cmdLine, workingDir, envp);
+ if (p == null) {
+ return;
+ }
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ p.destroy();
+ return;
+ }
+
+ IProcess process = newProcess(launch, p, renderProcessLabel(cmdLine), getDefaultProcessMap());
+ process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(cmdLine));
+ subMonitor.worked(1);
+ subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Establishing_debug_connection____5);
+
+ debugTarget.setProcess(process);
+ RubyDebuggerProxy proxy = new RubyDebuggerProxy(debugTarget, true);
+
+ if (proxy.checkConnection()) {
+ try {
+ updateProxy(proxy);
+ proxy.start();
+ launch.addDebugTarget(debugTarget);
+ } catch (IOException e) {
+ abort(LaunchingMessages.StandardVMDebugger_Couldn__t_connect_to_VM_4, e, IRubyLaunchConfigurationConstants.ERR_CONNECTION_FAILED);
+ } catch (RubyProcessingException e) {
+ abort(LaunchingMessages.StandardVMDebugger_Couldn__t_connect_to_VM_5, e, IRubyLaunchConfigurationConstants.ERR_CONNECTION_FAILED);
+ } finally {
+ // FIXME Should this always terminate, or just on exceptions?
+ debugTarget.terminate();
+ }
+ } else {
+ LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, LaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection, null));
+ debugTarget.terminate();
+ }
+ if (p != null) {
+ p.destroy();
+ }
+ }
+
+ /**
+ * A method to set up the RubyDebuggerProxy prior to launching
+ * @param proxy
+ * @throws IOException
+ * @throws RubyProcessingException
+ */
+ protected void updateProxy(RubyDebuggerProxy proxy) throws IOException, RubyProcessingException {
+ // do nothing, needed for rdebug
+ }
+
+ protected List<String> debugSpecificVMArgs(RubyDebugTarget debugTarget) {
+ List<String> arguments = new ArrayList<String>();
+ if (!debugTarget.isUsingDefaultPort()) {
+ arguments.add("-r" + debugTarget.getDebugParameterFile().getAbsolutePath());
+ }
+
+ if (RdtDebugCorePlugin.isRubyDebuggerVerbose() || isDebuggerVerbose()) {
+ arguments.add("-reclipseDebugVerbose");
+ } else {
+ arguments.add("-reclipseDebug");
+ }
+ // FIXME Somehow hook this into the loadpath stuff?
+ arguments.add("-I");
+ arguments.add(LaunchingPlugin.osDependentPath(getDirectoryOfRubyDebuggerFile().replace('/', File.separatorChar)));
+ return arguments;
+ }
+
+ protected static boolean isDebuggerVerbose() {
+ return LaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.VERBOSE_DEBUGGER);
+ }
+
+ protected static String getDirectoryOfRubyDebuggerFile() {
+ return RubyCore.getOSDirectory(LaunchingPlugin.getDefault()) + "ruby";
+ }
+
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -32,7 +32,7 @@
public class StandardVMRunner extends AbstractVMRunner {
- private static final String END_OF_OPTIONS_DELIMITER = "--";
+ protected static final String END_OF_OPTIONS_DELIMITER = "--";
protected IVMInstall fVMInstance;
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-20 22:03:22 UTC (rev 1828)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-20 22:05:00 UTC (rev 1829)
@@ -41,6 +41,18 @@
public static final int ERR_WORKING_DIRECTORY_DOES_NOT_EXIST = 108;
/**
+ * Status code indicating that a free socket was not available to
+ * communicate with the VM.
+ */
+ public static final int ERR_NO_SOCKET_AVAILABLE = 118;
+
+ /**
+ * Status code indicating that the debugger failed to connect
+ * to the VM.
+ */
+ public static final int ERR_CONNECTION_FAILED = 120;
+
+ /**
* Status code indicating that the project referenced by a launch configuration
* is closed.
*
@@ -175,7 +187,6 @@
* loadpath is generated by the loadpath provider associated with a launch
* configuration (via the <code>ATTR_LOADPATH_PROVIDER</code> attribute).
*/
- public static final String ATTR_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH"; //$NON-NLS-1$
+ public static final String ATTR_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH"; //$NON-NLS-1$
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|