[kaffe] debugging JITted methods

Dalibor Topic robilad at kaffe.org
Mon Mar 15 06:59:02 PST 2004

kaffe at jbbrown9.mailshell.com wrote:
> I am using Kaffe for a research project in school where I am adding a 
> bytecode to some .class files. It's a new bytecode and I'm trying to 
> make the changes to the JIT to account for the new bytecode, but coming 
> across some trouble.
> I started out making changes to the interpreter. Mostly, it involved 
> copying/pasting INVOKESTATIC in kaffe.def and adding a couple asm(...) 
> statements. But, it turns out I need to use the JIT, which is not so 
> straightforward. I've been working on it some and think I have an idea 
> of how I need to do things differently, but debugging is going to be 
> tough. As a rudimentary way of debugging, I have been trying to find a 
> way to dump the JITted method so I could look at that, but haven't been 
> able to find a good way to do that.

See the xdebugging support (FAQ.xdebugging) for a way to generate 
debugging information in jitted code siutable for gdb.

You can take a look at the emitted code from the jitter by configuring 
and building kaffe with --enable-debug and using kaffe -vmdebug JIT to 
run your classes.

> I expect implementing the new code could be done really cleanly (and 
> quickly) by someone who really understands how the JIT is implemented. 
> I'm just having a tough time figuring that out.

See FAQ.jit3 for a nice overview of how jit3 works.

> If you can help me out some, I'd really appreciate it. If I get it all 
> figured out, I'd be willing to write up some documentation on how I did 
> what I'm working on so if/when other people try to do something similar 
> they could suffer a little less than me.

That would be very welcome!

> About my environment:
> My PC is intel/linux
> Kaffe is compiled to alpha/digital unix
> I'm running the JVM on an alpha simulator on the intel machine
> This makes debugging much tougher because if I run gdb I'm debugging the 
> simulator, not kaffe. I might be able to run gdb on the simulator, but 
> I'd like to avoid trying to set that up unless absolutely necessary. It 
> took me long enough to get kaffe running on it.

Out of curiosity: There is an alpha simulator for intel macines? Is it 
free software?

If you want access to real Alpha hardware, check out HP-Compaq's 
TestDrive project. You can sign up for online access to alpha-linux, 
alpha-osf (and so on ..) hardware.

dalibor topic

More information about the kaffe mailing list