What was the most difficult debug you have ever done?

Questions by shanecage

Showing Answers 1 - 3 of 3 Answers

indrajit_p

  • Mar 23rd, 2008
 

Once there was a BIG fat bug inside my computer which had claws like ...

kidding.

I recently had to debug an intetioanlly bugged program in a debugging test where a function was being called recursively and the function was creating a string and passing it as an argument to the recursive call.

for creating the string, a static global variable( char[]) was being used.

which is a MAJOR bug, because, imangine there is only one recursion. Inside it the static global char[] was being overwritten. Then that call returned. But in the calling function the char * pointing to the argument it was passed has been corrupted by the recursive call.

the solution was to make it a local char[] in the recursive function, so each call would have it's own copy a pointer to which would be passed in any child call. Since it is a child call, the pointer would point to a valid location (the local copy of the char [] in it's parent call) till the end of this call and beyond.

this was not the MOST difficult, but definitely very tricky.

I would guess, the most difficult bugs are forgetting to free allocated memory in a very involved program where it is easy to overlook the error.

cheers!
I

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions