On 22 May 2001, at 15:50, Ben Speakmon wrote:
> 1) Sun doesn't compile the Java core classes with -g, which JPDA needs
> to see breakpoints. 2) You can't compile the Java sources in src.jar
> and get rt.jar, since there are all kinds of native classes and code
> to deal with the low-level stuff. 
> Of course, I would *love* to be proved wrong here, but until then this
> is another great reason to support Classpath. :)

I can't actually _prove_ you wrong, since I'm not about to attach a 
10MB file to this message, but I can tell you that I have compiled 
the contents of src.jar and recreated rt.jar with -g.  Well, that's 
not strictly true.  I have compiled some of src.jar, some of the more 
critical components like java.lang.*, java.util.*, java.io.*, 
java.text.*, and java.net.*.  Not everything compiles, and I can't 
recall why.  It's been a while since I did this.  I do know that Java 
packages specific to the Sun implmentation of the Java runtime are 
left out of src.jar.  Specifically, sun.* is not in src.jar, and 
contains things like all the handlers for URL protocols.  I also know 
that I am compiling code that has native implementations, but this is 
not a problem.  The methods that are native will recompile since only 
the interface is in Java, and the actual implementations are still in 
the DLLs or shared objects.

Without laboriously sitting down and actually testing what I write, 
here is a quick overview of adding debugging info to rt.jar.

Extract rt.jar to a directory somewhere.

Delete the packages that you wish to recompile.  I would suggest the 
ones above, plus any that you wish to try.  No real guarentees on 
what will and will not compile.  Try your luck.

Extract src.jar to a directory somewhere.

Compile the packages that you deleted from the rt.jar extraction.  
Use the extracted src.jar as your source path.  I found that making 
an Ant build.xml file here helped condsiderably.  Use the extracted 
rt.jar as your destination.  Put the extracted rt.jar on the 
classpath of you compilation.  Increase the initial and maximum 
heapsize values of your javac process; it's about to do a lot of 
work.  I would suggest 256MB and 512MB.  Compiling more packages will 
need more memory.  Don't forget to include the -g flag.

Jar up the compiliation destination directory into new_rt.jar.

You now have two options for your new_rt.jar.  You can replace the 
existing rt.jar with it, taking care to keep the old rt.jar.  You can 
specify the new_rt.jar, plus any i18n.jar file you care for, on the 
boot class path of your new Java processes.

Specify the directory root of the extracted src.jar, and you can use 
JDEbug, or what ever debugger you care to name, and step into the 
Java API.

-----------------+---------------------------------------------------
Craig McGeachie  | #include <cheesy_tag.h>
+61 (410) 774902 | while (!inebriated) c2h5oh = (++bottle)->contents;
-----------------+---------------------------------------------------

Reply via email to