Author: martin
Date: 2005-10-11 09:46:00 -0400 (Tue, 11 Oct 2005)
New Revision: 51570
Added:
trunk/debugger/classes/Method.cs
Removed:
trunk/debugger/classes/MethodBase.cs
trunk/debugger/interfaces/IMethod.cs
Modified:
trunk/debugger/ChangeLog
trunk/debugger/arch/BfdDisassembler.cs
trunk/debugger/arch/DwarfReader.cs
trunk/debugger/backends/Process.cs
trunk/debugger/backends/SingleSteppingEngine.cs
trunk/debugger/backends/TargetAccess.cs
trunk/debugger/classes/Backtrace.cs
trunk/debugger/classes/MethodSource.cs
trunk/debugger/classes/SourceInfo.cs
trunk/debugger/classes/StackFrame.cs
trunk/debugger/classes/SymbolTable.cs
trunk/debugger/classes/SymbolTableCollection.cs
trunk/debugger/frontend/Command.cs
trunk/debugger/frontend/Completer.cs
trunk/debugger/frontend/Expression.cs
trunk/debugger/frontend/ScriptingContext.cs
trunk/debugger/interfaces/IDisassembler.cs
trunk/debugger/interfaces/ISymbolFile.cs
trunk/debugger/interfaces/ISymbolTable.cs
trunk/debugger/languages/mono/MonoSymbolFile.cs
trunk/debugger/languages/mono/MonoVariable.cs
Log:
2005-10-11 Martin Baulig <[EMAIL PROTECTED]>
* classes/MethodBase.cs: Renamed to Method.cs.
(MethodBase): Renamed to `Method'.
* classes/Method.cs (Method): This abstract base class now
replaces the `IMethod' interface.
* interfaces/IMethod.cs: Removed.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2005-10-11 13:35:09 UTC (rev 51569)
+++ trunk/debugger/ChangeLog 2005-10-11 13:46:00 UTC (rev 51570)
@@ -1,5 +1,15 @@
2005-10-11 Martin Baulig <[EMAIL PROTECTED]>
+ * classes/MethodBase.cs: Renamed to Method.cs.
+ (MethodBase): Renamed to `Method'.
+
+ * classes/Method.cs (Method): This abstract base class now
+ replaces the `IMethod' interface.
+
+ * interfaces/IMethod.cs: Removed.
+
+2005-10-11 Martin Baulig <[EMAIL PROTECTED]>
+
* interfaces/IArchitecture.cs (IArchitecture): Replaced this
interfaces with the abstract class `Architecture'.
Modified: trunk/debugger/arch/BfdDisassembler.cs
===================================================================
--- trunk/debugger/arch/BfdDisassembler.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/arch/BfdDisassembler.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -64,7 +64,7 @@
StringBuilder sb;
Exception memory_exception;
- IMethod current_method;
+ Method current_method;
void output_func (string output)
{
if (sb != null)
@@ -134,7 +134,7 @@
}
}
- public AssemblerMethod DisassembleMethod (IMethod method)
+ public AssemblerMethod DisassembleMethod (Method method)
{
lock (this) {
ArrayList list = new ArrayList ();
@@ -157,7 +157,7 @@
}
}
- public AssemblerLine DisassembleInstruction (IMethod method,
TargetAddress address)
+ public AssemblerLine DisassembleInstruction (Method method,
TargetAddress address)
{
lock (this) {
memory_exception = null;
Modified: trunk/debugger/arch/DwarfReader.cs
===================================================================
--- trunk/debugger/arch/DwarfReader.cs 2005-10-11 13:35:09 UTC (rev 51569)
+++ trunk/debugger/arch/DwarfReader.cs 2005-10-11 13:46:00 UTC (rev 51570)
@@ -227,7 +227,7 @@
}
}
- IMethod ISymbolFile.GetMethod (long handle)
+ Method ISymbolFile.GetMethod (long handle)
{
DwarfTargetMethod method = (DwarfTargetMethod)
method_hash [handle];
if ((method == null) || !method.CheckLoaded ())
@@ -311,7 +311,7 @@
ArrayList compile_units;
bool initialized;
- public IMethod Lookup (TargetAddress address)
+ public Method Lookup (TargetAddress address)
{
build_symtabs ();
return symtabs.Lookup (address);
@@ -2192,7 +2192,7 @@
return 0;
}
- public IMethod Method {
+ public Method Method {
get {
if (method == null)
throw new
InvalidOperationException ();
@@ -2301,7 +2301,7 @@
}
}
- protected class DwarfTargetMethod : MethodBase
+ protected class DwarfTargetMethod : Method
{
LineNumberEngine engine;
DieSubprogram subprog;
Modified: trunk/debugger/backends/Process.cs
===================================================================
--- trunk/debugger/backends/Process.cs 2005-10-11 13:35:09 UTC (rev 51569)
+++ trunk/debugger/backends/Process.cs 2005-10-11 13:46:00 UTC (rev 51570)
@@ -274,7 +274,7 @@
// unnecessarily compute this several times if more than one
client
// accesses this property.
// </summary>
- public IMethod CurrentMethod {
+ public Method CurrentMethod {
get {
check_engine ();
return engine.CurrentMethod;
@@ -512,13 +512,13 @@
return engine.GetInstructionSize (address);
}
- public AssemblerLine DisassembleInstruction (IMethod method,
TargetAddress address)
+ public AssemblerLine DisassembleInstruction (Method method,
TargetAddress address)
{
check_engine ();
return engine.DisassembleInstruction (method, address);
}
- public AssemblerMethod DisassembleMethod (IMethod method)
+ public AssemblerMethod DisassembleMethod (Method method)
{
check_engine ();
return engine.DisassembleMethod (method);
Modified: trunk/debugger/backends/SingleSteppingEngine.cs
===================================================================
--- trunk/debugger/backends/SingleSteppingEngine.cs 2005-10-11 13:35:09 UTC
(rev 51569)
+++ trunk/debugger/backends/SingleSteppingEngine.cs 2005-10-11 13:46:00 UTC
(rev 51570)
@@ -78,7 +78,7 @@
// This is invoked after compiling a trampoline - it returns
whether or
// not we should enter that trampoline.
// </summary>
- internal delegate bool TrampolineHandler (IMethod method);
+ internal delegate bool TrampolineHandler (Method method);
protected SingleSteppingEngine (ThreadManager manager, Inferior
inferior)
{
@@ -559,7 +559,7 @@
current_symtab = symbol_table;
}
- public IMethod Lookup (TargetAddress address)
+ public Method Lookup (TargetAddress address)
{
inferior.Debugger.UpdateSymbolTable (inferior);
@@ -633,7 +633,7 @@
get { return current_frame; }
}
- public IMethod CurrentMethod {
+ public Method CurrentMethod {
get { return current_method; }
}
@@ -848,7 +848,7 @@
// If we have a current_method and the address is still
inside
// that method, we don't need to do a method lookup.
if ((current_method == null) ||
- (!MethodBase.IsInSameMethod (current_method,
address))) {
+ (!Method.IsInSameMethod (current_method, address)))
{
current_method = Lookup (address);
}
@@ -892,7 +892,7 @@
// Only do a method lookup if we actually need it.
if ((current_method != null) &&
- MethodBase.IsInSameMethod (current_method, address))
+ Method.IsInSameMethod (current_method, address))
same_method = true;
else
current_method = Lookup (address);
@@ -946,7 +946,7 @@
// that we don't stop somewhere inside a method's prologue
code or
// between two source lines.
// </summary>
- Operation check_method_operation (TargetAddress address,
IMethod method,
+ Operation check_method_operation (TargetAddress address, Method
method,
SourceAddress source,
Operation operation)
{
// Do nothing if this is not a source stepping
operation.
@@ -1091,7 +1091,7 @@
}
if (compile.IsNull) {
- IMethod method = null;
+ Method method = null;
if (current_symtab != null) {
method = Lookup (trampoline);
}
@@ -1108,7 +1108,7 @@
return;
}
- protected static bool MethodHasSource (IMethod method)
+ protected static bool MethodHasSource (Method method)
{
if (method == null)
return false;
@@ -1471,7 +1471,7 @@
}
[Command]
- public AssemblerLine DisassembleInstruction (IMethod method,
TargetAddress address)
+ public AssemblerLine DisassembleInstruction (Method method,
TargetAddress address)
{
lock (disassembler) {
return disassembler.DisassembleInstruction
(method, address);
@@ -1479,7 +1479,7 @@
}
[Command]
- public AssemblerMethod DisassembleMethod (IMethod method)
+ public AssemblerMethod DisassembleMethod (Method method)
{
lock (disassembler) {
return disassembler.DisassembleMethod (method);
@@ -1591,7 +1591,7 @@
}
#endregion
- protected IMethod current_method;
+ protected Method current_method;
protected StackFrame current_frame;
protected Backtrace current_backtrace;
protected Registers registers;
@@ -1632,13 +1632,13 @@
#region Nested SSE classes
internal sealed class StackData
{
- public readonly IMethod Method;
+ public readonly Method Method;
public readonly TargetAddress Address;
public readonly StackFrame Frame;
public readonly Backtrace Backtrace;
public readonly Registers Registers;
- public StackData (IMethod method, TargetAddress address,
+ public StackData (Method method, TargetAddress address,
StackFrame frame, Backtrace backtrace,
Registers registers)
{
@@ -1822,7 +1822,7 @@
return;
}
- IMethod method = sse.Lookup (sse.inferior.CurrentFrame);
+ Method method = sse.Lookup (sse.inferior.CurrentFrame);
if (method == null) {
sse.inferior.Step ();
@@ -1950,7 +1950,7 @@
return false;
}
- protected abstract bool TrampolineHandler (IMethod method);
+ protected abstract bool TrampolineHandler (Method method);
}
protected class OperationStep : OperationStepBase
@@ -2053,7 +2053,7 @@
return true;
}
- protected override bool TrampolineHandler (IMethod method)
+ protected override bool TrampolineHandler (Method method)
{
if (method == null)
return false;
@@ -2129,7 +2129,7 @@
* If it can't be found in the symbol tables, assume
it's a system function
* and step over it.
*/
- IMethod method = sse.Lookup (call);
+ Method method = sse.Lookup (call);
/*
* If this is a PInvoke/icall wrapper, check whether we
want to step into
@@ -2288,7 +2288,7 @@
return true;
}
- protected override bool TrampolineHandler (IMethod method)
+ protected override bool TrampolineHandler (Method method)
{
return false;
}
@@ -2676,7 +2676,7 @@
RestoreStack (sse);
completed = true;
- IMethod method = sse.Lookup (address);
+ Method method = sse.Lookup (address);
Report.Debug (DebugFlags.SSE,
"{0} compiled method: {1} {2} {3} {4}
{5}",
sse, address, method,
@@ -2797,9 +2797,9 @@
protected class OperationWrapper : OperationStepBase
{
- IMethod method;
+ Method method;
- public OperationWrapper (IMethod method)
+ public OperationWrapper (Method method)
{
this.method = method;
}
@@ -2835,7 +2835,7 @@
return false;
}
- protected override bool TrampolineHandler (IMethod method)
+ protected override bool TrampolineHandler (Method method)
{
if (method == null)
return false;
Modified: trunk/debugger/backends/TargetAccess.cs
===================================================================
--- trunk/debugger/backends/TargetAccess.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/backends/TargetAccess.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -53,10 +53,10 @@
internal abstract object Invoke (TargetAccessDelegate func,
object data);
- public abstract AssemblerLine DisassembleInstruction (IMethod
method,
+ public abstract AssemblerLine DisassembleInstruction (Method
method,
TargetAddress address);
- public abstract AssemblerMethod DisassembleMethod (IMethod
method);
+ public abstract AssemblerMethod DisassembleMethod (Method
method);
//
// ISerializable
@@ -133,13 +133,13 @@
throw new InvalidOperationException ();
}
- public override AssemblerLine DisassembleInstruction (IMethod
method,
+ public override AssemblerLine DisassembleInstruction (Method
method,
TargetAddress address)
{
return process.DisassembleInstruction (method, address);
}
- public override AssemblerMethod DisassembleMethod (IMethod
method)
+ public override AssemblerMethod DisassembleMethod (Method
method)
{
return process.DisassembleMethod (method);
}
@@ -199,7 +199,7 @@
return sse.ThreadManager.SendCommand (sse,
func, data);
}
- public override AssemblerLine DisassembleInstruction (IMethod
method,
+ public override AssemblerLine DisassembleInstruction (Method
method,
TargetAddress address)
{
if (sse.ThreadManager.InBackgroundThread)
@@ -208,7 +208,7 @@
return sse.Process.DisassembleInstruction
(method, address);
}
- public override AssemblerMethod DisassembleMethod (IMethod
method)
+ public override AssemblerMethod DisassembleMethod (Method
method)
{
if (sse.ThreadManager.InBackgroundThread)
return sse.DisassembleMethod (method);
Modified: trunk/debugger/classes/Backtrace.cs
===================================================================
--- trunk/debugger/classes/Backtrace.cs 2005-10-11 13:35:09 UTC (rev 51569)
+++ trunk/debugger/classes/Backtrace.cs 2005-10-11 13:46:00 UTC (rev 51570)
@@ -104,7 +104,7 @@
protected SimpleStackFrame UnwindStack (ITargetMemoryAccess
memory,
Architecture arch)
{
- IMethod method = last_frame.Method;
+ Method method = last_frame.Method;
SimpleStackFrame new_frame = null;
if (method != null) {
try {
Copied: trunk/debugger/classes/Method.cs (from rev 51569,
trunk/debugger/classes/MethodBase.cs)
===================================================================
--- trunk/debugger/classes/MethodBase.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/classes/Method.cs 2005-10-11 13:46:00 UTC (rev 51570)
@@ -0,0 +1,338 @@
+using System;
+using System.Text;
+using System.Collections;
+
+using Mono.Debugger.Languages;
+
+namespace Mono.Debugger
+{
+ public enum WrapperType
+ {
+ None = 0,
+ DelegateInvoke,
+ DelegateBeginInvoke,
+ DelegateEndInvoke,
+ RuntimeInvoke,
+ NativeToManaged,
+ ManagedToNative,
+ RemotingInvoke,
+ RemotingInvokeWithCheck,
+ XDomainInvoke,
+ XDomainDispatch,
+ Ldfld,
+ Stfld,
+ LdfldRemote,
+ StfldRemote,
+ Synchronized,
+ DynamicMethod,
+ IsInst,
+ CastClass,
+ ProxyIsInst,
+ StelemRef,
+ UnBox,
+ Unknown
+ }
+
+ public struct LineEntry : IComparable {
+ public readonly TargetAddress Address;
+ public readonly int Line;
+
+ public LineEntry (TargetAddress address, int line)
+ {
+ this.Address = address;;
+ this.Line = line;
+ }
+
+ public int CompareTo (object obj)
+ {
+ LineEntry entry = (LineEntry) obj;
+
+ if (entry.Address < Address)
+ return 1;
+ else if (entry.Address > Address)
+ return -1;
+ else
+ return 0;
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("LineEntry ({0}:{1})", Line,
Address);
+ }
+ }
+
+ public abstract class Method : MarshalByRefObject, ISymbolLookup,
IComparable
+ {
+ TargetAddress start, end;
+ TargetAddress method_start, method_end;
+ WrapperType wrapper_type = WrapperType.None;
+ MethodSource source;
+ Module module;
+ bool is_loaded, has_bounds;
+ string image_file;
+ string name;
+
+ protected Method (string name, string image_file, Module module,
+ TargetAddress start, TargetAddress end)
+ : this (name, image_file, module)
+ {
+ this.start = start;
+ this.end = end;
+ this.method_start = start;
+ this.method_end = end;
+ this.is_loaded = true;
+ }
+
+ protected Method (string name, string image_file, Module module)
+ {
+ this.name = name;
+ this.image_file = image_file;
+ this.module = module;
+ }
+
+ protected Method (Method method)
+ : this (method.Name, method.ImageFile, method.Module,
+ method.StartAddress, method.EndAddress)
+ { }
+
+ protected void SetAddresses (TargetAddress start, TargetAddress
end)
+ {
+ this.start = start;
+ this.end = end;
+ this.is_loaded = true;
+ this.has_bounds = false;
+ }
+
+ protected void SetMethodBounds (TargetAddress method_start,
TargetAddress method_end)
+ {
+ this.method_start = method_start;
+ this.method_end = method_end;
+ this.has_bounds = true;
+ }
+
+ protected void SetSource (MethodSource source)
+ {
+ this.source = source;
+ }
+
+ protected void SetWrapperType (WrapperType wrapper_type)
+ {
+ this.wrapper_type = wrapper_type;
+ }
+
+ public virtual SimpleStackFrame UnwindStack (SimpleStackFrame
frame,
+
ITargetMemoryAccess memory,
+ Architecture arch)
+ {
+ if (!IsLoaded)
+ return null;
+
+ try {
+ SimpleStackFrame new_frame = Module.UnwindStack
(frame, memory);
+ if (new_frame != null)
+ return new_frame;
+ } catch {
+ }
+
+ int prologue_size;
+ if (HasMethodBounds)
+ prologue_size = (int) (MethodStartAddress -
StartAddress);
+ else
+ prologue_size = (int) (EndAddress -
StartAddress);
+ int offset = (int) (frame.Address - StartAddress);
+ prologue_size = System.Math.Min (prologue_size, offset);
+ prologue_size = System.Math.Min (prologue_size,
arch.MaxPrologueSize);
+
+ byte[] prologue = memory.ReadBuffer (StartAddress,
prologue_size);
+
+ Symbol name = new Symbol (Name, StartAddress, offset);
+ return arch.UnwindStack (memory, frame, name, prologue);
+ }
+
+ //
+ // Method
+ //
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public string ImageFile {
+ get {
+ return image_file;
+ }
+ }
+
+ public Module Module {
+ get {
+ return module;
+ }
+ }
+
+ public abstract object MethodHandle {
+ get;
+ }
+
+ public bool IsLoaded {
+ get {
+ return is_loaded;
+ }
+ }
+
+ public bool HasMethodBounds {
+ get {
+ return has_bounds;
+ }
+ }
+
+ public TargetAddress StartAddress {
+ get {
+ if (!is_loaded)
+ throw new InvalidOperationException ();
+
+ return start;
+ }
+ }
+
+ public TargetAddress EndAddress {
+ get {
+ if (!is_loaded)
+ throw new InvalidOperationException ();
+
+ return end;
+ }
+ }
+
+ public TargetAddress MethodStartAddress {
+ get {
+ if (!has_bounds)
+ throw new InvalidOperationException ();
+
+ return method_start;
+ }
+ }
+
+ public TargetAddress MethodEndAddress {
+ get {
+ if (!has_bounds)
+ throw new InvalidOperationException ();
+
+ return method_end;
+ }
+ }
+
+ public WrapperType WrapperType {
+ get {
+ return wrapper_type;
+ }
+ }
+
+ public bool HasSource {
+ get {
+ return source != null;
+ }
+ }
+
+ public MethodSource Source {
+ get {
+ if (!HasSource)
+ throw new InvalidOperationException ();
+
+ return source;
+ }
+ }
+
+ public static bool IsInSameMethod (Method method, TargetAddress
address)
+ {
+ if (address.IsNull || !method.IsLoaded)
+ return false;
+
+ if ((address < method.StartAddress) || (address >=
method.EndAddress))
+ return false;
+
+ return true;
+ }
+
+ public abstract TargetClassType DeclaringType {
+ get;
+ }
+
+ public abstract bool HasThis {
+ get;
+ }
+
+ public abstract TargetVariable This {
+ get;
+ }
+
+ public abstract TargetVariable[] Parameters {
+ get;
+ }
+
+ public abstract TargetVariable[] Locals {
+ get;
+ }
+
+ public abstract SourceMethod GetTrampoline (ITargetMemoryAccess
memory,
+ TargetAddress
address);
+
+ public TargetVariable GetVariableByName (string name)
+ {
+ foreach (TargetVariable var in Locals) {
+ if (var.Name == name)
+ return var;
+ }
+
+ foreach (TargetVariable var in Parameters) {
+ if (var.Name == name)
+ return var;
+ }
+
+ return null;
+ }
+
+ //
+ // ISourceLookup
+ //
+
+ Method ISymbolLookup.Lookup (TargetAddress address)
+ {
+ if (!is_loaded)
+ return null;
+
+ if ((address < start) || (address >= end))
+ return null;
+
+ return this;
+ }
+
+ public int CompareTo (object obj)
+ {
+ Method method = (Method) obj;
+
+ TargetAddress address;
+ try {
+ address = method.StartAddress;
+ } catch {
+ return is_loaded ? -1 : 0;
+ }
+
+ if (!is_loaded)
+ return 1;
+
+ if (address < start)
+ return 1;
+ else if (address > start)
+ return -1;
+ else
+ return 0;
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("{0}({1},{2:x},{3:x})", GetType
(), name, start, end);
+ }
+ }
+}
Deleted: trunk/debugger/classes/MethodBase.cs
===================================================================
--- trunk/debugger/classes/MethodBase.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/classes/MethodBase.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -1,311 +0,0 @@
-using System;
-using System.Text;
-using System.Collections;
-
-using Mono.Debugger.Languages;
-
-namespace Mono.Debugger
-{
- public struct LineEntry : IComparable {
- public readonly TargetAddress Address;
- public readonly int Line;
-
- public LineEntry (TargetAddress address, int line)
- {
- this.Address = address;;
- this.Line = line;
- }
-
- public int CompareTo (object obj)
- {
- LineEntry entry = (LineEntry) obj;
-
- if (entry.Address < Address)
- return 1;
- else if (entry.Address > Address)
- return -1;
- else
- return 0;
- }
-
- public override string ToString ()
- {
- return String.Format ("LineEntry ({0}:{1})", Line,
Address);
- }
- }
-
- public abstract class MethodBase : MarshalByRefObject, IMethod,
ISymbolLookup, IComparable
- {
- TargetAddress start, end;
- TargetAddress method_start, method_end;
- WrapperType wrapper_type = WrapperType.None;
- MethodSource source;
- Module module;
- bool is_loaded, has_bounds;
- string image_file;
- string name;
-
- protected MethodBase (string name, string image_file, Module
module,
- TargetAddress start, TargetAddress end)
- : this (name, image_file, module)
- {
- this.start = start;
- this.end = end;
- this.method_start = start;
- this.method_end = end;
- this.is_loaded = true;
- }
-
- protected MethodBase (string name, string image_file, Module
module)
- {
- this.name = name;
- this.image_file = image_file;
- this.module = module;
- }
-
- protected MethodBase (IMethod method)
- : this (method.Name, method.ImageFile, method.Module,
- method.StartAddress, method.EndAddress)
- { }
-
- protected void SetAddresses (TargetAddress start, TargetAddress
end)
- {
- this.start = start;
- this.end = end;
- this.is_loaded = true;
- this.has_bounds = false;
- }
-
- protected void SetMethodBounds (TargetAddress method_start,
TargetAddress method_end)
- {
- this.method_start = method_start;
- this.method_end = method_end;
- this.has_bounds = true;
- }
-
- protected void SetSource (MethodSource source)
- {
- this.source = source;
- }
-
- protected void SetWrapperType (WrapperType wrapper_type)
- {
- this.wrapper_type = wrapper_type;
- }
-
- public virtual SimpleStackFrame UnwindStack (SimpleStackFrame
frame,
-
ITargetMemoryAccess memory,
- Architecture arch)
- {
- if (!IsLoaded)
- return null;
-
- try {
- SimpleStackFrame new_frame = Module.UnwindStack
(frame, memory);
- if (new_frame != null)
- return new_frame;
- } catch {
- }
-
- int prologue_size;
- if (HasMethodBounds)
- prologue_size = (int) (MethodStartAddress -
StartAddress);
- else
- prologue_size = (int) (EndAddress -
StartAddress);
- int offset = (int) (frame.Address - StartAddress);
- prologue_size = System.Math.Min (prologue_size, offset);
- prologue_size = System.Math.Min (prologue_size,
arch.MaxPrologueSize);
-
- byte[] prologue = memory.ReadBuffer (StartAddress,
prologue_size);
-
- Symbol name = new Symbol (Name, StartAddress, offset);
- return arch.UnwindStack (memory, frame, name, prologue);
- }
-
- //
- // IMethod
- //
-
- public string Name {
- get {
- return name;
- }
- }
-
- public string ImageFile {
- get {
- return image_file;
- }
- }
-
- public Module Module {
- get {
- return module;
- }
- }
-
- public abstract object MethodHandle {
- get;
- }
-
- public bool IsLoaded {
- get {
- return is_loaded;
- }
- }
-
- public bool HasMethodBounds {
- get {
- return has_bounds;
- }
- }
-
- public TargetAddress StartAddress {
- get {
- if (!is_loaded)
- throw new InvalidOperationException ();
-
- return start;
- }
- }
-
- public TargetAddress EndAddress {
- get {
- if (!is_loaded)
- throw new InvalidOperationException ();
-
- return end;
- }
- }
-
- public TargetAddress MethodStartAddress {
- get {
- if (!has_bounds)
- throw new InvalidOperationException ();
-
- return method_start;
- }
- }
-
- public TargetAddress MethodEndAddress {
- get {
- if (!has_bounds)
- throw new InvalidOperationException ();
-
- return method_end;
- }
- }
-
- public WrapperType WrapperType {
- get {
- return wrapper_type;
- }
- }
-
- public bool HasSource {
- get {
- return source != null;
- }
- }
-
- public MethodSource Source {
- get {
- if (!HasSource)
- throw new InvalidOperationException ();
-
- return source;
- }
- }
-
- public static bool IsInSameMethod (IMethod method,
TargetAddress address)
- {
- if (address.IsNull || !method.IsLoaded)
- return false;
-
- if ((address < method.StartAddress) || (address >=
method.EndAddress))
- return false;
-
- return true;
- }
-
- public abstract TargetClassType DeclaringType {
- get;
- }
-
- public abstract bool HasThis {
- get;
- }
-
- public abstract TargetVariable This {
- get;
- }
-
- public abstract TargetVariable[] Parameters {
- get;
- }
-
- public abstract TargetVariable[] Locals {
- get;
- }
-
- public abstract SourceMethod GetTrampoline (ITargetMemoryAccess
memory,
- TargetAddress
address);
-
- public TargetVariable GetVariableByName (string name)
- {
- foreach (TargetVariable var in Locals) {
- if (var.Name == name)
- return var;
- }
-
- foreach (TargetVariable var in Parameters) {
- if (var.Name == name)
- return var;
- }
-
- return null;
- }
-
- //
- // ISourceLookup
- //
-
- IMethod ISymbolLookup.Lookup (TargetAddress address)
- {
- if (!is_loaded)
- return null;
-
- if ((address < start) || (address >= end))
- return null;
-
- return this;
- }
-
- public int CompareTo (object obj)
- {
- IMethod method = (IMethod) obj;
-
- TargetAddress address;
- try {
- address = method.StartAddress;
- } catch {
- return is_loaded ? -1 : 0;
- }
-
- if (!is_loaded)
- return 1;
-
- if (address < start)
- return 1;
- else if (address > start)
- return -1;
- else
- return 0;
- }
-
- public override string ToString ()
- {
- return String.Format ("{0}({1},{2:x},{3:x})", GetType
(), name, start, end);
- }
- }
-}
Modified: trunk/debugger/classes/MethodSource.cs
===================================================================
--- trunk/debugger/classes/MethodSource.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/classes/MethodSource.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -12,7 +12,7 @@
TargetAddress start, end;
TargetAddress method_start, method_end;
- protected MethodSource (IMethod method, SourceFile file)
+ protected MethodSource (Method method, SourceFile file)
{
this.file = file;
this.start = method.StartAddress;
Modified: trunk/debugger/classes/SourceInfo.cs
===================================================================
--- trunk/debugger/classes/SourceInfo.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/classes/SourceInfo.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -145,12 +145,12 @@
}
// <summary>
- // May only be used while the method is loaded and return's
the IMethod.
+ // May only be used while the method is loaded and return's
the Method.
//
// Throws:
// InvalidOperationException - IsLoaded is false.
// </summary>
- public IMethod Method {
+ public Method Method {
get {
if (!IsLoaded)
throw new InvalidOperationException ();
@@ -190,7 +190,7 @@
StartRow, EndRow, IsLoaded);
}
- IMethod method;
+ Method method;
Module module;
SourceFile source;
string name;
Modified: trunk/debugger/classes/StackFrame.cs
===================================================================
--- trunk/debugger/classes/StackFrame.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/classes/StackFrame.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -198,7 +198,7 @@
[Serializable]
public sealed class StackFrame : MarshalByRefObject, IDisposable
{
- IMethod method;
+ Method method;
Process process;
TargetAccess target;
SimpleStackFrame simple;
@@ -219,7 +219,7 @@
}
public StackFrame (Process process, TargetAccess target,
- SimpleStackFrame simple, IMethod method,
+ SimpleStackFrame simple, Method method,
SourceAddress source)
{
this.process = process;
@@ -239,7 +239,7 @@
internal static StackFrame CreateFrame (Process process,
TargetAccess target,
SimpleStackFrame simple,
- IMethod method)
+ Method method)
{
SourceAddress source = null;
if ((method != null) && method.HasSource)
@@ -249,7 +249,7 @@
internal static StackFrame CreateFrame (Process process,
TargetAccess target,
SimpleStackFrame simple,
- IMethod method,
SourceAddress source)
+ Method method,
SourceAddress source)
{
return new StackFrame (process, target, simple, method,
source);
}
@@ -262,7 +262,7 @@
if (simple.Address.IsNull)
return new StackFrame (process, target, simple,
null, null);
- IMethod method = null;
+ Method method = null;
if (symtab != null) {
try {
method = symtab.Lookup (simple.Address);
@@ -369,7 +369,7 @@
return Registers [index].Value;
}
- public IMethod Method {
+ public Method Method {
get {
check_disposed ();
return method;
Modified: trunk/debugger/classes/SymbolTable.cs
===================================================================
--- trunk/debugger/classes/SymbolTable.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/classes/SymbolTable.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -102,16 +102,16 @@
protected abstract ArrayList GetMethods ();
- public IMethod[] Methods {
+ public Method[] Methods {
get {
if (!HasMethods)
throw new InvalidOperationException ();
ArrayList methods = ensure_methods ();
if (methods == null)
- return new IMethod [0];
+ return new Method [0];
- IMethod[] retval = new IMethod [methods.Count];
+ Method[] retval = new Method [methods.Count];
methods.CopyTo (retval, 0);
return retval;
}
@@ -163,7 +163,7 @@
}
}
- public virtual IMethod Lookup (TargetAddress address)
+ public virtual Method Lookup (TargetAddress address)
{
if (IsContinuous && ((address < start_address) ||
(address >= end_address)))
return null;
@@ -189,7 +189,7 @@
if (methods == null)
return null;
- foreach (IMethod method in methods) {
+ foreach (Method method in methods) {
if (!method.IsLoaded)
continue;
@@ -204,7 +204,7 @@
public virtual Symbol SimpleLookup (TargetAddress address, bool
exact_match)
{
- IMethod method = Lookup (address);
+ Method method = Lookup (address);
if ((method == null) || !method.IsLoaded)
return null;
Modified: trunk/debugger/classes/SymbolTableCollection.cs
===================================================================
--- trunk/debugger/classes/SymbolTableCollection.cs 2005-10-11 13:35:09 UTC
(rev 51569)
+++ trunk/debugger/classes/SymbolTableCollection.cs 2005-10-11 13:46:00 UTC
(rev 51570)
@@ -89,7 +89,7 @@
}
}
- public IMethod[] Methods {
+ public Method[] Methods {
get {
ArrayList methods = new ArrayList ();
@@ -100,19 +100,19 @@
methods.AddRange (symtab.Methods);
}
- IMethod[] retval = new IMethod [methods.Count];
+ Method[] retval = new Method [methods.Count];
methods.CopyTo (retval, 0);
return retval;
}
}
- public IMethod Lookup (TargetAddress address)
+ public Method Lookup (TargetAddress address)
{
foreach (ISymbolTable symtab in symtabs) {
if (!symtab.IsLoaded)
continue;
- IMethod method = symtab.Lookup (address);
+ Method method = symtab.Lookup (address);
if (method != null)
return method;
Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs 2005-10-11 13:35:09 UTC (rev 51569)
+++ trunk/debugger/frontend/Command.cs 2005-10-11 13:46:00 UTC (rev 51570)
@@ -454,7 +454,7 @@
int count = -1;
FrameHandle frame;
TargetAddress address;
- IMethod method;
+ Method method;
Expression expression;
public bool Method {
Modified: trunk/debugger/frontend/Completer.cs
===================================================================
--- trunk/debugger/frontend/Completer.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/frontend/Completer.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -247,7 +247,7 @@
}
foreach (ISymbolRange range in
module.SymbolTable.SymbolRanges) {
- IMethod method =
range.SymbolLookup.Lookup (range.StartAddress);
+ Method method =
range.SymbolLookup.Lookup (range.StartAddress);
if (method != null) {
if
(method.Name.StartsWith (text)) {
method_list.Add (method.Name);
Modified: trunk/debugger/frontend/Expression.cs
===================================================================
--- trunk/debugger/frontend/Expression.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/frontend/Expression.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -472,7 +472,7 @@
protected override Expression DoResolve (ScriptingContext
context)
{
frame = context.CurrentFrame;
- IMethod method = frame.Frame.Method;
+ Method method = frame.Frame.Method;
if (method == null)
throw new ScriptingException (
"Keyword `this' not allowed: no current
method.");
@@ -681,7 +681,7 @@
MemberExpression LookupMember (ScriptingContext context,
FrameHandle frame,
string full_name)
{
- IMethod method = frame.Frame.Method;
+ Method method = frame.Frame.Method;
if ((method == null) || (method.DeclaringType == null))
return null;
Modified: trunk/debugger/frontend/ScriptingContext.cs
===================================================================
--- trunk/debugger/frontend/ScriptingContext.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/frontend/ScriptingContext.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -45,7 +45,7 @@
if (location == null)
return false;
- IMethod method = frame.Method;
+ Method method = frame.Method;
if ((method == null) || !method.HasSource ||
(method.Source == null))
return false;
@@ -76,7 +76,7 @@
public AssemblerLine Disassemble (TargetAccess target,
TargetAddress address)
{
- IMethod method = frame.Method;
+ Method method = frame.Method;
if ((method == null) || !method.IsLoaded)
return target.DisassembleInstruction (null,
address);
else if ((address < method.StartAddress) || (address >=
method.EndAddress))
@@ -87,7 +87,7 @@
public void DisassembleMethod (ScriptingContext context,
TargetAccess target)
{
- IMethod method = frame.Method;
+ Method method = frame.Method;
if ((method == null) || !method.IsLoaded)
throw new ScriptingException ("Selected stack
frame has no method.");
@@ -848,7 +848,7 @@
public string[] GetNamespaces (FrameHandle frame)
{
- IMethod method = frame.Frame.Method;
+ Method method = frame.Frame.Method;
if ((method == null) || !method.HasSource)
return null;
Modified: trunk/debugger/interfaces/IDisassembler.cs
===================================================================
--- trunk/debugger/interfaces/IDisassembler.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/interfaces/IDisassembler.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -12,14 +12,14 @@
// <summary>
// Disassemble one method.
// </summary>
- AssemblerMethod DisassembleMethod (IMethod method);
+ AssemblerMethod DisassembleMethod (Method method);
// <summary>
// Disassemble one instruction.
// If @imethod is non-null, it specifies the current method
which will
// be used to lookup function names from trampoline calls.
// </summary>
- AssemblerLine DisassembleInstruction (IMethod method,
TargetAddress address);
+ AssemblerLine DisassembleInstruction (Method method,
TargetAddress address);
// <summary>
// The symbol table the disassembler uses to display symbols.
Deleted: trunk/debugger/interfaces/IMethod.cs
===================================================================
--- trunk/debugger/interfaces/IMethod.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/interfaces/IMethod.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -1,166 +0,0 @@
-using System;
-using System.IO;
-
-using Mono.Debugger.Languages;
-
-namespace Mono.Debugger
-{
- public enum WrapperType
- {
- None = 0,
- DelegateInvoke,
- DelegateBeginInvoke,
- DelegateEndInvoke,
- RuntimeInvoke,
- NativeToManaged,
- ManagedToNative,
- RemotingInvoke,
- RemotingInvokeWithCheck,
- XDomainInvoke,
- XDomainDispatch,
- Ldfld,
- Stfld,
- LdfldRemote,
- StfldRemote,
- Synchronized,
- DynamicMethod,
- IsInst,
- CastClass,
- ProxyIsInst,
- StelemRef,
- UnBox,
- Unknown
- }
-
- public interface IMethod
- {
- string Name {
- get;
- }
-
- string ImageFile {
- get;
- }
-
- object MethodHandle {
- get;
- }
-
- Module Module {
- get;
- }
-
- // <summary>
- // StartAddress and EndAddress are only valid if this is true.
- // </summary>
- bool IsLoaded {
- get;
- }
-
- TargetAddress StartAddress {
- get;
- }
-
- TargetAddress EndAddress {
- get;
- }
-
- // <summary>
- // MethodStartAddress and MethodEndAddress are only valid if
this is true.
- // </summary>
- bool HasMethodBounds {
- get;
- }
-
- // <summary>
- // This is the address of the actual start of the method's
code, ie. just after
- // the prologue.
- // </summary>
- TargetAddress MethodStartAddress {
- get;
- }
-
- // <summary>
- // This is the address of the actual end of the method's
code, ie. just before
- // the epilogue.
- // </summary>
- TargetAddress MethodEndAddress {
- get;
- }
-
- // <summary>
- // Whether this is an icall/pinvoke wrapper.
- // WrapperAddress is only valid if this is true.
- // </summary>
- WrapperType WrapperType {
- get;
- }
-
- // <summary>
- // Source is only valid if this is true.
- // </summary>
- bool HasSource {
- get;
- }
-
- // <remarks>
- // This may return null if the source file could not be found.
- //
- // Note:
- // The return value of this property is internally cached
inside
- // a weak reference, so it's highly recommended that you call
this
- // property multiple times instead of keeping a reference
yourself.
- // </remarks>
- MethodSource Source {
- get;
- }
-
- // <summary>
- // The method's declaring type. In an object oriented
- // language, this will be the class/struct in which
- // this method is declared.
- // </summary>
- TargetClassType DeclaringType {
- get;
- }
-
- // <summary>
- // True for instance methods in object oriented
- // languages.
- // </summary>
- bool HasThis {
- get;
- }
-
- // <summary>
- // The method's "this" pointer.
- // </summary>
-
- TargetVariable This {
- get;
- }
-
- // <summary>
- // The method's parameters.
- // </summary>
- TargetVariable[] Parameters {
- get;
- }
-
- // <summary>
- // The method's local variables
- // </summary>
- TargetVariable[] Locals {
- get;
- }
-
- SourceMethod GetTrampoline (ITargetMemoryAccess memory,
- TargetAddress address);
-
- SimpleStackFrame UnwindStack (SimpleStackFrame frame,
- ITargetMemoryAccess memory,
- Architecture arch);
-
- TargetVariable GetVariableByName (string name);
- }
-}
Modified: trunk/debugger/interfaces/ISymbolFile.cs
===================================================================
--- trunk/debugger/interfaces/ISymbolFile.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/interfaces/ISymbolFile.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -8,7 +8,7 @@
void GetMethods (SourceFile file);
- IMethod GetMethod (long handle);
+ Method GetMethod (long handle);
SourceMethod FindMethod (string name);
}
Modified: trunk/debugger/interfaces/ISymbolTable.cs
===================================================================
--- trunk/debugger/interfaces/ISymbolTable.cs 2005-10-11 13:35:09 UTC (rev
51569)
+++ trunk/debugger/interfaces/ISymbolTable.cs 2005-10-11 13:46:00 UTC (rev
51570)
@@ -5,7 +5,7 @@
{
public interface ISymbolLookup
{
- IMethod Lookup (TargetAddress address);
+ Method Lookup (TargetAddress address);
}
public interface ISourceLookup
@@ -96,7 +96,7 @@
// Get a list of all methods in this symbol table. May only
be used if
// `HasMethods' is true.
// </summary>
- IMethod[] Methods {
+ Method[] Methods {
get;
}
Modified: trunk/debugger/languages/mono/MonoSymbolFile.cs
===================================================================
--- trunk/debugger/languages/mono/MonoSymbolFile.cs 2005-10-11 13:35:09 UTC
(rev 51569)
+++ trunk/debugger/languages/mono/MonoSymbolFile.cs 2005-10-11 13:46:00 UTC
(rev 51570)
@@ -429,7 +429,7 @@
if (exact_match && (offset != 0))
continue;
- IMethod method = range.GetMethod ();
+ Method method = range.GetMethod ();
return new Symbol (
method.Name, range.StartAddress, (int)
offset);
}
@@ -530,7 +530,7 @@
Hashtable method_hash = new Hashtable ();
- IMethod ISymbolFile.GetMethod (long handle)
+ Method ISymbolFile.GetMethod (long handle)
{
MethodRangeEntry entry = (MethodRangeEntry) range_hash
[(int) handle];
if (entry == null)
@@ -624,7 +624,7 @@
Dispose (false);
}
- protected class MonoMethod : MethodBase
+ protected class MonoMethod : Method
{
MonoSymbolFile file;
SourceMethod info;
@@ -913,11 +913,11 @@
JitLineNumberEntry[] line_numbers;
C.MethodEntry method;
SourceMethod source_method;
- IMethod imethod;
+ Method imethod;
SourceFileFactory factory;
Hashtable namespaces;
- public MonoMethodSource (SourceFileFactory factory,
IMethod imethod,
+ public MonoMethodSource (SourceFileFactory factory,
Method imethod,
SourceMethod source_method,
C.MethodEntry method,
JitLineNumberEntry[]
line_numbers)
: base (imethod, source_method.SourceFile)
@@ -1032,7 +1032,7 @@
return new MethodRangeEntry (file, index,
start, end, wrapper, contents);
}
- internal IMethod GetMethod ()
+ internal Method GetMethod ()
{
return File.GetMonoMethod (Index, contents);
}
@@ -1128,7 +1128,7 @@
}
}
- protected class WrapperMethod : MethodBase
+ protected class WrapperMethod : Method
{
public readonly WrapperEntry Entry;
Modified: trunk/debugger/languages/mono/MonoVariable.cs
===================================================================
--- trunk/debugger/languages/mono/MonoVariable.cs 2005-10-11 13:35:09 UTC
(rev 51569)
+++ trunk/debugger/languages/mono/MonoVariable.cs 2005-10-11 13:46:00 UTC
(rev 51570)
@@ -14,7 +14,7 @@
bool has_liveness_info, is_byref;
public MonoVariable (Debugger backend, string name, TargetType
type,
- bool is_local, bool is_byref, IMethod
method,
+ bool is_local, bool is_byref, Method
method,
VariableInfo info, int start_scope_offset,
int end_scope_offset)
: this (backend, name, type, is_local, is_byref,
method, info)
@@ -43,7 +43,7 @@
}
public MonoVariable (Debugger backend, string name, TargetType
type,
- bool is_local, bool is_byref, IMethod
method,
+ bool is_local, bool is_byref, Method
method,
VariableInfo info)
{
this.backend = backend;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches