#678 Any plans on an Step-by-Step debug of the fan code?

wangzaixiang Thu 23 Jul 2009

Can we do a step-by-step debug on fan code? I think it is a best way for newbie to learn the fan code?

An IDE support such as eclipse or netbeans would be more attractive, but step-by-step debug may be the first step than syntax highlight or code complete.

brian Thu 23 Jul 2009

I would assume that most of the IDE work being on NetBeans, IntelliJ, etc will support this eventually (maybe those guys can comment).

wangzaixiang Thu 23 Jul 2009

I find a way to do some step-by-step debug in eclipse. in this way, we can trace the fan code step by step.

  1. using jstub to generate a java jar
  2. put the jar on your classpath
  3. attach source code to the jar. (either directory or a java project) in my pod "foo" and type "HelloWorld", be sure to put HelloWorld.fan under fan/foo directory since the HelloWolrd class is qualified with "fan.foo.HelloWorld"
  4. now you can open the pod's jar and navigate to class, open the class, it will open the related HelloWorld.fan
  5. you can add breakpoint in the HelloWorld.fan
  6. start fan by launch fanx.tools.Fan
  7. the breakpoint will worked.

Problem: during debug, no local variable can be inspect in the "variable" view. It looks that fan generated class missing the LocalVariable attribute. It would be fine add the LocalVariable attribute in the generate class so we can trace the variables during debug.

I am just using this way to learn the compiler pod

brian Thu 23 Jul 2009

very cool

I will create ticket for LocalVariable attribute in bytecode

tcolar Thu 23 Jul 2009

Yeah had expected it to work in java debug mode.

Will try to integrate it to netbeans a bit better at some point, but not high priority. Turn out that making a NB plugin is pretty major work !

tcolar Mon 24 Aug 2009

tcolar Mon 24 Aug 2009

Did you get to fix this yet ? Also was that only for local variables. ie: class names, line numbers etc.. are in there right ?

brian Mon 24 Aug 2009

Local variables are available in fcode, but I am not emitting them as LocalVariable attributes in JVM bytecode yet.

tcolar Thu 15 Apr 2010

It seem the fantom emmited code still doesn't have local debug variables available ... I thought it worked at some point(am I dreaming ?) but it seems it stopped working.

I am using -Dfan.debug=true

brian Thu 15 Apr 2010

The debug flag is initialized from etc/sys.props (it is commented out in default distro).

Login or Signup to reply.