SOLVED: Re: [Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-08-01 Thread Rodrigo B. de Oliveira
On 7/28/05, Rodrigo B. de Oliveira [EMAIL PROTECTED] wrote:
 On 7/28/05, Rodrigo B. de Oliveira [EMAIL PROTECTED] wrote:
  ...
  I'm getting off-by-one errors only with raise/throw statements:
 
 
 The behavior is actually a little more complex but still predictable.
 The stack trace entry for the raise line is always the line of the
 next statement in the same method:
 

The workaround was to emit debugging information again for a Nop just
after the raise statement. Now the lines are reported correctly in
both runtimes.

-- 
bamboo
http://blogs.codehaus.org/people/bamboo/
Got objects? http://www.db4o.com/
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-07-28 Thread Rodrigo B. de Oliveira
On 7/28/05, Rodrigo B. de Oliveira [EMAIL PROTECTED] wrote:
 ...
 I'm getting off-by-one errors only with raise/throw statements:
 

The behavior is actually a little more complex but still predictable.
The stack trace entry for the raise line is always the line of the
next statement in the same method:

src name=other.boo
def foo():
 raise foo


 return 1
 
 def bar():
 foo()
 
 bar()
/src

I get then:
 
Unhandled Exception: System.ApplicationException: foo
 in [0xa] (at Other.boo:5) OtherModule:foo ()
 in [0x0] (at Other.boo:8) OtherModule:bar ()
 in [0x0] (at Other.boo:10) OtherModule:Main (System.String[] argv)
 
Any ideas?
bamboo
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-05-26 Thread Rodrigo B. de Oliveira
Hi,

I've just built the latest mono/mcs/debugger from the repository and
although debugging information is being emitted now, the runtime and
the debugger cannot make use of it. I get no source information on
stack traces and mdb is unable to display source lines.

The only important setting I've used on building mono was --with-preview=no.

Here's a console dump of a session with mdb:

[EMAIL PROTECTED]:~/dotnet/boo/build$ mdb booish.exe
Mono Debugger
(mdb) run
Starting program: booish.exe
** Message: x86-linux-ptrace.c:77: b6d53bb0 - can't read target memory
of 16935 at address b7ff7195 : Argumento inválido
Process @4 stopped at #0: 0xb725b430 in BooishModule.Main(System.String[]).
BooishModule.Main(System.String[]):
0xb725b430  push   %ebp
(mdb) n
Process @4 stopped at #0: 0xb725b431 in BooishModule.Main(System.String[])+0x1.
0xb725b431  mov%esp,%ebp
(mdb)

I'm running ubuntu hoary and uname -a reports:
Linux bambuntu 2.6.10-5-k7 #1 Fri May 20 15:49:12 UTC 2005 i686 GNU/Linux

Any ideas?
Rodrigo

On 5/17/05, Lluis Sanchez [EMAIL PROTECTED] wrote:
 Hi!
 
 This patch adds some basic support for generating debug info in SRE. 
 ...
 I'll commit if there are no objections.
 Lluis.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-05-22 Thread Rodrigo B. de Oliveira
is this already in?

On 5/18/05, Ben Maurer [EMAIL PROTECTED] wrote:
 Miguel asked me to look at the memory impact of this patch.
 ...
  So, this is probably ok.
 
 -- Ben

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-05-18 Thread Ben Maurer
Miguel asked me to look at the memory impact of this patch.

My only complaint is the amount of boxing that goes on in the
sequence-point list. Can you turn this into an array of structs that you
grow youself?

As far as I can tell, the list of sequence points is kept in memory for
*all* methods until the debug info is emitted. However, as far as I
know, this happens in many other places (eg, ILGenerator's are kept for
all members until the assembly is saved). So, this is probably ok.

-- Ben

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-05-17 Thread Lluis Sanchez
Hi!

This patch adds some basic support for generating debug info in SRE. It
implements ModuleBuilder.DefineDocument and
ILGenerator.MarkSequencePoint, and should be enough for most of
compilers. With this patch, Boo and IKVM can generate correct debug
info.

The symbol writer is still implemented in
Mono.CompilerServices.SymbolWriter. I added a wrapper class that
implements ISymbolWritter and which is created by ModuleBuidler using
reflection. This class just forwards the calls to MonoSymbolWriter (the
one used by mcs).

There is also a patch for reflection.c, which is a workaround for bug
#74914. With this patch, MethodBuilder objects will return the correct
token value after the module is saved. This fixes the problem because
the debug info is generated after saving the module.

I'll commit if there are no objections.
Lluis.
Index: ChangeLog
===
--- ChangeLog	(revision 44628)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2005-05-17  Lluis Sanchez Gual  [EMAIL PROTECTED]
+
+	* reflection.c: Update the table_idx field of method builders after
+	saving the module, since it can change. This is a workaround for
+	bug #74914. 
+
 2005-05-12  Zoltan Varga  [EMAIL PROTECTED]
 
 	* marshal.c (emit_marshal_custom): Add some error checking and call the
Index: reflection.c
===
--- reflection.c	(revision 44628)
+++ reflection.c	(working copy)
@@ -1373,6 +1373,7 @@
 	reflection_methodbuilder_from_method_builder (rmb, mb);
 
 	mono_image_basic_method (rmb, assembly);
+	mb-table_idx = *rmb.table_idx;
 
 	if (mb-dll) { /* It's a P/Invoke method */
 		guint32 moduleref;
@@ -1449,6 +1450,7 @@
 	reflection_methodbuilder_from_ctor_builder (rmb, mb);
 
 	mono_image_basic_method (rmb, assembly);
+	mb-table_idx = *rmb.table_idx;
 }
 
 static char*
Index: ChangeLog
===
--- ChangeLog	(revision 44494)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2005-05-17  Lluis Sanchez Gual  [EMAIL PROTECTED]
+
+	* SymbolWriterImpl.cs: An implementation of ISymbolWriter. It is just a
+	wrapper for the MonoSymbolWriter class that mcs is using.
+
 2005-04-04  Marek Safar  [EMAIL PROTECTED]
 
 	* MonoSymbolFile.cs: Removed unused fields.
Index: Mono.CompilerServices.SymbolWriter.dll.sources
===
--- Mono.CompilerServices.SymbolWriter.dll.sources	(revision 44494)
+++ Mono.CompilerServices.SymbolWriter.dll.sources	(working copy)
@@ -3,3 +3,4 @@
 MonoSymbolWriter.cs
 MonoSymbolTable.cs
 MonoSymbolFile.cs
+SymbolWriterImpl.cs
Index: SymbolWriterImpl.cs
===
--- SymbolWriterImpl.cs	(revision 0)
+++ SymbolWriterImpl.cs	(revision 0)
@@ -0,0 +1,322 @@
+//
+// SymbolWriterImpl.cs
+//
+// Author:
+//   Lluis Sanchez Gual ([EMAIL PROTECTED])
+//
+// (C) 2005 Novell, Inc.  http://www.novell.com
+//
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// Software), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Collections;
+using System.IO;
+using System.Diagnostics.SymbolStore;
+	
+namespace Mono.CompilerServices.SymbolWriter
+{
+	public class SymbolWriterImpl: ISymbolWriter
+	{
+		MonoSymbolWriter msw;
+		ModuleBuilder mb;
+
+		delegate Guid GetGuidFunc (ModuleBuilder mb);
+		GetGuidFunc get_guid_func;
+		
+		int currentToken;
+		string methodName;
+		Stack namespaceStack = new Stack ();
+		bool methodOpened;
+		
+		Hashtable documents = new Hashtable ();
+		
+		public SymbolWriterImpl (ModuleBuilder mb)
+		{
+			this.mb = mb;
+		}
+		
+		public void Close ()
+		{
+			MethodInfo mi = typeof (ModuleBuilder).GetMethod (
+Mono_GetGuid,
+BindingFlags.Static | BindingFlags.NonPublic);
+			if (mi == null)
+return;
+
+			get_guid_func = 

Re: [Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-05-17 Thread Rodrigo B. de Oliveira
On 5/17/05, Lluis Sanchez [EMAIL PROTECTED] wrote:
 Hi!
 
 This patch adds some basic support for generating debug info in SRE. It
 implements ModuleBuilder.DefineDocument and
 ILGenerator.MarkSequencePoint, and should be enough for most of
 compilers. With this patch, Boo and IKVM can generate correct debug
 info.
 

WAHOO!

:)
Rodrigo
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] Patch for generating debug info in System.Reflection.Emit

2005-05-17 Thread Kamil Skalski
Dnia wtorek, 17 maja 2005 17:25, Lluis Sanchez napisa:
 Hi!

 This patch adds some basic support for generating debug info in SRE. It
 implements ModuleBuilder.DefineDocument and
 ILGenerator.MarkSequencePoint, and should be enough for most of
 compilers. With this patch, Boo and IKVM can generate correct debug
 info.

This is really great news. Thanks a lot! Maybe now I will also try mono 
debugger for Nemerle development.


 The symbol writer is still implemented in
 Mono.CompilerServices.SymbolWriter. I added a wrapper class that
 implements ISymbolWritter and which is created by ModuleBuidler using
 reflection. This class just forwards the calls to MonoSymbolWriter (the
 one used by mcs).

 There is also a patch for reflection.c, which is a workaround for bug
 #74914. With this patch, MethodBuilder objects will return the correct
 token value after the module is saved. This fixes the problem because
 the debug info is generated after saving the module.

 I'll commit if there are no objections.
 Lluis.

-- 
Kamil Skalski
http://nazgul.omega.pl
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list