Google Answers Logo
View Question
 
Q: How to build a debuggable JDK? ( Answered,   1 Comment )
Question  
Subject: How to build a debuggable JDK?
Category: Computers > Programming
Asked by: gerbil-ga
List Price: $25.00
Posted: 23 Jul 2002 12:49 PDT
Expires: 22 Aug 2002 12:49 PDT
Question ID: 44242
I need detailed instructions (for Linux) on how to build
the Java JDK v1.3.1 in such a way that the Java classes are
debuggable.  (I.e. they must be compiled with the -g flag).  The
instructions should include details on how one compiles and runs one's
code so that it uses these debuggable libraries.  I want to
be able to use the jdb debugger to step through a program, including
those parts of the program that belong to standard Java libraries such
as AWT.  I have attempted various "obvious" ways to do this, and all have
failed, therefore, I'm looking for detailed and specific instructions.
Answer  
Subject: Re: How to build a debuggable JDK?
Answered By: maniac-ga on 10 Aug 2002 14:39 PDT
 
Hello gerbil,

I will assume you want to work with J2SE - the links will reflect
that.
There are a few prerequisites that you need to address prior to
starting...
 - register at Sun's site and agree to the license conditions.
 - have one of the supported systems (e.g., Solaris, Windows 95-XP or
NT, Linux).
 - download the source for the Java Development Kit.

There is further information about this at...
  http://wwws.sun.com/software/java2/download.html

There are detailed instructions on the build process at...
  http://java.sun.com/j2se/1.4/scsl/build.html

Check the tool dependencies in the system specific files - in
particular, you may have to install a second copy of the C compiler to
satisfy the needs of the JDK build process. If you are doing a Linux
build, I would recommend the use of Open Motif and not Lesstif in
building the development kit. Open Motif is a much more complete
implementation of Motif. Ask for clarification if you need help on
this step.

At this point, set up the source and target directories and define
environment variables as described in the build instructions. In the
top level source directory there should be a file named "Makefile",
"makefile", or "GNUmakefile".  This file defines the rules to be
followed in general and should then run make on all subordinate
directories to build all the applications and libraries.

At this point, copy the original file to Makefile.orig (or something
similar) in case you make a mistake and need to start over. Since you
want to debug the generated code, you need to modify the commands used
to compile and link (or build the libraries) so that debugging
information is used (usually -g, but check the documentation to be
sure). Save the updated make file. You may want to do
  gnumake -p -n all DEV_ONLY=true (and other options)
to have gnumake print out the rules and commands to be executed w/o
actually performing the build. If that checks out OK, then run make
w/o the -n (and optionally -p) to build the development kit.

Run the demonstration programs to verify that the build was done w/
debugging enabled. You should be able to run jdb on the demo programs
to confirm it was done correctly. Then you should be able to develop
your tools and debug them (including the run time library) using the
JDK built in this way.

Do not hesitate to ask for clarification on these instructions. If you
run into a problem - describe the problem and I should be able to get
you past the hard spots. Good luck.
  --Maniac
Comments  
Subject: Re: How to build a debuggable JDK?
From: pondor-ga on 03 Aug 2002 23:19 PDT
 
not sure off hand to get jdb to work.
but i know you can definitely walk through the jdk code using Eclipse.
check out eclipse at http://www.eclipse.org
it's the best java IDE out there right now in my opinion.
and it's free.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy