Author: martin
Date: 2006-04-17 22:12:49 -0400 (Mon, 17 Apr 2006)
New Revision: 59572

Added:
   trunk/debugger/languages/AbsoluteTargetLocation.cs
   trunk/debugger/languages/BitfieldTargetLocation.cs
   trunk/debugger/languages/ClientSuppliedTargetLocation.cs
   trunk/debugger/languages/RelativeTargetLocation.cs
   trunk/debugger/languages/TargetLocation.cs
   trunk/debugger/languages/mono/MonoVariableLocation.cs
Removed:
   trunk/debugger/backends/classes/
Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/arch/DwarfReader.cs
   trunk/debugger/backends/Makefile.am
   trunk/debugger/build/Makefile.am
   trunk/debugger/configure.in
Log:
2006-04-18  Martin Baulig  <[EMAIL PROTECTED]>

        * backends/classes/*TargetLocation.cs: Moved to languages/
        * backends/classes/MonoVariableLocation: Moved to languages/mono/.

        * backends/classes/: Removed.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2006-04-18 02:08:00 UTC (rev 59571)
+++ trunk/debugger/ChangeLog    2006-04-18 02:12:49 UTC (rev 59572)
@@ -1,5 +1,12 @@
 2006-04-18  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * backends/classes/*TargetLocation.cs: Moved to languages/
+       * backends/classes/MonoVariableLocation: Moved to languages/mono/.
+
+       * backends/classes/: Removed.
+
+2006-04-18  Martin Baulig  <[EMAIL PROTECTED]>
+
        * backends/TargetReader.cs: Moved here from backends/classes/.
 
 2006-04-18  Martin Baulig  <[EMAIL PROTECTED]>

Modified: trunk/debugger/arch/DwarfReader.cs
===================================================================
--- trunk/debugger/arch/DwarfReader.cs  2006-04-18 02:08:00 UTC (rev 59571)
+++ trunk/debugger/arch/DwarfReader.cs  2006-04-18 02:12:49 UTC (rev 59572)
@@ -6,6 +6,7 @@
 
 using Mono.Debugger.Languages;
 using Mono.Debugger.Languages.Native;
+using Mono.Debugger.Languages.Mono;
 
 namespace Mono.Debugger.Backends
 {

Modified: trunk/debugger/backends/Makefile.am
===================================================================
--- trunk/debugger/backends/Makefile.am 2006-04-18 02:08:00 UTC (rev 59571)
+++ trunk/debugger/backends/Makefile.am 2006-04-18 02:12:49 UTC (rev 59572)
@@ -1,4 +1,4 @@
-SUBDIRS = classes server
+SUBDIRS = server
 
 EXTRA_DIST = BreakpointManager.cs Debugger.cs ILanguageBackend.cs Inferior.cs \
        MonoThreadManager.cs Process.cs ProcessStart.cs SingleSteppingEngine.cs 
\

Modified: trunk/debugger/build/Makefile.am
===================================================================
--- trunk/debugger/build/Makefile.am    2006-04-18 02:08:00 UTC (rev 59571)
+++ trunk/debugger/build/Makefile.am    2006-04-18 02:12:49 UTC (rev 59572)
@@ -33,7 +33,6 @@
 LIBRARY_SRCLIST = \
        $(top_srcdir)/arch/*.cs                         \
        $(top_srcdir)/backends/*.cs                     \
-       $(top_srcdir)/backends/classes/*.cs             \
        $(top_srcdir)/languages/*.cs                    \
        $(top_srcdir)/languages/mono/*.cs               \
        $(top_srcdir)/languages/native/*.cs             \

Modified: trunk/debugger/configure.in
===================================================================
--- trunk/debugger/configure.in 2006-04-18 02:08:00 UTC (rev 59571)
+++ trunk/debugger/configure.in 2006-04-18 02:12:49 UTC (rev 59572)
@@ -227,7 +227,6 @@
 build/Makefile
 build/Mono.Debugger.dll.config
 backends/Makefile
-backends/classes/Makefile
 backends/server/Makefile
 languages/Makefile
 languages/mono/Makefile

Copied: trunk/debugger/languages/AbsoluteTargetLocation.cs (from rev 59549, 
trunk/debugger/backends/classes/AbsoluteTargetLocation.cs)

Copied: trunk/debugger/languages/BitfieldTargetLocation.cs (from rev 59549, 
trunk/debugger/backends/classes/BitfieldTargetLocation.cs)

Copied: trunk/debugger/languages/ClientSuppliedTargetLocation.cs (from rev 
59549, trunk/debugger/backends/classes/ClientSuppliedTargetLocation.cs)

Copied: trunk/debugger/languages/RelativeTargetLocation.cs (from rev 59549, 
trunk/debugger/backends/classes/RelativeTargetLocation.cs)

Copied: trunk/debugger/languages/TargetLocation.cs (from rev 59559, 
trunk/debugger/backends/classes/TargetLocation.cs)

Copied: trunk/debugger/languages/mono/MonoVariableLocation.cs (from rev 59559, 
trunk/debugger/backends/classes/MonoVariableLocation.cs)
===================================================================
--- trunk/debugger/backends/classes/MonoVariableLocation.cs     2006-04-18 
00:34:37 UTC (rev 59559)
+++ trunk/debugger/languages/mono/MonoVariableLocation.cs       2006-04-18 
02:12:49 UTC (rev 59572)
@@ -0,0 +1,165 @@
+using System;
+using Mono.Debugger.Backends;
+
+namespace Mono.Debugger.Languages.Mono
+{
+       // <summary>
+       //   The location of a variable.
+       // </summary>
+       [Serializable]
+       internal sealed class MonoVariableLocation : TargetLocation
+       {
+               bool is_byref;
+               bool is_regoffset;
+               bool is_valid;
+               Register register;
+               long regoffset;
+
+               TargetAddress address;
+
+               public MonoVariableLocation (Thread target, bool is_regoffset,
+                                            Register register, long regoffset, 
bool is_byref)
+               {
+                       this.is_regoffset = is_regoffset;
+                       this.register = register;
+                       this.regoffset = regoffset;
+                       this.is_byref = is_byref;
+
+                       update (target);
+               }
+
+               void update (Thread target)
+               {
+                       // If this is a reference type, the register just holds 
the
+                       // address of the actual data, so read the address from 
the
+                       // register and return it.
+                       if (!register.Valid) {
+                               is_valid = false;
+                               return;
+                       }
+
+                       long contents = register.Value;
+
+                       if (contents == 0)
+                               address = TargetAddress.Null;
+                       else
+                               address = new TargetAddress (
+                                       target.AddressDomain, contents + 
regoffset);
+
+                       if (is_byref && is_regoffset)
+                               address = target.ReadAddress (address);
+                       is_valid = true;
+               }
+
+               public override bool HasAddress {
+                       get { return is_regoffset || is_byref; }
+               }
+
+               public override TargetAddress Address {
+                       get {
+                               if (!is_valid)
+                                       throw new LocationInvalidException ();
+
+                               return address;
+                       }
+               }
+
+               internal override TargetBlob ReadMemory (Thread target, int 
size)
+               {
+                       if (!is_valid)
+                               throw new LocationInvalidException ();
+
+                       if (HasAddress)
+                               return base.ReadMemory (target, size);
+
+                       // If this is a valuetype, the register hold the whole 
data.
+                       long contents = address.Address;
+
+                       byte[] buffer;
+                       if (size == 1)
+                               buffer = BitConverter.GetBytes ((byte) 
contents);
+                       else if (size == 2)
+                               buffer = BitConverter.GetBytes ((short) 
contents);
+                       else if (size == 4)
+                               buffer = BitConverter.GetBytes ((int) contents);
+                       else if (size == 8)
+                               buffer = BitConverter.GetBytes (contents);
+                       else
+                               throw new ArgumentException ();
+
+                       return new TargetBlob (buffer, target.TargetInfo);
+               }
+
+               internal override void WriteBuffer (Thread target, byte[] data)
+               {
+                       if (!is_valid)
+                               throw new LocationInvalidException ();
+
+                       if (HasAddress) {
+                               base.WriteBuffer (target, data);
+                               return;
+                       }
+
+                       long contents;
+
+                       if (data.Length > target.TargetInfo.TargetIntegerSize)
+                               throw new InternalError ();
+
+                       if (data.Length < target.TargetInfo.TargetIntegerSize) {
+                               switch (data.Length) {
+                               case 1: contents = data[0]; break;
+                               case 2: contents = BitConverter.ToInt16 (data, 
0); break;
+                               case 4: contents = BitConverter.ToInt32 (data, 
0); break;
+                               default:
+                                 throw new InternalError ();
+                               }
+                       }
+                       else if (target.TargetInfo.TargetIntegerSize == 4)
+                               contents = BitConverter.ToInt32 (data, 0);
+                       else if (target.TargetInfo.TargetIntegerSize == 8)
+                               contents = BitConverter.ToInt64 (data, 0);
+                       else
+                               throw new InternalError ();
+
+                       // If this is a valuetype, the register hold the whole 
data.
+                       register.WriteRegister (target, contents);
+                       update (target);
+               }
+
+               internal override void WriteAddress (Thread target, 
TargetAddress new_address)
+               {
+                       if (!is_valid)
+                               throw new LocationInvalidException ();
+
+                       if (is_regoffset) {
+                               TargetAddress the_addr;
+                               if (is_byref)
+                                       the_addr = new TargetAddress (
+                                               target.AddressDomain, 
register.Value + regoffset);
+                               else
+                                       the_addr = address;
+
+                               target.WriteAddress (the_addr, new_address);
+                               update (target);
+                       } else {
+                               register.WriteRegister (target, 
new_address.Address);
+                               update (target);
+                       }
+               }
+
+               public override string Print ()
+               {
+                       if (regoffset > 0)
+                               return String.Format ("%{0}+0x{1:x}", 
register.Name, regoffset);
+                       else if (regoffset < 0)
+                               return String.Format ("%{0}-0x{1:x}", 
register.Name, -regoffset);
+                       else
+                               return String.Format ("%{0}", register.Name);
+               }
+
+               protected override string MyToString ()
+               {
+                       return String.Format (":{0}:{1}:{2:x}", is_regoffset, 
register, regoffset);
+               }
+       }
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to