I am having a debugging test, as part of an interview.. I thought if any one can help with the approach, when I am faced with a large code base and have to find bugs inside that within an hour or two.This is going to be Core java based app (I guess) on Eclipse 3.2+
Not a complete answer, but you can brush up techniques for remote debugging as well
It can help for finding bugs when you don't have a full Eclipse project, but ony an external application (with its sources) that crashes.
I hate to say this, but if you don't know how to approach this problem already, there is a good chance that you do not have the level of experience / expertise that they need. Trying to learn between now and the interview is probably not going to help a great deal.
On the positive side, you've already reached the detailed interviewing stage, and that is a good sign. And despite your concerns, you may well already meet their minimum level of experience / skills in debugging ... or your other attributes may sufficient to get you the job.
The answer the interviewer is likely watching for is "what is your overall strategy?" You better have an approach that makes sense to him or her. This is the overall approach I recommend for debugging (regardless of if it's for a test):
- Recreate the bug, documenting additional findings as you go along.
- Bonus points for writing a unit test to automatically recreate the bug.
- Categorize the bug - is it a crash, or incorrect behavior? Your analysis will likely be different.
- Crank up the debug/logging level as detailed as it will go.
- Look for log files/artifacts that the app may have generated to help pinpoint the fault.
- Do an initial skim through the likely code, looking for anything suspicious.
- Take a divide and conquer approach. Use a rough binary search to identify where the code works, and where it fails. Maybe use breakpoints or print statements.
- After you find it, add unit test cases to narrow it down explicitly.
- Add documentation to explain what you found, comments in the unit test code would be great.
- Fix the bug. Comments regarding the fix would also be good.
- TEST YOUR FIX. Test it in a logical, methodical manner (boundary conditions, etc.)
- When done, ask the interviewer to do a code review of your bug fix solution.
Let me know how it goes. Sounds difficult. I guess I would say make sure you know how to get a stacktrace off the top of your head.