|
Re: Recursive Debugging [message #202887 is a reply to message #202859] |
Mon, 02 April 2007 21:01 |
Eclipse User |
|
|
|
Originally posted by: wharley.bea.com
"Ben" <bsisson@simventions.com> wrote in message
news:0f744b471378ef66cc2d101e99b6ffb2$1@www.eclipse.org...
>I have some code in a project that has a recursive method. The method
>calls itself repetitively until it processes all the data and then backs
>out of each call of the method. When I go to debug the class that has this
>recursive method (the call is within the class) I get a "Source not found"
>message. If I comment out the recursive call within the class then I don't
>get this message. The method has to be recursive, does anyone have any
>recommendations?
I'm assuming you're talking about a java project, but if not, please be
specific.
The Eclipse java debugger certainly supports debugging recursive calls; this
is a very ordinary and common thing to do. So there must be something funky
about the precise steps you're taking, or the particular code you're working
on.
Can you reproduce this in a different circumstance? For instance, you might
create a new workspace and try writing a very simple recursive routine and
seeing if you can build and debug it. If you can, then start trying to
narrow down the differences.
Here's an example (for what it's worth, I had no problems debugging into
this):
public class Test {
public static final int MAX_DEPTH = 6;
public static void main(String[] args) {
System.out.println("Max depth is " + getMaxDepth(0));
}
static int getMaxDepth(int soFar) {
return (soFar >= MAX_DEPTH) ? soFar : getMaxDepth(soFar + 1);
}
}
|
|
|
Re: Recursive Debugging [message #202895 is a reply to message #202859] |
Mon, 02 April 2007 22:43 |
Eclipse User |
|
|
|
Originally posted by: dtoland.email.uophx.edu
My guess, from the behavior you are describing, is that the recursion is
taking place before the breakpoint you are setting, and some exception, such as an
out of memory error, is taking place before you reach your breakpoint. That
exception may be caught in some method outside your source code, resulting in
the "source not found".
If this is the case, you should be able to put a breakpoint in the first statement of
your recursive method. If that succeeds, make sure the exit condition for your
recursion will be met. Either the exit condition must be a caught exception in the
recursive method, or must be tested for before the recursive call within the method.
--
Dave Toland
dave.toland@verizon.net
"Ben" <bsisson@simventions.com> wrote in message news:0f744b471378ef66cc2d101e99b6ffb2$1@www.eclipse.org...
|I have some code in a project that has a recursive method. The method
| calls itself repetitively until it processes all the data and then backs
| out of each call of the method. When I go to debug the class that has
| this recursive method (the call is within the class) I get a "Source not
| found" message. If I comment out the recursive call within the class then
| I don't get this message. The method has to be recursive, does anyone
| have any recommendations?
|
| Thanks,
| Ben
|
|
|
|
Powered by
FUDForum. Page generated in 0.07778 seconds