Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

return value in Eclipse debugger

Thread view: 
Larry - 13 Aug 2007 21:24 GMT
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?
Manish Pandit - 13 Aug 2007 22:42 GMT
> 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
Tzadik.Vanderhoof@gmail.com - 14 Aug 2007 00:46 GMT
> > 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?
[quoted text clipped - 10 lines]
> -cheers,
> Manish

No, I knew all that.  But suppose there is a complex expression in the
"return" statement?
Manish Pandit - 14 Aug 2007 20:14 GMT
On Aug 13, 4:46 pm, Tzadik.Vanderh...@gmail.com 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?
[quoted text clipped - 15 lines]
>
> - 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
Ben Phillips - 14 Aug 2007 21:17 GMT
>   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.)
Lew - 14 Aug 2007 22:32 GMT
>>   double d = Math.sin(toRadians(x))*x+y^x%2;
>>   return d;
[quoted text clipped - 9 lines]
>
> (One does not ordinarily use xor when working with doubles.)

No, because "**" is not Java.

Signature

Lew

Ben Phillips - 15 Aug 2007 03:37 GMT
>>>   double d = Math.sin(toRadians(x))*x+y^x%2;
>>>   return d;
[quoted text clipped - 11 lines]
>
> 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()...
Larry - 15 Aug 2007 14:51 GMT
> On Aug 13, 4:46 pm, Tzadik.Vanderh...@gmail.com wrote:
>
[quoted text clipped - 31 lines]
> -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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.