[Mono-devel-list] Debug api questions

Martin Baulig martin at ximian.com
Tue Jan 11 15:49:00 EST 2005

On Tue, 2005-01-11 at 21:42 +0100, Carlo Kok wrote:

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


well, the Mono Debugger doesn't know anything about scopes yet, but it
knows about a variable's life time (it gets this information from the

In your example, it is very likely that both `a' and `c' would be stored
in the same register.

> 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();

Well, there is already some API there, but not used yet.  I can have a
look at this.

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


I'd also love to see the field initialization thing for C#.

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

The offset of the next statement.


More information about the Mono-devel-list mailing list