Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > return value in Eclipse debugger

Reply
Thread Tools

return value in Eclipse debugger

 
 
Larry
Guest
Posts: n/a
 
      08-13-2007
When using the Eclipse debugger, is there any way to see the value
that was just returned (or is about to be returned) from a method?

 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      08-13-2007
On Aug 13, 1:24 pm, Larry <(E-Mail Removed)> wrote:
> When using the Eclipse debugger, is there any way to see the value
> that was just returned (or is about to be returned) from a method?


If you set your breakpoint correctly, you should see all the variables
in scope showing up in the Variables subwindow at that breakpoint.
Stepping through the code can give you an idea of how the state
changes and one of those variables could very well be the one that the
method is returning. I hope this answers your question. Make sure you
are in the debug perspective in eclipse (Window->Open Perspective-
>Debug) or you'd not be able to see the Variables window.


-cheers,
Manish

 
Reply With Quote
 
 
 
 
Tzadik.Vanderhoof@gmail.com
Guest
Posts: n/a
 
      08-13-2007
On Aug 13, 5:42 pm, Manish Pandit <(E-Mail Removed)> wrote:
> On Aug 13, 1:24 pm,Larry<(E-Mail Removed)> wrote:
>
> > When using the Eclipse debugger, is there any way to see the value
> > that was just returned (or is about to be returned) from a method?

>
> If you set your breakpoint correctly, you should see all the variables
> in scope showing up in the Variables subwindow at that breakpoint.
> Stepping through the code can give you an idea of how the state
> changes and one of those variables could very well be the one that the
> method is returning. I hope this answers your question. Make sure you
> are in the debug perspective in eclipse (Window->Open Perspective-
>
> >Debug) or you'd not be able to see the Variables window.

>
> -cheers,
> Manish


No, I knew all that. But suppose there is a complex expression in the
"return" statement?

 
Reply With Quote
 
Manish Pandit
Guest
Posts: n/a
 
      08-14-2007
On Aug 13, 4:46 pm, (E-Mail Removed) wrote:
> On Aug 13, 5:42 pm, Manish Pandit <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On Aug 13, 1:24 pm,Larry<(E-Mail Removed)> wrote:

>
> > > When using the Eclipse debugger, is there any way to see the value
> > > that was just returned (or is about to be returned) from a method?

>
> > If you set your breakpoint correctly, you should see all the variables
> > in scope showing up in the Variables subwindow at that breakpoint.
> > Stepping through the code can give you an idea of how the state
> > changes and one of those variables could very well be the one that the
> > method is returning. I hope this answers your question. Make sure you
> > are in the debug perspective in eclipse (Window->Open Perspective-

>
> > >Debug) or you'd not be able to see the Variables window.

>
> > -cheers,
> > Manish

>
> No, I knew all that. But suppose there is a complex expression in the
> "return" statement?- Hide quoted text -
>
> - Show quoted text -


Maybe I did not get your question right, but you can always assign the
return value to a variable that can be watched via debug.

Assuming you mean a complex expression like :

return Math.sin(toRadians(x))*x+y^x%2;

can be replaced with :
double d = Math.sin(toRadians(x))*x+y^x%2;
return d;

-cheers,
Manish

 
Reply With Quote
 
Ben Phillips
Guest
Posts: n/a
 
      08-14-2007
Manish Pandit wrote:
> double d = Math.sin(toRadians(x))*x+y^x%2;
> return d;


Wouldn't that be

double d = Math.sin(toRadians(x))*x+y**x%2;
return d;

?



(One does not ordinarily use xor when working with doubles.)
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      08-14-2007
Ben Phillips wrote:
> Manish Pandit wrote:
>> double d = Math.sin(toRadians(x))*x+y^x%2;
>> return d;

>
> Wouldn't that be
>
> double d = Math.sin(toRadians(x))*x+y**x%2;
> return d;
>
> ?
>
>
>
> (One does not ordinarily use xor when working with doubles.)


No, because "**" is not Java.

--
Lew
 
Reply With Quote
 
Ben Phillips
Guest
Posts: n/a
 
      08-15-2007
Lew wrote:
> Ben Phillips wrote:
>
>> Manish Pandit wrote:
>>
>>> double d = Math.sin(toRadians(x))*x+y^x%2;
>>> return d;

>>
>>
>> Wouldn't that be
>>
>> double d = Math.sin(toRadians(x))*x+y**x%2;
>> return d;
>>
>> ?
>>
>>
>>
>> (One does not ordinarily use xor when working with doubles.)

>
> No, because "**" is not Java.


It was a joking reference to the recent Java 7 discussion where several
people suggested adding it for exponentiation. For now of course you'd
have to use Math.pow()...
 
Reply With Quote
 
Larry
Guest
Posts: n/a
 
      08-15-2007
On Aug 14, 3:14 pm, Manish Pandit <(E-Mail Removed)> wrote:
> On Aug 13, 4:46 pm, (E-Mail Removed) wrote:
>
>
>
> > On Aug 13, 5:42 pm, Manish Pandit <(E-Mail Removed)> wrote:

>
> > > On Aug 13, 1:24 pm,Larry<(E-Mail Removed)> wrote:

>
> > > > When using the Eclipse debugger, is there any way to see the value
> > > > that was just returned (or is about to be returned) from a method?

>
> > > If you set your breakpoint correctly, you should see all the variables
> > > in scope showing up in the Variables subwindow at that breakpoint.
> > > Stepping through the code can give you an idea of how the state
> > > changes and one of those variables could very well be the one that the
> > > method is returning. I hope this answers your question. Make sure you
> > > are in the debug perspective in eclipse (Window->Open Perspective-

>
> > > >Debug) or you'd not be able to see the Variables window.

>
> > > -cheers,
> > > Manish

>
> > No, I knew all that. But suppose there is a complex expression in the
> > "return" statement?- Hide quoted text -

>
> > - Show quoted text -

>
> Maybe I did not get your question right, but you can always assign the
> return value to a variable that can be watched via debug.
>
> Assuming you mean a complex expression like :
>
> return Math.sin(toRadians(x))*x+y^x%2;
>
> can be replaced with :
> double d = Math.sin(toRadians(x))*x+y^x%2;
> return d;
>
> -cheers,
> Manish


I know... but I was hoping the debugger would have a way to look at
the return value without having to go in and change the code.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
eclipse debugger return from "stepped into" function monkeyboy Java 2 11-30-2007 09:43 PM
printing all commands' return value in debugger yary Perl Misc 3 02-22-2007 03:05 PM
Need Help getting a debugger going for IE - any free debugger aflat362 Javascript 7 12-07-2006 10:51 PM
Neither IE-Debugger or Mozilla/Venkman debugger can step through dynamically added code? Robert Oschler Javascript 1 09-05-2005 07:17 AM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM



Advertisments