"Process complete" on function call?

BlitzMax Forums/BlitzMax Programming/"Process complete" on function call?

Curtastic(Posted 2007) [#1]
This only happens when debug is on. (when debug is off it compiles and runs fine)

I tried to compile this old game I was making a year ago and the program crashes on the "ttilekind.setup(0)" line. The execution doesn't reach the inside of that function. It just says process complete.

Anyone know why this kind of thing happens?

Quick build is off.

Strict

Import "gui/gui.bmx"
Import "guykind.bmx"
Import "tilekind.bmx"

Global You:tguy
Global Battle:tbattle
Global BattleIn

Global Timer:ttimer
Global AllColor:Byte[]=[255:Byte,255:Byte,255:Byte]
Global DebugText:String

Include "tile.bmx"
Include "guy.bmx"
Include "battle.bmx"
Include "screen.bmx"
Include "item.bmx"



SeedRnd MilliSecs()
SetGraphicsDriver GLMax2DDriver()
Graphics 1024,768,0
SetMaskColor 255,0,255


tdir.setup(1)
tfont.make()

tentrance.setup()

ttilekind.areaset(1,2,3,4,5,6,7,8,9)

ttilekind.fontdraw=tfont.draw
ttilekind.setup(0)



tonyg(Posted 2007) [#2]
I have been re-running some older programs and noticed the same thing. Generally, there is an error in my program but, rather than display an error, the program just returns 'Process Complete' and finishes.
I've only really noticed it with includes though.
I'll see if I can find a small, recreatable example.


Curtastic(Posted 2007) [#3]
Well the first line of ttilekind.setup(0) is Print "hello" and it isn't printed. But everything runs fine when debug is off.

I've also tried changing Import to Include and the same thing happens.

The function is 3500 lines, mabye the debugger overflows? I'll test it when I have more time.


FlameDuck(Posted 2007) [#4]
Well the first line of ttilekind.setup(0) is Print "hello" and it isn't printed.
Which indicates that it is failing somewhere before that point.

Since there are potentially 1000's of lines of code before that, it doesn't really give us much to go on.


Curtastic(Posted 2007) [#5]

Since there are potentially 1000's of lines of code before that, it doesn't really give us much to go on.

Well I used the debugger to step through each line and it doesn't crash until that function call.


Dreamora(Posted 2007) [#6]
is the function a callback?


Gabriel(Posted 2007) [#7]
Bear in mind that if you do something dangerous like yutzing with pointers or misdeclaring external C stuff, then you may error unexpectedly on a line which appears to be very mundane and unlikely to error in itself. You may actually find ( in that instance ) that the error occurs a few lines ( or more 0 previously to where execution actually stops or breaks.

Could you post the function prototype and the line(s) which call it?


Curtastic(Posted 2007) [#8]
Thanks for the replies.

I am not doing any extern stuff. I don't know what a callback is. I'm not using any dangerous pointers. Unless stuff like this is dangerous: "Global Area:Byte[,][,][]"



None of the include files are executing anything except CreateList() comands as initializers to global fields.
I've cut the code down to this:
Strict
Import "gui/gui.bmx"
Import "guykind.bmx"
Import "tilekind.bmx"
Include "tile.bmx"
Include "guy.bmx"
Include "battle.bmx"
Include "screen.bmx"
Include "item.bmx"

Print "about to call ttilekind.setup(0)"
ttilekind.setup(0)
Each include also declares and initializes a few globals.

Here is the erroring function definition and its type fields:



Curtastic(Posted 2007) [#9]
I reproduced the bug, its in the bug forum. thanks all