[Mono-devel-list] Debug api questions

Carlo Kok ck2004 at carlo-kok.com
Tue Jan 11 15:42:13 EST 2005


Martin Baulig wrote:
>>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.

Yes.

Or, for example:
{
   int abc = 10;
   if (x) { int a = abc + 10; dosomething(a); } else {int c = abc + 10; 
dosomething(c); }
}
Not sure if mcs does this. but our compiler reuses variables when they 
are not used anymore. So there would only be two integers.

So if I want to get this working, I'd need to do something like:
openscope()
definelocal(abc);
openscope();
definelocal(abc);
definelocal(a);
closescope();
openscope();
definelocal(abc);
definelocal(b);
closescope();
closescope();


>>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
> course.

That would be great.

> 
>>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.

Ah oke. Same offset or offset of the next statement?

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

Ok.

> 
> 
>>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 ?

Chrome ( http://www.chromesville.com )

> 
> 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.

Ah oke.

> 
> 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.

That would be great.

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

Thanks.

--
Carlo Kok
RemObjects Software



More information about the Mono-devel-list mailing list