#1388 Best way to debug a JavaFFI

DanielFath Fri 14 Jan 2011

Ok, so I got my java FFI working but the result of executing the java lib through FFI don't match the desired result. Is there an IDE that can somehow debug through the Java FFI?

If not, is there any other way to debug this conundrum? Could JStub generate sources along with .class files for easier debugging?

tcolar Fri 14 Jan 2011

In theory my netbeans plugin does. Or at least it use to

I haven't tested it much in a while, but it use to work fairly good.

DanielFath Fri 14 Jan 2011

I used F4 for most of my work (whose debugging isn't all that great). I'll see if FantomIDE can do that. Is there debugging variable I need to tweak for it to work?

ivan Mon 17 Jan 2011

Daniel,

Could you give more detail about your ffi debug experience in F4 (you can mail to fan-dev@xored, com or to me directly)? We use F4 to debug F4 itself which has a lot FFI code indeed.

DanielFath Mon 17 Jan 2011

To be honest I haven't used F4 to debug (I just echo it and occasionally use the debugger to pause execution), since I can't watch local variables or user-defined expressions.

tcolar Mon 17 Jan 2011

IIRC, You need to set a flag or something for fantom to generate debug infos for local variables.

Fan_debug I think its called. See the docs.

tcolar Mon 17 Jan 2011

DanielFath Mon 17 Jan 2011

Whooops, my bad. So Ivan, how will Fantom debug Java FFI? Will I just be able to step into the FFI?

ivan Mon 17 Jan 2011

Yes, both stepping into and setting java breakpoints should work

DanielFath Mon 17 Jan 2011

Thanks. Just one question though - how do I make sure that jar my FFI uses will have it's source code attached (in Eclipse or F4)? Could I manually specify that my pod needs miglayout.jar using referenced libraries? Currently I just drop miglayout.jar in lib/ext.

ivan Mon 17 Jan 2011

Looks like this functionality is broken at the moment. Normally you just use third-party jars as you normally would in Java project in Eclipse (i.e. go to Project properties -> Java Build Path -> Libraries -> Add External JARs...).

Right now it is possible to set breakpoints on both Fantom and Java side and breakpoints work, but while stepping into the java code, the F4 fails to locate the sources (though it displays the local variables and line number correctly, so in fact having sources opened somewhere else you can identify where you are and what is going on)

I'm going to investigate the problem right now and if the fix is easy, I'll push the changes and put a new version on http://xored.com/fantom/download

EDIT: Fixed, waiting for a build system to build

DanielFath Mon 17 Jan 2011

Did you upload it, yet? I checked about 15min ago but Eclipse found no updates (my networks is kinda crappy so I need to know).

EDIT: Should i use http://download.xored.com/f4/updates/stable/ link or something else?

ivan Mon 17 Jan 2011

Update site is correct, but I haven't posted it yet - some problems with our CI server. I'll post a note here once it will be done

ivan Tue 18 Jan 2011

Just put a new version both to update site and downloads page. Besides FFI fix, few other annoying bugs are fixed (thanks to @vkuzkokov and @alena):

  • Correct auto-completion for slot literals `http://bugs.xored.com/browse/FAN-419`
  • Correct highlighting for triple-quoted strings `http://bugs.xored.com/browse/FAN-424`
  • Completion improvements in complex cases `http://bugs.xored.com/browse/FAN-363`

DanielFath Tue 18 Jan 2011

Thanks, will probably test it later this evening.

PS: Yay, it works well ( I fixed one bug with it :D). Except for debugging with-blocks. Sent you a mail ivan, hope my scenario was detailed enough.

Login or Signup to reply.