Author: martin
Date: 2005-09-06 16:57:30 -0400 (Tue, 06 Sep 2005)
New Revision: 49576
Modified:
trunk/debugger/ChangeLog
trunk/debugger/backends/classes/BitfieldTargetLocation.cs
trunk/debugger/backends/mono/MonoFundamentalObject.cs
trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs
trunk/debugger/backends/mono/MonoObject.cs
trunk/debugger/backends/mono/MonoTypeInfo.cs
trunk/debugger/backends/mono/MonoVariable.cs
trunk/debugger/backends/native/NativeType.cs
trunk/debugger/classes/AbsoluteTargetLocation.cs
trunk/debugger/classes/RelativeTargetLocation.cs
trunk/debugger/classes/StackFrame.cs
trunk/debugger/classes/TargetLocation.cs
trunk/debugger/frontend/CSharpExpressionParser.jay
trunk/debugger/frontend/Command.cs
trunk/debugger/frontend/Expression.cs
trunk/debugger/frontend/ScriptingContext.cs
trunk/debugger/frontend/Style.cs
trunk/debugger/interfaces/ITargetObject.cs
trunk/debugger/interfaces/ITargetTypeInfo.cs
trunk/debugger/interfaces/IVariable.cs
Log:
2005-09-06 Martin Baulig <[EMAIL PROTECTED]>
* classes/TargetLocation.cs (TargetLocation): Make this internal
and don't mark it as [Serializable].
* interfaces/ITargetObject.cs (ITargetObject.Location): Removed.
* interfaces/IVariable.cs (IVariable.GetLocation): Removed.
* interfaces/ITargetTypeInfo.cs
(ITargetTypeInfo.GetObject): Removed.
* frontend/Expression.cs
(PointerExpression.EvaluateAddress): Return a `TargetAddress'
instead of a `TargetLocation'.
(VariableAccessExpression): Derive from Expression, not
PointerExpression.
(RegisterExpression): Likewise.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2005-09-06 20:47:56 UTC (rev 49575)
+++ trunk/debugger/ChangeLog 2005-09-06 20:57:30 UTC (rev 49576)
@@ -1,5 +1,24 @@
2005-09-06 Martin Baulig <[EMAIL PROTECTED]>
+ * classes/TargetLocation.cs (TargetLocation): Make this internal
+ and don't mark it as [Serializable].
+
+ * interfaces/ITargetObject.cs (ITargetObject.Location): Removed.
+
+ * interfaces/IVariable.cs (IVariable.GetLocation): Removed.
+
+ * interfaces/ITargetTypeInfo.cs
+ (ITargetTypeInfo.GetObject): Removed.
+
+ * frontend/Expression.cs
+ (PointerExpression.EvaluateAddress): Return a `TargetAddress'
+ instead of a `TargetLocation'.
+ (VariableAccessExpression): Derive from Expression, not
+ PointerExpression.
+ (RegisterExpression): Likewise.
+
+2005-09-06 Martin Baulig <[EMAIL PROTECTED]>
+
* interfaces/ITargetFundamentalType.cs
(FundamentalKind): New public enum.
(ITargetFundamentalType.Type): Removed.
Modified: trunk/debugger/backends/classes/BitfieldTargetLocation.cs
===================================================================
--- trunk/debugger/backends/classes/BitfieldTargetLocation.cs 2005-09-06
20:47:56 UTC (rev 49575)
+++ trunk/debugger/backends/classes/BitfieldTargetLocation.cs 2005-09-06
20:57:30 UTC (rev 49576)
@@ -4,8 +4,7 @@
namespace Mono.Debugger.Languages
{
- [Serializable]
- public class BitfieldTargetLocation : TargetLocation
+ internal class BitfieldTargetLocation : TargetLocation
{
TargetLocation relative_to;
int bit_offset, bit_size;
Modified: trunk/debugger/backends/mono/MonoFundamentalObject.cs
===================================================================
--- trunk/debugger/backends/mono/MonoFundamentalObject.cs 2005-09-06
20:47:56 UTC (rev 49575)
+++ trunk/debugger/backends/mono/MonoFundamentalObject.cs 2005-09-06
20:57:30 UTC (rev 49576)
@@ -74,7 +74,7 @@
}
}
- public override void SetObject (ITargetObject obj)
+ public override void SetObject (MonoObject obj)
{
RawContents = obj.RawContents;
}
Modified: trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs
===================================================================
--- trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs 2005-09-06
20:47:56 UTC (rev 49575)
+++ trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs 2005-09-06
20:57:30 UTC (rev 49576)
@@ -38,6 +38,11 @@
protected abstract object GetObject (TargetBlob blob,
TargetLocation location);
+ void ITargetFundamentalObject.SetObject (ITargetObject obj)
+ {
+ SetObject ((MonoObject) obj);
+ }
+
public override string Print ()
{
object obj = GetObject ();
Modified: trunk/debugger/backends/mono/MonoObject.cs
===================================================================
--- trunk/debugger/backends/mono/MonoObject.cs 2005-09-06 20:47:56 UTC (rev
49575)
+++ trunk/debugger/backends/mono/MonoObject.cs 2005-09-06 20:57:30 UTC (rev
49576)
@@ -124,7 +124,7 @@
}
}
- public virtual void SetObject (ITargetObject obj)
+ public virtual void SetObject (MonoObject obj)
{
Location.WriteAddress (obj.Location.Address);
}
Modified: trunk/debugger/backends/mono/MonoTypeInfo.cs
===================================================================
--- trunk/debugger/backends/mono/MonoTypeInfo.cs 2005-09-06 20:47:56 UTC
(rev 49575)
+++ trunk/debugger/backends/mono/MonoTypeInfo.cs 2005-09-06 20:57:30 UTC
(rev 49576)
@@ -63,11 +63,6 @@
get { return size; }
}
- ITargetObject ITargetTypeInfo.GetObject (TargetLocation
location)
- {
- return GetObject (location);
- }
-
public abstract MonoObject GetObject (TargetLocation location);
public override string ToString ()
Modified: trunk/debugger/backends/mono/MonoVariable.cs
===================================================================
--- trunk/debugger/backends/mono/MonoVariable.cs 2005-09-06 20:47:56 UTC
(rev 49575)
+++ trunk/debugger/backends/mono/MonoVariable.cs 2005-09-06 20:57:30 UTC
(rev 49576)
@@ -120,7 +120,7 @@
if (location == null)
throw new LocationInvalidException ();
- ITargetTypeInfo tinfo = type.GetTypeInfo ();
+ MonoTypeInfo tinfo = type.GetTypeInfo ();
if (tinfo == null)
return null;
@@ -140,7 +140,7 @@
if (var_object == null)
return;
- var_object.SetObject (obj);
+ var_object.SetObject ((MonoObject) obj);
}
public override string ToString ()
Modified: trunk/debugger/backends/native/NativeType.cs
===================================================================
--- trunk/debugger/backends/native/NativeType.cs 2005-09-06 20:47:56 UTC
(rev 49575)
+++ trunk/debugger/backends/native/NativeType.cs 2005-09-06 20:57:30 UTC
(rev 49576)
@@ -54,11 +54,6 @@
public abstract NativeObject GetObject (TargetLocation
location);
- ITargetObject ITargetTypeInfo.GetObject (TargetLocation
location)
- {
- return GetObject (location);
- }
-
ITargetType ITargetTypeInfo.Type {
get { return this; }
}
Modified: trunk/debugger/classes/AbsoluteTargetLocation.cs
===================================================================
--- trunk/debugger/classes/AbsoluteTargetLocation.cs 2005-09-06 20:47:56 UTC
(rev 49575)
+++ trunk/debugger/classes/AbsoluteTargetLocation.cs 2005-09-06 20:57:30 UTC
(rev 49576)
@@ -5,8 +5,7 @@
// <summary>
// This is an absolute address - usually supplied by the user.
// </summary>
- [Serializable]
- public class AbsoluteTargetLocation : TargetLocation
+ internal class AbsoluteTargetLocation : TargetLocation
{
TargetAddress address;
Modified: trunk/debugger/classes/RelativeTargetLocation.cs
===================================================================
--- trunk/debugger/classes/RelativeTargetLocation.cs 2005-09-06 20:47:56 UTC
(rev 49575)
+++ trunk/debugger/classes/RelativeTargetLocation.cs 2005-09-06 20:57:30 UTC
(rev 49576)
@@ -5,8 +5,7 @@
// <summary>
// This is just an address, but its lifetime is tied to the lifetime
of another location.
// </summary>
- [Serializable]
- public class RelativeTargetLocation : TargetLocation
+ internal class RelativeTargetLocation : TargetLocation
{
TargetLocation relative_to;
long offset;
Modified: trunk/debugger/classes/StackFrame.cs
===================================================================
--- trunk/debugger/classes/StackFrame.cs 2005-09-06 20:47:56 UTC (rev
49575)
+++ trunk/debugger/classes/StackFrame.cs 2005-09-06 20:57:30 UTC (rev
49576)
@@ -369,13 +369,6 @@
return Registers [index].Value;
}
- public TargetLocation GetRegisterLocation (int index, long
reg_offset,
- bool dereference)
- {
- return new MonoVariableLocation (
- this, dereference, index, reg_offset, false);
- }
-
public IMethod Method {
get {
check_disposed ();
Modified: trunk/debugger/classes/TargetLocation.cs
===================================================================
--- trunk/debugger/classes/TargetLocation.cs 2005-09-06 20:47:56 UTC (rev
49575)
+++ trunk/debugger/classes/TargetLocation.cs 2005-09-06 20:57:30 UTC (rev
49576)
@@ -2,15 +2,12 @@
namespace Mono.Debugger.Languages
{
- public delegate void LocationEventHandler (TargetLocation location);
-
// <summary>
// This class represents the `location' of a variable. The idea is
that we do
// not always have an address for a variable (for instance if it's
stored in a
// register) and that an addresses lifetime may be limited.
// </summary>
- [Serializable]
- public abstract class TargetLocation
+ internal abstract class TargetLocation
{
protected ITargetAccess target;
protected StackFrame frame;
Modified: trunk/debugger/frontend/CSharpExpressionParser.jay
===================================================================
--- trunk/debugger/frontend/CSharpExpressionParser.jay 2005-09-06 20:47:56 UTC
(rev 49575)
+++ trunk/debugger/frontend/CSharpExpressionParser.jay 2005-09-06 20:57:30 UTC
(rev 49576)
@@ -177,7 +177,7 @@
| variable_or_type_name
| PERCENT IDENTIFIER
{
- $$ = new RegisterExpression ((string) $2, 0);
+ $$ = new RegisterExpression ((string) $2);
}
| STAR expression
{
Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs 2005-09-06 20:47:56 UTC (rev 49575)
+++ trunk/debugger/frontend/Command.cs 2005-09-06 20:57:30 UTC (rev 49576)
@@ -317,8 +317,12 @@
}
case Format.Address: {
- ITargetObject obj = expression.EvaluateVariable
(context);
- context.Print (obj.Location.ReadAddress ());
+ ITargetPointerObject obj =
expression.EvaluateVariable (context)
+ as ITargetPointerObject;
+ if (obj == null)
+ context.Print ("<cannot take address>");
+ else
+ context.Print (obj.Address);
break;
}
@@ -405,10 +409,9 @@
public string Documentation { get { return ""; } }
}
- public class ExamineCommand : DebuggerCommand, IDocumentableCommand
+ public class ExamineCommand : FrameCommand, IDocumentableCommand
{
TargetAddress start;
- ITargetAccess target;
Expression expression;
int count = 16;
@@ -432,7 +435,8 @@
protected override void DoExecute (ScriptingContext context)
{
- byte[] data;
+ FrameHandle frame = ResolveFrame (context);
+ ITargetAccess target = frame.Frame.TargetAccess;
if (!Repeating) {
PointerExpression pexp = expression as
PointerExpression;
@@ -441,13 +445,11 @@
"Expression `{0}' is not a
pointer.",
expression.Name);
- TargetLocation location = pexp.EvaluateAddress
(context);
-
- start = location.Address;
- target = location.TargetAccess;
+ start = pexp.EvaluateAddress (context);
}
- data = target.TargetMemoryAccess.ReadBuffer (start,
count);
+
+ byte[] data = target.TargetMemoryAccess.ReadBuffer
(start, count);
context.Print (TargetBinaryReader.HexDump (start,
data));
start += count;
}
@@ -560,9 +562,7 @@
"Expression `{0}' is not a
pointer.",
expression.Name);
- TargetLocation location = pexp.EvaluateAddress
(context);
-
- address = location.Address;
+ address = pexp.EvaluateAddress (context);
}
AssemblerLine line;
@@ -1480,36 +1480,6 @@
context.Interpreter.Style.Name);
}
}
-
- private class ShowLocationCommand : DebuggerCommand
- {
- Expression expr;
-
- protected override bool DoResolve (ScriptingContext
context)
- {
- expr = ParseExpression (context);
- if (expr == null)
- return false;
-
- expr = expr.Resolve (context);
- if (expr == null)
- return false;
-
- return true;
- }
-
- protected override void DoExecute (ScriptingContext
context)
- {
- TargetLocation location;
- PointerExpression pexpr = expr as
PointerExpression;
- if (pexpr != null)
- location = pexpr.EvaluateAddress
(context);
- else
- location = expr.EvaluateVariable
(context).Location;
-
- Console.WriteLine (location.Print ());
- }
- }
#endregion
public ShowCommand ()
@@ -1529,7 +1499,6 @@
RegisterSubcommand ("frame", typeof (ShowFrameCommand));
RegisterSubcommand ("lang", typeof (ShowLangCommand));
RegisterSubcommand ("style", typeof (ShowStyleCommand));
- RegisterSubcommand ("location", typeof
(ShowLocationCommand));
}
// IDocumentableCommand
@@ -2313,16 +2282,7 @@
ResolveFrame (new_context);
new_context.CurrentFrameIndex = Frame;
- TargetLocation location = pexpr.EvaluateAddress
(context);
- if (location == null)
- throw new ScriptingException (
- "Cannot evaluate expression `{0}'",
pexpr.Name);
-
- if (!location.HasAddress)
- throw new ScriptingException (
- "Cannot get address of expression
`{0}'", pexpr.Name);
-
- TargetAddress address = location.GlobalAddress;
+ TargetAddress address = pexpr.EvaluateAddress (context);
ProcessHandle process = new_context.CurrentProcess;
ISimpleSymbolTable symtab =
process.Process.SimpleSymbolTable;
if (symtab == null) {
@@ -2375,16 +2335,7 @@
if (Process > 0)
new_context.CurrentProcess = ResolveProcess
(new_context);
- TargetLocation location = pexpr.EvaluateAddress
(context);
- if (location == null)
- throw new ScriptingException (
- "Cannot evaluate expression `{0}'",
pexpr.Name);
-
- if (!location.HasAddress)
- throw new ScriptingException (
- "Cannot get address of expression
`{0}'", pexpr.Name);
-
- TargetAddress address = location.GlobalAddress;
+ TargetAddress address = pexpr.EvaluateAddress (context);
ProcessHandle process = new_context.CurrentProcess;
Backtrace backtrace = process.Process.UnwindStack
(address);
Modified: trunk/debugger/frontend/Expression.cs
===================================================================
--- trunk/debugger/frontend/Expression.cs 2005-09-06 20:47:56 UTC (rev
49575)
+++ trunk/debugger/frontend/Expression.cs 2005-09-06 20:57:30 UTC (rev
49576)
@@ -282,10 +282,9 @@
return frame.Language.CreateInstance (frame, val);
}
- public override TargetLocation EvaluateAddress
(ScriptingContext context)
+ public override TargetAddress EvaluateAddress (ScriptingContext
context)
{
- TargetAddress addr = new TargetAddress
(context.AddressDomain, Value);
- return new AbsoluteTargetLocation
(context.CurrentFrame.Frame, addr);
+ return new TargetAddress (context.AddressDomain, Value);
}
protected override object DoEvaluate (ScriptingContext context)
@@ -484,7 +483,7 @@
}
}
- public class VariableAccessExpression : PointerExpression
+ public class VariableAccessExpression : Expression
{
IVariable var;
@@ -514,11 +513,6 @@
return context.CurrentFrame.GetVariable (var);
}
- public override TargetLocation EvaluateAddress
(ScriptingContext context)
- {
- return context.CurrentFrame.GetVariableLocation (var);
- }
-
protected override bool DoAssign (ScriptingContext context,
ITargetObject obj)
{
if (!var.CanWrite)
@@ -1113,19 +1107,17 @@
public abstract class PointerExpression : Expression
{
- public abstract TargetLocation EvaluateAddress
(ScriptingContext context);
+ public abstract TargetAddress EvaluateAddress (ScriptingContext
context);
}
- public class RegisterExpression : PointerExpression
+ public class RegisterExpression : Expression
{
string name;
int register = -1;
- long offset;
- public RegisterExpression (string register, long offset)
+ public RegisterExpression (string register)
{
this.name = register;
- this.offset = offset;
resolved = true;
}
@@ -1149,23 +1141,11 @@
{
FrameHandle frame = context.CurrentFrame;
register = frame.FindRegister (name);
- return context.CurrentFrame.GetRegister (register,
offset);
+ return context.CurrentFrame.GetRegister (register);
}
- public override TargetLocation EvaluateAddress
(ScriptingContext context)
- {
- FrameHandle frame = context.CurrentFrame;
- register = frame.FindRegister (name);
- return frame.Frame.GetRegisterLocation (register,
offset, true);
- }
-
protected override bool DoAssign (ScriptingContext context,
ITargetObject tobj)
{
- if (offset != 0)
- throw new ScriptingException (
- "Cannot assign a register expression
which " +
- "has an offset.");
-
ITargetFundamentalObject fobj = tobj as
ITargetFundamentalObject;
if ((fobj == null) || !fobj.HasObject)
throw new ScriptingException (
@@ -1567,26 +1547,22 @@
"Expression `{0}' is not a pointer type.",
expr.Name);
}
- public override TargetLocation EvaluateAddress
(ScriptingContext context)
+ public override TargetAddress EvaluateAddress (ScriptingContext
context)
{
FrameHandle frame = context.CurrentFrame;
object obj = expr.Resolve (context);
if (obj is int)
obj = (long) (int) obj;
- if (obj is long) {
- TargetAddress taddress = new TargetAddress (
- frame.Frame.AddressDomain, (long) obj);
+ if (obj is long)
+ return new TargetAddress
(frame.Frame.AddressDomain, (long) obj);
- return new AbsoluteTargetLocation (frame.Frame,
taddress);
- }
-
ITargetPointerObject pobj = obj as ITargetPointerObject;
if (pobj == null)
throw new ScriptingException (
"Expression `{0}' is not a pointer
type.", expr.Name);
- return pobj.Location;
+ return pobj.Address;
}
}
@@ -1633,22 +1609,24 @@
{
FrameHandle frame = context.CurrentFrame;
- TargetLocation location = EvaluateAddress (context);
+ TargetAddress address = EvaluateAddress (context);
- if (!location.HasAddress)
- throw new ScriptingException (
- "Cannot take address of expression
`{0}'", expr.Name);
-
- return frame.Language.CreatePointer (frame.Frame,
location.Address);
+ return frame.Language.CreatePointer (frame.Frame,
address);
}
- public override TargetLocation EvaluateAddress
(ScriptingContext context)
+ public override TargetAddress EvaluateAddress (ScriptingContext
context)
{
PointerExpression pexpr = expr as PointerExpression;
if (pexpr != null)
return pexpr.EvaluateAddress (context);
- return expr.EvaluateVariable (context).Location;
+ ITargetPointerObject obj = expr.EvaluateVariable
(context) as
+ ITargetPointerObject;
+ if (obj == null)
+ throw new ScriptingException (
+ "Cannot take address of expression
`{0}'", expr.Name);
+
+ return obj.Address;
}
}
@@ -1769,6 +1747,9 @@
prop_info =
PropertyGroupExpression.OverloadResolve (context, frame.Language, sobj.Type,
indextypes,
candidates);
+ return null;
+
+#if FIXME
if (prop_info == null) {
throw new ScriptingException ("Could
not find matching indexer.");
}
@@ -1778,12 +1759,13 @@
return null;
}
- ITargetFunctionObject func =
getter_info.GetObject (sobj.Location) as ITargetFunctionObject;
+ ITargetFunctionObject func =
getter_info.GetObject (sobj) as ITargetFunctionObject;
if (func == null) {
return null;
}
return func.Invoke (indexargs, false);
+#endif
}
throw new ScriptingException (
Modified: trunk/debugger/frontend/ScriptingContext.cs
===================================================================
--- trunk/debugger/frontend/ScriptingContext.cs 2005-09-06 20:47:56 UTC (rev
49575)
+++ trunk/debugger/frontend/ScriptingContext.cs 2005-09-06 20:57:30 UTC (rev
49576)
@@ -121,12 +121,11 @@
return frame.Language.PointerType;
}
- public ITargetObject GetRegister (int index, long offset)
+ public ITargetObject GetRegister (int index)
{
- ITargetType type = GetRegisterType (index);
- ITargetTypeInfo tinfo = type.GetTypeInfo ();
- TargetLocation location = frame.GetRegisterLocation
(index, offset, false);
- return tinfo.GetObject (location);
+ TargetAddress address = new TargetAddress (
+ frame.AddressDomain, frame.GetRegister (index));
+ return frame.Language.CreatePointer (frame, address);
}
public void SetRegister (int index, long value)
@@ -188,11 +187,6 @@
return var.GetObject (frame);
}
- public TargetLocation GetVariableLocation (IVariable var)
- {
- return var.GetLocation (frame);
- }
-
public ILanguage Language {
get {
if (frame.Language == null)
Modified: trunk/debugger/frontend/Style.cs
===================================================================
--- trunk/debugger/frontend/Style.cs 2005-09-06 20:47:56 UTC (rev 49575)
+++ trunk/debugger/frontend/Style.cs 2005-09-06 20:57:30 UTC (rev 49576)
@@ -417,8 +417,7 @@
case TargetObjectKind.Class:
case TargetObjectKind.Struct:
case TargetObjectKind.Array:
- return String.Format (
- "({0}) {1}", obj.TypeName,
obj.Location.Address);
+ return String.Format ("({0})", obj.TypeName);
default:
return obj.Print ();
Modified: trunk/debugger/interfaces/ITargetObject.cs
===================================================================
--- trunk/debugger/interfaces/ITargetObject.cs 2005-09-06 20:47:56 UTC (rev
49575)
+++ trunk/debugger/interfaces/ITargetObject.cs 2005-09-06 20:57:30 UTC (rev
49576)
@@ -49,10 +49,6 @@
// </summary>
byte[] GetRawDynamicContents (int max_size);
- TargetLocation Location {
- get;
- }
-
string Print ();
}
}
Modified: trunk/debugger/interfaces/ITargetTypeInfo.cs
===================================================================
--- trunk/debugger/interfaces/ITargetTypeInfo.cs 2005-09-06 20:47:56 UTC
(rev 49575)
+++ trunk/debugger/interfaces/ITargetTypeInfo.cs 2005-09-06 20:57:30 UTC
(rev 49576)
@@ -21,7 +21,5 @@
int Size {
get;
}
-
- ITargetObject GetObject (TargetLocation location);
}
}
Modified: trunk/debugger/interfaces/IVariable.cs
===================================================================
--- trunk/debugger/interfaces/IVariable.cs 2005-09-06 20:47:56 UTC (rev
49575)
+++ trunk/debugger/interfaces/IVariable.cs 2005-09-06 20:57:30 UTC (rev
49576)
@@ -40,8 +40,6 @@
// </remarks>
ITargetObject GetObject (StackFrame frame);
- TargetLocation GetLocation (StackFrame frame);
-
bool CanWrite {
get;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches