views:

66

answers:

3

Hey guys&dolls

Ok..

I hope i can get this across without sounding like an idiot.

Using Eclipse, when debugging is it possible to change the value of variables during runtime of a project for testing purposes.

For example, say I have a method that returns the number 5 but for testing purposes i want to output 10 instead. This isnt the problem I'm facing its a little more complex but its just to get my idea across.

Any questions please leave a comment and i'll do my best tp add to this if need be.

Thanks.

+3  A: 

You can access variables through the Variables view. There you can right click on any variable and select "Change value ...".


Resources :

Colin Hebert
excellent stuff!
Uncle
+3  A: 
aioobe
+2  A: 

... and you can do much, much more:-) Just to give you and idea.
You may change the code during debug which is hot swapped and is effectively changed (recompiled) in given debug session. You may run given method run (e.g. after catching breakpoint) few times without rerunning debug -> use drop to frame feature on method stack.

Gadolin
this sounds interesting..could you explain what drop to frame is?
Uncle
It reruns given method on the stack. So it is invoked as at the first time with same parameters. see it here http://www.vasanth.in/2004/06/08/eclipse-tip-rewind-during-debugging/
Gadolin