viewing local variables while debugging

Discussion in 'Java' started by TrevorBoydSmith@gmail.com, Dec 12, 2006.

  1. Guest

    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.
     
    , Dec 12, 2006
    #1
    1. Advertising

  2. Guest

    wrote:
    > 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.
     
    , Dec 12, 2006
    #2
    1. Advertising

  3. Guest

    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

    wrote:
    > wrote:
    > > 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.
     
    , Dec 12, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ^CrazyCoder^
    Replies:
    3
    Views:
    7,328
    Terrence Benade
    Sep 15, 2003
  2. Selden McCabe
    Replies:
    0
    Views:
    340
    Selden McCabe
    May 13, 2005
  3. Ronald
    Replies:
    1
    Views:
    3,347
    Sudsy
    Nov 18, 2003
  4. Halldor Isak Gylfason

    Debugging core java sdk classes - local variables

    Halldor Isak Gylfason, Dec 22, 2003, in forum: Java
    Replies:
    0
    Views:
    383
    Halldor Isak Gylfason
    Dec 22, 2003
  5. Sullivan WxPyQtKinter
    Replies:
    10
    Views:
    706
    Antoon Pardon
    Nov 8, 2007
Loading...

Share This Page