viewing local variables while debugging

T

TrevorBoydSmith

While debugging, How would you make sure that you can view the local
('auto' qualified) variables in your debugger's variable window?

I know of a couple cases where the local variables aren't available for
debug viewing:
-It seems to only let you see the local variable when you are on the
original static main that the thread was started in (Or to be more
general, instead of the main... lets just say the original method that
spun up the new thread)
-as soon as you leave the static main and go to an object's constructor
you can't see the local variables (or so it seems i haven't tested
throughly)

Debugger: Eclipse 3.2

In eclipse, when you can not view the local variables in the debug
variable window there is a message that states "local variables
unavailable" next to the current stack for the thread you are on.
 
W

wesley.hall

While debugging, How would you make sure that you can view the local
('auto' qualified) variables in your debugger's variable window?

I know of a couple cases where the local variables aren't available for
debug viewing:
-It seems to only let you see the local variable when you are on the
original static main that the thread was started in (Or to be more
general, instead of the main... lets just say the original method that
spun up the new thread)
-as soon as you leave the static main and go to an object's constructor
you can't see the local variables (or so it seems i haven't tested
throughly)

Debugger: Eclipse 3.2

In eclipse, when you can not view the local variables in the debug
variable window there is a message that states "local variables
unavailable" next to the current stack for the thread you are on.

Sounds like you are compiling without the debug information.

If you are compiling using javac then add a -g flag.

If you are compiling using ant then add debug="true" as an attribute to
your javac task call.

If you are using eclipse to compile then you are on your own. I avoid
Eclipse like the plague.
 
T

TrevorBoydSmith

Wesley,
Your instinct was correct. The correct debugging flags were not in
place. So when I did my debugging it did not have the debugging info
it needed to show the 'local variables' values.

The way I fixed it was to reset Eclipse. Then when I ran debugging
again I could see all the local variables without a hitch.

For those of you interested in wondering how Eclipse handles debugging
I did some research before I thought about just resetting Eclipse to
fix it:
-when you do the common 'run java application' it compiles the program
with default settings for running a java application
-when you do the common 'debug java application' it compiles
differently and hands you off to the debugging tools associated with
the Eclipse Java Dev Tools.
-Probably, when i did 'debug java application' the settings did not
switch and so the eclipse debugging tools did not get all the symbolic
debugging info that was needed.

-Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top