Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

2002-09-18 Martin Baulig <martin@gnome.org>

	* class/TargetException (TargetException): Made this abstract.

	* class/InternalError.cs: New exception class.

svn path=/trunk/debugger/; revision=7584
  • Loading branch information...
commit 7364827d36b57674b4823aae127671b417b05cc6 1 parent 96493f1
Martin Baulig authored
View
6 ChangeLog
@@ -1,5 +1,11 @@
2002-09-18 Martin Baulig <martin@gnome.org>
+ * class/TargetException (TargetException): Made this abstract.
+
+ * class/InternalError.cs: New exception class.
+
+2002-09-18 Martin Baulig <martin@gnome.org>
+
* interfaces/ITargetMemoryAccess.cs (ITargetMemoryReader.BinaryReader):
Return a TargetBinaryReader instead of a BinaryReader.
View
4 arch/Bfd.cs
@@ -60,10 +60,10 @@ public Bfd (IInferior inferior, string filename, ISourceFileFactory factory)
{
bfd = bfd_openr (filename, null);
if (bfd == IntPtr.Zero)
- throw new TargetException ("Can't read symbol file: " + filename);
+ throw new SymbolTableException ("Can't read symbol file: {0}", filename);
if (!bfd_glue_check_format_object (bfd))
- throw new TargetException ("Not an object file: " + filename);
+ throw new SymbolTableException ("Not an object file: {0}", filename);
this.inferior = inferior;
this.filename = filename;
View
6 backends/Debugger.cs
@@ -573,7 +573,7 @@ void inferior_errors (string line)
public void Run ()
{
if (inferior != null)
- throw new TargetException ("Debugger already has an inferior.");
+ throw new AlreadyHaveTargetException ();
bool native = application == null;
@@ -677,8 +677,6 @@ public void NextLine ()
return;
}
- Console.WriteLine ("RUNNING UNTIL: {0:x}", frame.End);
-
inferior.Step (new StepFrame (
frame.Start, frame.End, null, StepMode.Finish));
}
@@ -693,7 +691,7 @@ public void Finish ()
IStackFrame frame = CurrentFrame;
if (frame.Method == null)
- throw new TargetException ("Can't find bounds of current method");
+ throw new NoMethodException ();
inferior.Step (new StepFrame (
frame.Method.StartAddress, frame.Method.EndAddress, null, StepMode.Finish));
View
43 backends/ptrace/PTrace.cs
@@ -28,21 +28,19 @@ internal enum ChildMessageType {
internal enum CommandError {
NONE = 0,
+ NO_INFERIOR,
+ ALREADY_HAVE_INFERIOR,
+ FORK,
IO,
UNKNOWN,
INVALID_COMMAND,
- NOT_STOPPED
+ NOT_STOPPED,
+ ALIGNMENT,
+ RECURSIVE_CALL,
+ NO_SUCH_BREAKPOINT,
+ UNKNOWN_REGISTER
}
- internal enum ServerCommand {
- GET_PC = 1,
- DETACH,
- SHUTDOWN,
- KILL,
- CONTINUE,
- STEP
- }
-
internal delegate void ChildSetupHandler ();
internal delegate void ChildExitedHandler ();
internal delegate void ChildCallbackHandler (long argument, long data);
@@ -172,9 +170,24 @@ void handle_error (CommandError error)
case CommandError.NOT_STOPPED:
throw new TargetNotStoppedException ();
+ case CommandError.NO_INFERIOR:
+ throw new NoTargetException ();
+
+ case CommandError.ALREADY_HAVE_INFERIOR:
+ throw new AlreadyHaveTargetException ();
+
+ case CommandError.FORK:
+ throw new CannotStartTargetException ();
+
+ case CommandError.NO_SUCH_BREAKPOINT:
+ throw new NoSuchBreakpointException ();
+
+ case CommandError.UNKNOWN_REGISTER:
+ throw new NoSuchRegisterException ();
+
default:
- throw new TargetException (
- "Got unknown error condition from inferior: " + error);
+ throw new InternalError ("Got unknown error condition from inferior: {0}",
+ error);
}
}
@@ -203,7 +216,7 @@ public long CallMethod (TargetAddress method, long method_argument)
method, method_argument, null, null);
mono_debugger_server_wait (server_handle);
if (!result.IsCompleted)
- throw new TargetException ("Call not completed");
+ throw new InternalError ("Call not completed");
return (long) result.AsyncResult;
}
@@ -243,7 +256,7 @@ void insert_temporary_breakpoint (TargetAddress address)
server_handle = mono_debugger_server_initialize ();
if (server_handle == IntPtr.Zero)
- throw new TargetException ("Can't get server handle");
+ throw new InternalError ("mono_debugger_server_initialize() failed.");
check_error (mono_debugger_server_spawn (
server_handle, working_directory, argv, envp, true,
@@ -269,7 +282,7 @@ public Inferior (int pid, string[] envp, ISourceFileFactory factory)
server_handle = mono_debugger_server_initialize ();
if (server_handle == IntPtr.Zero)
- throw new TargetException ("Can't get server handle");
+ throw new InternalError ("mono_debugger_server_initialize() failed.");
check_error (mono_debugger_server_attach (
server_handle, pid, new ChildExitedHandler (child_exited),
View
19 classes/InternalError.cs
@@ -0,0 +1,19 @@
+using System;
+
+namespace Mono.Debugger
+{
+ public class InternalError : Exception
+ {
+ public InternalError ()
+ : base ("Internal error.")
+ { }
+
+ public InternalError (string message, params object[] args)
+ : base (String.Format (message, args))
+ { }
+
+ public InternalError (Exception inner, string message, params object[] args)
+ : base (String.Format (message, args), inner)
+ { }
+ }
+}
View
43 classes/TargetException.cs
@@ -2,17 +2,31 @@
namespace Mono.Debugger
{
- public class TargetException : Exception
+ public abstract class TargetException : Exception
{
public TargetException (string message)
: base (message)
{ }
}
+ public class CannotStartTargetException : TargetException
+ {
+ public CannotStartTargetException ()
+ : base ("Cannot start target")
+ { }
+ }
+
+ public class AlreadyHaveTargetException : TargetException
+ {
+ public AlreadyHaveTargetException ()
+ : base ("I already have a program to debug, can't debug a second one.")
+ { }
+ }
+
public class NoTargetException : TargetException
{
public NoTargetException ()
- : base ("There is no program to debug")
+ : base ("There is no program to debug.")
{ }
}
@@ -20,18 +34,35 @@ public class TargetNotStoppedException : TargetException
{
public TargetNotStoppedException ()
: base ("The target is currently running, but it must be stopped to perform " +
- "the requested operation")
+ "the requested operation.")
{ }
}
public class NoStackException : TargetException
{
public NoStackException ()
- : this ("No stack")
+ : base ("No stack.")
{ }
+ }
- public NoStackException (string message)
- : base (message)
+ public class NoMethodException : TargetException
+ {
+ public NoMethodException ()
+ : base ("Cannot get bounds of current method.")
+ { }
+ }
+
+ public class NoSuchBreakpointException : TargetException
+ {
+ public NoSuchBreakpointException ()
+ : base ("No such breakpoint.")
+ { }
+ }
+
+ public class NoSuchRegisterException : TargetException
+ {
+ public NoSuchRegisterException ()
+ : base ("No such registers.")
{ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.