[nem-en] Debug support

Kamil Skalski kamil.skalski at gmail.com
Sun Dec 17 22:23:28 CET 2006


I committed some improvements in generated debug information. The
mentioned example now works quite fine.
It is not perfect - when you step through code debugger will stop at
every pattern it checks instead of jumping to right one immediately.
It is related to two problems:
- we currently do not emit IL switch instruction, but always a series
of if conditions
- for debugging purpose we should generate the bodies of match cases
and pattern checks separately to get the "nice switch effect"  - first
the right branch would be computed (with location pointing to the
matched expression) and then we could jump.
I'm not willing to do this change at the moment, maybe in future if
find some time.

Let me know if the overall debugging experience is now better. If you
give me some more examples, which work extremely ugly in debugger I
will look at them too.
I also encourage you to track what is happening with locations by your
own - the compiler steps after typing are a lot simpler than Typer...
;-)

I expect that problems with debugging lambdas are caused by
ncc/generation/Typer3.n which produces the internal classes for
functions and closures.

2006/12/17, Kamil Skalski <kamil.skalski at gmail.com>:
> This is surely a long and a bit boring process to ensure that debug
> info is in correct format to understand by MDbgr... but maybe we can
> fix the worst cases easily. I was searching for some tool to inspect
> generated debug info and found:
>
> http://blogs.msdn.com/jmstall/archive/2005/08/25/pdb2xml.aspx
>
> For the easier start, you could post the most problematic examples, so
> I can play with them (at best with their C# counterparts, so we can
> compare). Currently I'm looking at:
>
> def x = 333;
>
> match (x) {
>   | 1 => ()
>   | 2 => ()
>   | 3 => ()
>   | 4 => System.Console.WriteLine (x);
>   | 5 => System.Console.WriteLine (x);
>   | 333 => System.Console.WriteLine (x);
>   | _ => System.Console.WriteLine (x);
> }
>
> if (false)
>   Nemerle.IO.printf ("Ala %d ma \n", 5);
> else {
>   def li = [1,2,3];
>   System.Console.WriteLine (li);
> }
>
> 06-12-15, vc <vc at rsdn.ru> napisał(a):
> > The Nemerle compiler is successfully moving to the release. But there is one
> > important problem, not solved up to this moment. It is the support for
> > debugging.
> >
> > .Net programmers do have a habit of using debugger.
> > But ncc generate very bad .pdb files.
> > We need to make efforts for elimination of this problem.
> >
> > This is an intricate problem which can be solved only by the compiler team.
> >
> > Kamil, Michał, please, find some time to solve this problem.
> >
> >
> > _______________________________________________
> > https://nemerle.org/mailman/listinfo/devel-en
> >
>
>
> --
> Kamil Skalski
> http://nazgul.omega.pl
>


-- 
Kamil Skalski
http://nazgul.omega.pl


More information about the devel-en mailing list