Hi!

Addresses are communicated from the Mono VM as a platform-specific pointer, however Mono.Debugger.TargetBinaryReader.PeekAddress() and ReadAddress() read the pointer as a 32 bit *signed* int on 32 bit architectures and return a sign-extended 64 bit signed int. This causes problems if the communicated address is > 2**31 which is frequently the case. When that happens the debugger library is for example unable to find the containing method correctly given a program location.

Attached patch fixes this by reading a 32 bit uint from the Mono VM instead. However I think all the APIs should be sanitized to use 64 bit *unsigned* longs (ulongs) for addresses as well, using signed longs does not make much sense.


Best regards,


Hans
--
Hans Kratz
Omnicore Software
http://www.omnicore.com
Index: classes/TargetBinaryReader.cs
===================================================================
--- classes/TargetBinaryReader.cs	(revision 45562)
+++ classes/TargetBinaryReader.cs	(working copy)
@@ -147,7 +147,7 @@
 			if (AddressSize == 8)
 				return PeekInt64 (pos);
 			else
-				return PeekInt32 (pos);
+				return PeekUInt32 (pos);
 		}
 
 		public long PeekAddress ()
@@ -160,7 +160,7 @@
 			if (AddressSize == 8)
 				return ReadInt64 ();
 			else
-				return ReadInt32 ();
+				return ReadUInt32 ();
 		}
 
 		public string PeekString (long pos)
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to