[Lazarus] i'm looking for tips on debugging deep nested code with recursive functions

ik idokan at gmail.com
Wed Feb 15 16:17:15 CET 2012


On Wed, Feb 15, 2012 at 16:45, Martin <lazarus at mfriebe.de> wrote:
> On 15/02/2012 13:01, ik wrote:
>>
>> On Wed, Feb 15, 2012 at 14:19, ik<idokan at gmail.com>  wrote:
>>>
>>> On Wed, Feb 15, 2012 at 13:59, Everton Vieira<tonvieira at gmail.com>
>>>  wrote:
>>>>
>>>> Em 15/02/2012, às 09:49, ik escreveu:
>>>>
>>>>> Hello,
>>>>>
>>>>> I have a code with a lot of loops and recursive calls.
>>>>> Somewhere at the code, at some point, I think I have an Off By One or
>>>>> something similar that happens that break my code.
>>>>> The question is, how would you suggest to compile such complicated
>>>>> calls to figure out where the problem/s exists ?
>>>>
>>>> For debug that, would be nice to make some log of the behavior of the
>>>> app, that i`ve been thinking this days, but in which doesn't get nothing at
>>>> far as usable. Well you can make a lot of debugln to monitor the behavior of
>>>> it to try to see where is the problem. But i`m freak sure is hard work.
>>>
>>> I have a lot of prints on the screen (stderr even). but I just can't
>>> figure out what am I missing. I know where it happens, and on what
>>> level, but not why.
>>
>> Simple debug conditions works. found the reason, but not what cause it :)
>
>
> If you know the variable, and where it first exists:
>
> trunk has watchpoints, so you can stop when the variable changes.
>
> Note depending on cpu, the number of watchpoints (and the possible size of
> value) vary.  he error is only given when trying to run/step.

Thanks. I finally figure out what happens. and It was off by 2 :)
I had an inc(Index, 2); without checking first if it required, and 99%
of the time it does, but 1% it does not, and that's the reason for the
bug.
I can dig now a hole to China :)

>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list