[Mono-devel-list] Debug api questions

Martin Baulig martin at ximian.com
Tue Jan 11 14:20:00 EST 2005

On Wed, 2005-01-05 at 19:27 +0100, Carlo Kok wrote:

> I've had a look at the debugging apis and had a few questions:


> DefineLocalVariable:
> Given a local variable, it could have multiple meanings within different 
> scopes. Could it be possible to pass a StartOffset/EndOffset (and with 
> it an index) ?

Good point.  I guess you mean the following case:

	void Test (int a)
		if (a < 3) {
			long b = a * 8;
			Console.WriteLine (b);
		} else {
			long b = a * 4;
			Console.WriteLine (b);

I just tried this with mdb and what happens is that it shows two local
variables with the same name `b' (and it correctly gets their scope).  I
consider this an important bug and will try to fix it soon.

> MarkSequencePoint:
> Some code within a method could be written in another file (for example 
> include files), MarkSequencePoint doesn't seem to allow to say which 
> file it was defined in, also how do I say where (and the debugger) it ends? There could be 
> multiple statements on a line.

Well, at the moment, Mono's debugging API is only used for C# code and
there a method can't be in multiple files.  We could change that, of

>From the debugger's point of view, a method is always in one single
source file - if a part of a method is in an include file, the debugger
currently ignores that (as if there was no source code available for
it).  This could be changed at a later time.

MarkSequencePoint only marks the beginning of a statement.  A statement
ends where the next statement begins.  To mark the end of a statement,
just call MarkSequencePoint again with the end offset / line number.

Column numbers are currently ignored since MCS doesn't support column
numbers.  This is a long overdue wishlist item.

> OpenMethod:
> Do the StartRow/StartColumn/EndRow/EndColumn do anything? Because for 
> our compiler part of a method could be in another file/location (for 
> example field initialization code within a constructor)

For which language is your compiler ?

The StartRow/EndRow specify the "bounds" of the method's source code,
ie. if the user tells the debugger "show me the source code of method
Foo", it'll display row StartRow till row EndRow.

Field initialization within a constructor is a good point - I think what
we should do is add a file argument to MarkSequencePoint.  Then,
StartRow/EndRow would still be in the same file, but you could have some
lines from different files in the method.

> CreateOutput:
> the GUID parameter, I'm not sure what this is, should this be the same 
> as the Module guid?


Lemme know if you have any more questions.


More information about the Mono-devel-list mailing list