errors when using DisableDebbuger (help needed)

Everything else that doesn't fall into one of the other PB categories.
#NULL
Addict
Addict
Posts: 1504
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

errors when using DisableDebbuger (help needed)

Post by #NULL »

i have problems with some code of mine and i'm wondering if it's my fault :lol: . i get strange errors when using combinations of EnableDebugger/DisableDebugger.
for example i have "DisableDebugger" in the beginning of the code, and later on..

Code: Select all

IncludeFile ...
EnableDebugger
IncludeFile "units_process.pbi"
DisableDebugger
IncludeFile ...
in the included file i get an "array index out of bounds"

Code: Select all

            Debug u
            Debug ArraySize(unit())
            Debug unit(u)\go_i
            Debug unit(u)\go_k
            Debug ArraySize(mp(),1)
            Debug ArraySize(mp(),2)
            Debug ArraySize(mp(),3)
            mp(unit(u)\go_i, unit(u)\go_k, 2) = #farm01 ;          <--------- error here
where the debug output is the following

Code: Select all

11
200
59
48
299
299
3
so actually that error should not occur.
additionally, the error does not occur if i comment out the "DisableDebugger" in the line next to the include statement or if i don't use En/DisableDebugger at all. also the programm is running fine when compiled without debugger.


at another time i had the error "InitKeyboard() must be called before.." at ExamineKeyboard(), though InitKeyboard was called successfully. this also disappeared when changing the debugger statements.
i'm using no threads, but a little memory stuff and pokes here and there ( :? ).
tested with pb 430,431 and 440b3, all the same.
unfortunately i can't reproduce this in smaller snippets, so i have to upload the necessary files (482kb zip / >10.000 lines of code).

[link removed]

i merged the includefiles to one file, so that now the lines with Enable/DisableDebugger are:
6
7830
7403
and the error occurs at line 7535
if the program has started and you can see the screen, press F3 to load a saved state. within some second the error schould occur.

onestly, i don't expect somebody can help me with this, since i cannot assure it isn't simply a bug i produced by corrupting memory of pb-internals. on the other hand there's a chance that it's a pb bug, but i understand if fred/freak doesn't want to spend time on this eventuality.

any idea is appreciated.
Last edited by #NULL on Thu Sep 24, 2009 7:46 pm, edited 1 time in total.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: errors when using DisableDebbuger (help needed)

Post by Trond »

Image

It seems like the debugger doesn't pick up the allocation of multidimensional arrays after DisableDebugger, so it thinks the bounds is -1 for all dimensions.

Code: Select all

DisableDebugger
Global Dim Funkstyle(10, 10, 10)
Global Dim Chopin(1923)
EnableDebugger
CallDebugger
; Look in the variable viewer
In my opinion it's a bug, since single dimension arrays works.
#NULL
Addict
Addict
Posts: 1504
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: errors when using DisableDebbuger (help needed)

Post by #NULL »

thank you very much for having a look at it. that helps me a lot so i can continue with this program without having to use the debugger throughout all the code.

there is another little thing:
on 'CallDebugger' the IDE highlights and jumps to the last 'DisableDebugger' if there is such, instead of showing the actual position:

Code: Select all

DisableDebugger

CallDebugger
to find the 'CallDebugger' in big sources with many includes becomes difficult, because the error log neither says where the call was.
#NULL
Addict
Addict
Posts: 1504
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: errors when using DisableDebbuger (help needed)

Post by #NULL »

another example

Code: Select all

DisableDebugger
InitKeyboard()
EnableDebugger
ExamineKeyboard() ; error
i'm suprised this is how a debugger should work. anyway it probably won't change in the future and it's ok once you know what's going on (but can be weird if you don't).
Post Reply