Author: martin
Date: 2005-07-14 14:01:56 -0400 (Thu, 14 Jul 2005)
New Revision: 47315
Modified:
trunk/debugger/ChangeLog
trunk/debugger/backends/mono/MonoClassInfo.cs
trunk/debugger/backends/mono/MonoClassObject.cs
trunk/debugger/backends/mono/MonoClassType.cs
trunk/debugger/classes/Report.cs
trunk/debugger/frontend/Expression.cs
Log:
2005-07-14 Martin Baulig <[EMAIL PROTECTED]>
* frontend/Expression.cs
(MemberAccessExpression.ResolveMemberAccess): If `left' resolves
to a type, use it as a type.
* backends/mono/MonoClassType.cs: Correctly index the methods and
static methods if we have a parent class.
* backends/mono/MonoClassInfo.cs
(MonoClassInfo.GetParentObject): New internal method.
* backends/mono/MonoClassObject.cs
(MonoClassObject.Parent): Implement this again, using
MonoClassInfo.GetParentObject().
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2005-07-14 17:47:03 UTC (rev 47314)
+++ trunk/debugger/ChangeLog 2005-07-14 18:01:56 UTC (rev 47315)
@@ -1,3 +1,19 @@
+2005-07-14 Martin Baulig <[EMAIL PROTECTED]>
+
+ * frontend/Expression.cs
+ (MemberAccessExpression.ResolveMemberAccess): If `left' resolves
+ to a type, use it as a type.
+
+ * backends/mono/MonoClassType.cs: Correctly index the methods and
+ static methods if we have a parent class.
+
+ * backends/mono/MonoClassInfo.cs
+ (MonoClassInfo.GetParentObject): New internal method.
+
+ * backends/mono/MonoClassObject.cs
+ (MonoClassObject.Parent): Implement this again, using
+ MonoClassInfo.GetParentObject().
+
2005-07-13 Martin Baulig <[EMAIL PROTECTED]>
* backends/server/x86-ptrace.c
Modified: trunk/debugger/backends/mono/MonoClassInfo.cs
===================================================================
--- trunk/debugger/backends/mono/MonoClassInfo.cs 2005-07-14 17:47:03 UTC
(rev 47314)
+++ trunk/debugger/backends/mono/MonoClassInfo.cs 2005-07-14 18:01:56 UTC
(rev 47315)
@@ -9,6 +9,7 @@
int[] field_offsets;
TargetAddress[] methods;
MonoDebuggerInfo debugger_info;
+ MonoClassInfo parent;
bool initialized;
public MonoClassInfo (MonoClassType type, TargetBinaryReader
info)
@@ -24,6 +25,11 @@
if (initialized)
return;
+ if (Type.ParentType != null) {
+ parent = (MonoClassInfo)
Type.ParentType.GetTypeInfo ();
+ parent.initialize (target);
+ }
+
MonoBuiltinTypeInfo builtin =
Type.File.MonoLanguage.BuiltinTypes;
TargetAddress field_info = target.ReadAddress
(KlassAddress + builtin.KlassFieldOffset);
@@ -101,7 +107,7 @@
try {
initialize (location.TargetAccess);
- MonoMethodInfo minfo = Type.Methods [index];
+ MonoMethodInfo minfo = Type.GetMethod (index);
MonoTypeInfo mtype = minfo.Type.GetTypeInfo ();
if (mtype == null)
return null;
@@ -142,5 +148,19 @@
{
return new MonoClassObject (this, location);
}
+
+ internal MonoClassObject GetParentObject (TargetLocation
location)
+ {
+ try {
+ initialize (location.TargetAccess);
+
+ if (parent == null)
+ throw new InvalidOperationException ();
+
+ return new MonoClassObject (parent, location);
+ } catch (TargetException ex) {
+ throw new LocationInvalidException (ex);
+ }
+ }
}
}
Modified: trunk/debugger/backends/mono/MonoClassObject.cs
===================================================================
--- trunk/debugger/backends/mono/MonoClassObject.cs 2005-07-14 17:47:03 UTC
(rev 47314)
+++ trunk/debugger/backends/mono/MonoClassObject.cs 2005-07-14 18:01:56 UTC
(rev 47315)
@@ -22,11 +22,10 @@
public ITargetClassObject Parent {
get {
- if (type.Type.ParentType == null)
+ if (!type.Type.HasParent)
return null;
- // return type.Type.ParentType.GetClassObject
(location);
- return null;
+ return type.GetParentObject (location);
}
}
Modified: trunk/debugger/backends/mono/MonoClassType.cs
===================================================================
--- trunk/debugger/backends/mono/MonoClassType.cs 2005-07-14 17:47:03 UTC
(rev 47314)
+++ trunk/debugger/backends/mono/MonoClassType.cs 2005-07-14 18:01:56 UTC
(rev 47315)
@@ -18,6 +18,9 @@
MonoMethodInfo[] constructors;
MonoMethodInfo[] static_constructors;
+ int num_methods = 0, num_smethods = 0;
+ internal int first_method = 0, first_smethod = 0;
+
MonoClassType parent_type;
public MonoClassType (MonoSymbolFile file, Type type)
@@ -103,13 +106,38 @@
return info.GetStaticField (frame, index);
}
+ public int CountMethods {
+ get {
+ if (parent_type != null)
+ return parent_type.CountMethods +
num_methods;
+ else
+ return num_methods;
+ }
+ }
+
+ public int CountStaticMethods {
+ get {
+ if (parent_type != null)
+ return parent_type.CountStaticMethods +
num_smethods;
+ else
+ return num_smethods;
+ }
+ }
+
+ public MonoMethodInfo GetMethod (int index)
+ {
+ get_methods ();
+ if (index < first_method)
+ return parent_type.GetMethod (index);
+
+ return methods [index - first_method];
+ }
+
void get_methods ()
{
if (methods != null)
return;
- int num_methods = 0, num_smethods = 0;
-
R.MethodInfo[] minfo = type.GetMethods (
R.BindingFlags.DeclaredOnly |
R.BindingFlags.Static | R.BindingFlags.Instance |
R.BindingFlags.Public |
R.BindingFlags.NonPublic);
@@ -126,48 +154,49 @@
methods = new MonoMethodInfo [num_methods];
static_methods = new MonoMethodInfo [num_smethods];
+ if (parent_type != null) {
+ parent_type.get_methods ();
+ first_method = parent_type.CountMethods;
+ first_smethod = parent_type.CountStaticMethods;
+ }
+
int pos = 0, spos = 0;
for (int i = 0; i < minfo.Length; i++) {
if ((minfo [i].Attributes &
R.MethodAttributes.SpecialName) != 0)
continue;
if (minfo [i].IsStatic) {
- static_methods [spos] = new
MonoMethodInfo (this, spos, minfo [i]);
+ static_methods [spos] = new
MonoMethodInfo (this, first_smethod + spos, minfo [i]);
spos++;
} else {
- methods [pos] = new MonoMethodInfo
(this, pos, minfo [i]);
+ methods [pos] = new MonoMethodInfo
(this, first_method + pos, minfo [i]);
pos++;
}
}
}
- internal MonoMethodInfo[] Methods {
+ ITargetMethodInfo[] ITargetStructType.Methods {
get {
get_methods ();
return methods;
}
}
- internal MonoMethodInfo[] StaticMethods {
+ ITargetMethodInfo[] ITargetStructType.StaticMethods {
get {
get_methods ();
return static_methods;
}
}
- ITargetMethodInfo[] ITargetStructType.Methods {
- get { return Methods; }
- }
-
- ITargetMethodInfo[] ITargetStructType.StaticMethods {
- get { return StaticMethods; }
- }
-
public ITargetFunctionObject GetStaticMethod (StackFrame frame,
int index)
{
get_methods ();
+ if (index < first_smethod)
+ return parent_type.GetStaticMethod (frame,
index);
+
try {
- MonoFunctionType ftype = static_methods
[index].FunctionType;
+ MonoFunctionType ftype = static_methods [index
- first_smethod].FunctionType;
MonoFunctionTypeInfo finfo = ftype.GetTypeInfo
() as MonoFunctionTypeInfo;
if (finfo == null)
return null;
Modified: trunk/debugger/classes/Report.cs
===================================================================
--- trunk/debugger/classes/Report.cs 2005-07-14 17:47:03 UTC (rev 47314)
+++ trunk/debugger/classes/Report.cs 2005-07-14 18:01:56 UTC (rev 47315)
@@ -20,7 +20,8 @@
Mutex = 256,
SymbolTable = 512,
SourceFiles = 1024,
- DwarfReader = 2048
+ DwarfReader = 2048,
+ Misc = 4096
}
public class Report
Modified: trunk/debugger/frontend/Expression.cs
===================================================================
--- trunk/debugger/frontend/Expression.cs 2005-07-14 17:47:03 UTC (rev
47314)
+++ trunk/debugger/frontend/Expression.cs 2005-07-14 18:01:56 UTC (rev
47315)
@@ -682,6 +682,22 @@
Expression expr;
Expression lexpr = left.TryResolve (context);
+ if (lexpr is TypeExpression) {
+ ITargetStructType stype = lexpr.EvaluateType
(context) as ITargetStructType;
+ if (stype == null)
+ throw new ScriptingException (
+ "`{0}' is not a struct or
class", lexpr.Name);
+
+ expr = StructAccessExpression.FindMember (
+ stype, frame, null, allow_instance,
name);
+ if (expr == null)
+ throw new ScriptingException (
+ "Type `{0}' has no member
`{1}'",
+ stype.Name, name);
+
+ return expr;
+ }
+
if (lexpr != null) {
ITargetStructObject sobj =
lexpr.EvaluateVariable (context) as ITargetStructObject;
if (sobj == null)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches