Sun, 1st Nov 2015, 01:38 A hint about debugging.

I just responded to a student who is having a tough time finding a bug,
and he says he is setting breakpoints, and wanted to know if I have any

I sent him the following response:

> It sounds like you have been doing *almost* everything I would hope you to do.
> What I suggest is the following:
> 1. Draw the figure consisting of the two linked lists consisting of the
> original nodes that your program is about to work on.  You will need to
> set the breakpoints appropriately to find out why the final version of
> those two lists are not correct.
> Write down the actual addresses inside the locations (in addition to
> showing the pointers).
> 2. Set a breakpoint, and go.  What do you expect the three linked lists
> will look like when you reach the breakpoint. Examine all the locations
> to see if that is what is there. If yes, set the next breakpoint.  If no,
> back up where you set the breakpoint and repeat.
> The idea is to try to isolate and thereby identify the instruction that is
> not doing what you think it is doing.  You may have to single step to find
> this instruction.  But if the result is not what you think it should be,
> there is an instruction you think is doing one thing but it is really doing
> something else.

> By the way, breakpoints may not be enough.  You may have to "single step +
> examine" to find the misbehaving instruction.

Good luck.

Yale Patt