Author: martin
Date: 2006-04-03 13:05:38 -0400 (Mon, 03 Apr 2006)
New Revision: 58962
Modified:
trunk/debugger/frontend/Command.cs
trunk/debugger/frontend/Interpreter.cs
trunk/debugger/frontend/ScriptingContext.cs
Log:
More error handling.
Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs 2006-04-03 16:55:42 UTC (rev 58961)
+++ trunk/debugger/frontend/Command.cs 2006-04-03 17:05:38 UTC (rev 58962)
@@ -104,9 +104,14 @@
Execute (context);
} catch (ThreadAbortException) {
} catch (ScriptingException ex) {
+ Error = true;
engine.Interpreter.Error (ex);
return null;
+ } catch (TargetException ex) {
+ Error = true;
+ engine.Interpreter.Error (ex);
} catch (Exception ex) {
+ Error = true;
engine.Interpreter.Error (
"Caught exception while executing
command {0}: {1}",
this, ex);
@@ -226,18 +231,9 @@
return false;
if (!CurrentThread.IsStopped)
- throw new ScriptingException ("Target is not
stopped.");
+ throw new TargetException
(TargetError.NotStopped);
- try {
- backtrace = CurrentThread.GetBacktrace ();
- } catch (TargetException ex) {
- if (ex.Type == TargetError.NotStopped)
- throw new ScriptingException ("Target
is not stopped.");
- else
- throw new ScriptingException (
- "Cannot get backtrace: {0}",
ex.Message);
- return false;
- }
+ backtrace = CurrentThread.GetBacktrace ();
if (index == -1)
frame = backtrace.CurrentFrame;
Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs 2006-04-03 16:55:42 UTC (rev
58961)
+++ trunk/debugger/frontend/Interpreter.cs 2006-04-03 17:05:38 UTC (rev
58962)
@@ -112,7 +112,7 @@
public Process CurrentProcess {
get {
if (current_process == null)
- throw new ScriptingException ("No
target.");
+ throw new TargetException
(TargetError.NoTarget);
return current_process;
}
@@ -302,7 +302,7 @@
public Process Start ()
{
if ((debugger != null) || (main_process != null))
- throw new ScriptingException ("Program already
started.");
+ throw new TargetException
(TargetError.AlreadyHaveTarget);
Console.WriteLine ("Starting program: {0}",
String.Join (" ",
options.InferiorArgs));
@@ -323,14 +323,14 @@
return current_process;
} catch (TargetException e) {
Kill ();
- throw new ScriptingException (e.Message);
+ throw;
}
}
public Process Attach (int pid)
{
if ((debugger != null) || (main_process != null))
- throw new ScriptingException ("Program already
started.");
+ throw new TargetException
(TargetError.AlreadyHaveTarget);
Console.WriteLine ("Attaching to {0}", pid);
@@ -350,14 +350,14 @@
return current_process;
} catch (TargetException e) {
Kill ();
- throw new ScriptingException (e.Message);
+ throw;
}
}
public Process OpenCoreFile (string core_file)
{
if ((debugger != null) || (main_process != null))
- throw new ScriptingException ("Program already
started.");
+ throw new TargetException
(TargetError.AlreadyHaveTarget);
Console.WriteLine ("Loading core file {0}", core_file);
@@ -378,7 +378,7 @@
return current_process;
} catch (TargetException e) {
Kill ();
- throw new ScriptingException (e.Message);
+ throw;
}
}
@@ -392,7 +392,7 @@
public Process LoadSession (Stream stream)
{
if ((debugger != null) || (main_process != null))
- throw new ScriptingException ("Program already
started.");
+ throw new TargetException
(TargetError.AlreadyHaveTarget);
try {
BinaryFormatter formatter = new BinaryFormatter
();
@@ -413,7 +413,7 @@
return current_process;
} catch (TargetException e) {
Kill ();
- throw new ScriptingException (e.Message);
+ throw;
}
}
@@ -512,7 +512,7 @@
public Thread CurrentThread {
get {
if (current_thread == null)
- throw new ScriptingException ("No
program to debug.");
+ throw new TargetException
(TargetError.NoTarget);
return current_thread;
}
@@ -650,7 +650,6 @@
{
if (debugger != null) {
debugger.Kill ();
- debugger.Dispose ();
debugger = null;
}
}
@@ -707,7 +706,7 @@
public Process[] Processes {
get {
if (debugger == null)
- throw new ScriptingException ("No
target.");
+ throw new TargetException
(TargetError.NoTarget);
return debugger.Processes;
}
Modified: trunk/debugger/frontend/ScriptingContext.cs
===================================================================
--- trunk/debugger/frontend/ScriptingContext.cs 2006-04-03 16:55:42 UTC (rev
58961)
+++ trunk/debugger/frontend/ScriptingContext.cs 2006-04-03 17:05:38 UTC (rev
58962)
@@ -45,11 +45,11 @@
public Process GetProcess ()
{
if (current_thread == null)
- throw new ScriptingException ("No program to
debug.");
+ throw new TargetException
(TargetError.NoTarget);
Process process = current_thread.Process;
if (process == null)
- throw new ScriptingException ("No program to
debug.");
+ throw new TargetException
(TargetError.NoTarget);
return process;
}
@@ -63,7 +63,7 @@
public Thread CurrentThread {
get {
if (current_thread == null)
- throw new ScriptingException ("No
program to debug.");
+ throw new TargetException
(TargetError.NoTarget);
return current_thread;
}
@@ -74,7 +74,7 @@
public StackFrame CurrentFrame {
get {
if (current_frame == null)
- throw new ScriptingException ("No
program to debug.");
+ throw new TargetException
(TargetError.NoTarget);
return current_frame;
}
@@ -86,7 +86,7 @@
{
Thread thread = CurrentThread;
if (!thread.IsStopped)
- throw new ScriptingException ("Target is not
stopped.");
+ throw new TargetException
(TargetError.NotStopped);
if (number == -1)
return thread.CurrentFrame;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches