Debugging core classes [message #244358] |
Mon, 24 May 2004 12:42  |
Eclipse User |
|
|
|
Originally posted by: sz1055.hotmail.com
Hi Guys
Im using the eclipse version 2.1.3.(im little bit new with eclipse!)
Im trying to look at inside java core classes when debugging
(Inetaddress.getbyname()) to have an idea whats going on there! What i
have done is ;
- I downloaded Java SDK from sun
- I add it to eclipse in windows>preferences>java>installed JREs and set
it as active JRE.
- when i try to debug in to the method Inetaddress.getbyname(), eclipse
opens the source file Inetaddress.java and finds the method getbyname.
- So far everything is ok! but somehow i can not see the values of local
variables in this method in watch window!!! in debug window, i get the
message;
line:440 [local variables unavaliable]
if anyone has an idea how to see these local variable values when
debugging, id appreciate an answer!
Thanks a lot!
|
|
|
|
Re: Debugging core classes [message #244642 is a reply to message #244392] |
Tue, 25 May 2004 02:25   |
Eclipse User |
|
|
|
Originally posted by: m.fesich.saen-options.com
And the long answer is that you can generate a java version of the JDK
package with debug information yourself - although it takes some effort ;-).
(1) The bottom line is:
* get the JDK source (i did it with version 1.4.1)
* get the original rt.jar for the same version
* unzip the rt.jar into a directory OriginalRT
* unzip the JDK source into a directory RTSource
(2) Now the fun starts:
* delete all files from RTSource that are NOT contained in OriginalRT
(apparently old classes, they do not compile ...)
* compile the rest of the java files in RTSource with the "generate debug
information" flag (and the RTSource directory, dt.jar, tools.jar and
htmlconverter.jar in the classpath)
* copy all compiled classes that are in OriginalRT but not in RTSource into
the corresponding place in RTSource
* jar RTSource into a file rt_debug.jar
* use rt_debug.jar instead of rt.jar in your classpath -> et voila!
I found a cygwin script on the web doing all the things described in (2),
here it is in case you want to use it (thanks to the original creator of the
script!):
START OF SCRIPT
#!/bin/sh
# Change these four paths = as required
# Base dir
JAVA_HOME=/cygdrive/c/j2sdk1.4.1
# Where src.zip was extracted
JAVA_SOURCE=/cygdrive/c/JavaSourceCompile/RTSource
# Where rt.jar was extracted
RT_CLASSES=/cygdrive/c/JavaSourceCompile/OriginalRT
# Where to put the compiled classes
OUT_DIR=/cygdrive/c/JavaSourceCompile/RTSource
# These are the required options for javac, do not change
OPTIONS="-g -nowarn -sourcepath . -d `cygpath -wp $OUT_DIR` -source
1.4 -target 1.4"
SEP=";"
CLASSPATH=$JAVA_HOME/lib/dt.jar$SEP$JAVA_HOME/lib/tools.jar$ SEP$JAVA_HOME/li
b/htmlconverter.jar
JAVAC_HOME=$JAVA_HOME/bin
# Loop through each java file in the source dir
cd $JAVA_SOURCE
#${JAVAC_HOME}/javac -classpath `cygpath -wp $CLASSPATH` $OPTIONS
`cygpath -wp ./com/sun/corba/se/ActivationIDL/ActivatorHelper.java`
#/usr/bin/find -name "*.java" | while read JAVA;
#do
# echo $JAVA
# Is this file part of rt.jar, or is it an obsolete source file
# eg = com/sun/corba/se/internal/Interceptors/ThreadCurrentStack.ja va
# CLASS=`echo $JAVA | sed "s/\.java/\.class/g"`
# echo ${RT_CLASSES}/${CLASS}
# if [ -e ${RT_CLASSES}/${CLASS} ];
# then
# # Has this file already been compiled
# if [ -e ${OUT_DIR}/${CLASS} ];
# then
# echo Already compiled.
# else
# ${JAVAC_HOME}/javac -classpath `cygpath -wp $CLASSPATH` $OPTIONS
`cygpath -wp $JAVA`
# fi
# else
# echo Obsolete source file.
# fi
#done
# Now check for any files that are in rt.jar but not src.zip
cd $RT_CLASSES
/usr/bin/find . -type f | while read CLASS;
do
if [ ! -f ${OUT_DIR}/${CLASS} ]; then
echo Not found : $CLASS
# Uncomment this once the script has been run and all classes have
successfully compiled
# cp --parents $CLASS $OUT_DIR
fi
done
END OF SCRIPT
That runs for a while, because it's quite some amount of classes - but it
works!
Hope that helps and good luck,
Matthias
"Eric Rizzo" <eclipse@rizzoweb.com> wrote in message
news:c8tb3l$3hs$2@eclipse.org...
> Servet wrote:
>
> > Hi Guys
> > Im using the eclipse version 2.1.3.(im little bit new with eclipse!)
> > Im trying to look at inside java core classes when debugging
> [snip]
>
> > line:440 [local variables unavaliable]
> >
> > if anyone has an idea how to see these local variable values when
> > debugging, id appreciate an answer!
>
> This is a FAQ around here. Try searching previous messages for a
> complete explanation.
> The short answer is that Sun does not include debugging information in
> the compiled classes for the core JDK packages.
>
> HTH,
> Eric
|
|
|
|
|
Re: Debugging core classes [message #248012 is a reply to message #245454] |
Tue, 01 June 2004 12:48  |
Eclipse User |
|
|
|
Originally posted by: sz1055.hotmail.com
Thanks a lot!! it worked!! now i can debug core classes!
mF wrote:
> Did it ... there already was a similar description in the debugging faq, but
> I added the script and the details.
> "Eric Rizzo" <eclipse@rizzoweb.com> wrote in message
> news:c8vls8$hn0$2@eclipse.org...
> > mF wrote:
> >
> > > And the long answer is that you can generate a java version of the JDK
> > > package with debug information yourself - although it takes some effort
> ;-).
> > >
> > > (1) The bottom line is:
> > [snip]
> > > Hope that helps and good luck,
> > > Matthias
> >
> > Would you care to post this comprehensive answer to the Wiki at
> > http://www.eclipse-wiki.info/ ?
> >
> >
|
|
|
Powered by
FUDForum. Page generated in 0.05943 seconds