MaxIDE "program" menu question

BlitzMax Forums/BlitzMax Beginners Area/MaxIDE "program" menu question

Emmett(Posted 2008) [#1]
Is there a tutorial or some other instructions about "How To" get the:

MaxIDE: Program menu items:
Step (F9)
Step In (F10)
Step Out (F11)

to actually work?

I'm getting an error during compile and think that using Step, Step In, and Step Out would help me locate any error?

When the program halts on the error, the cursor lands at the bottom of the code on a blank line and the error alert window says:
Compile Error
Expecting expression but encountered "*"

I have looked at all the code where multiplication is used and everything looks ok to me. Course - I'm a beginner so what do I know anyway. ha

That's not the point of this "Topic" though. I want to know how to use the Step, Step In, and Step Out.

{EDIT} Here are "all" lines with the * in there.
If v <= threshold
	vx=(v/threshold)*1.0

If LR
	angle + (LR*steer*adjust(Abs(speed),steer_threshold, MAXSpd))

If UD = False
	speed * drift
ElseIf UD <> False And HAND = False
	speed = minspeed(maxspeed(speed+UD*accel,MINspd),MAXspd)

If HAND
	speed  * handbrake

xv = ((Cos(angle) * speed) - vector(0))/traction
yv = ((Sin(angle) * speed) - vector(1))/traction

Thanks


GfK(Posted 2008) [#2]
You need to turn Debug mode on, then use a DebugStop wherever you want to stop the program. You can then use the debugger.


Gabriel(Posted 2008) [#3]
And no, runtime debugging functions won't help you find a compile time error.


Brucey(Posted 2008) [#4]
Doesn't it give you more info than that? Like a a line-number etc ?

Like this :
Compiling:fullscreen_wx_test.bmx
Compile Error: Identifier 'c' not found
[/Users/brucey/Documents/programming/Blitz/BRM/fullscreen_wx_test.bmx;719;41]

where it gives the line number (719) and the character it thinks is the problem (41).


Emmett(Posted 2008) [#5]
@ Gabriel
Hmm, how do I locate compile time errors then?


Brucey(Posted 2008) [#6]
They should appear in the console output like my example above..


GfK(Posted 2008) [#7]
Your code has errors, which is why it won't compile.

If v <= threshold
	vx=(v/threshold)*1.0

If LR
	angle + (LR*steer*adjust(Abs(speed),steer_threshold, MAXSpd))

If UD = False
	speed * drift
ElseIf UD <> False And HAND = False
	speed = minspeed(maxspeed(speed+UD*accel,MINspd),MAXspd)

If HAND
	speed  * handbrake

xv = ((Cos(angle) * speed) - vector(0))/traction
yv = ((Sin(angle) * speed) - vector(1))/traction



Emmett(Posted 2008) [#8]
@ Brucey
This is what it gives me in the output window:
Building portfrompurebasic
Compiling:portfrompurebasic.bmx
Compile Error: Expecting expression but encountered '*'
[/BlitzMax/My Truck Program/portfrompurebasic.bmx;112;9]
Build Error: failed to compile /BlitzMax/My Truck Program/portfrompurebasic.bmx
Process complete

Problem: The program is 47 lines including blank lines.
Oh - looking closely at the bottom right of the MaxIDE where it says:
Line: nn Char: nn
I notice a lot of line don't count.
Great.


GfK(Posted 2008) [#9]
Did you read my reply?


Emmett(Posted 2008) [#10]
@GfK

Thanks for that. I assume the errors are lines in italics.

Maybe you could correct the errors?

{edit} Gone To Work, will respond any further this evening


Brucey(Posted 2008) [#11]
As GfK (and the compiler ;-) points out, your code has errors :

Example
speed * drift

is invalid...

Do you mean something like :
speed = speed * drift

or the shorthand version
speed :* drift



GfK(Posted 2008) [#12]
Well, you the correct syntax is as follows:
A = A + B

or you can use
A:+B

I can't really correct the lines that have commas in the expression because I don't know what you're trying to do there.


Brucey(Posted 2008) [#13]
As for the compiler placing the error at the bottom of the file, instead of the line the error is on.
Did you copy/paste the text into the IDE? If you did, you want to save and re-open the file, since from some editors, the line-endings are not converted properly after a paste.


Emmett(Posted 2008) [#14]
@ Brucey
As for the compiler placing the error at the bottom of the file, instead of the line the error is on.
Did you copy/paste the text into the IDE? If you did, you want to save and re-open the file, since from some editors, the line-endings are not converted properly after a paste.

A 6 foot tall THANK YOU for that information. That little paragraph is worth its character count in GOLD:*1000.
That solves a myrid of little questions/problems I have been having when bringing code in to study and modify from all over the forum here and the internet there.
Now the compiler places the cursor at the line where the error is: and I can battle learn my way through the problems.
This particular piece of code is some "vehicle physics" coded in a language called PureBasic.
If I get it working and it makes my vehicle do what I want it to do I will post the BlitzMax version somewhere so other beginners like me may learn from it.

A big thank you to ALL who responded to this topic question. THANK YOU.


Emmett(Posted 2008) [#15]
Ok, the code is compiling now.

@GfK
You need to turn Debug mode on, then use a DebugStop wherever you want to stop the program. You can then use the debugger.

1) Debug mode is on
2) DebugStop placed in the code at a random location

So, how am I supposed to "use the debugger"?


Brucey(Posted 2008) [#16]
Once it stops at the DebugStop, you can "Step In", "Step Over" or "Step Out"

In - Will dig down into a method or function, into another source file if it needs to. All the way down to the core modules if you aren't careful.

Over - Will process the current line, and step onto the next one, without following the code into a method or function.

Out - Will run the current block of code, and should (hopefully) stop at a level above. Your mileage may vary :-)


GfK(Posted 2008) [#17]
DebugStop placed in the code at a random location
You don't put it at a random location - you put it where you want to start using the debugger!


Emmett(Posted 2008) [#18]
@ GfK - random meaning where I think code needs to be looked at.

@ Brucey - I don't think my MaxIDE debugstop is working.
Using Mac OS 10.4.11, BlitzMax v 1.28, MaxIDE Application (PowerPC) Created: Friday, March 7, 2008 10:43 AM.
Loading and running one on the examples in the examples folder. (digesteroids.bmx), I placed the DebugStop as shown here.
Function ScreenPan(OffsetX:Float, OffsetY:Float)
DebugStop
	Local Width,Height,Depth,Hz
	Width=GraphicsWidth()
	Height=GraphicsHeight()
	Depth=GraphicsDepth()
	Hz=GraphicsHertz()
    glMatrixMode GL_PROJECTION
    glLoadIdentity
    glOrtho 0,Width,Height,0,-1,1
    glTranslatef OffsetX, OffsetY,0
    glMatrixMode GL_MODELVIEW
EndFunction
Program execution stops ok but:
Using F10 - Step In, the only thing that happens is a sort of "transparent screen" covers everything.
Using F11 - Step Out, shrinks all open windows to 1/4th size and puts them all into the top left corner of the computer screen "behind" the desktop picture.
Using F9 - Step, shrinks the MaxIDE to 1/4th size and shrinks the web browser to 1/4th size then the MaxIDE moves to the top right corner of my computer screen on top of the desktop picture and the web browser moves to the bottom left corner of my computer screen.

All of these actions seem to be of no value whatsoever.
Maybe you can show me where to put DebugStop in the Digesteroids.bmx example to make this debugging work.

BTW: What exactly is supposed to happen? I sort of remember a long time ago, in another programming language, pressing the button to make step proceed down the code would "HighLight" each relevant keyword or something like that. It was very useful.

Thanks


Brucey(Posted 2008) [#19]
You may prefer to click on the toolbar icons for stepping around using the IDE, as F9, F10 and F11 keys on Mac default to other things - system wise.
To modify their default system behaviour you will have to go into your system preferences and select Keyboard & Mouse, and then Keyboard Shortcuts... but... you'd be as well just using the toolbar instead :-)

Of course, it would be nice if the shortcuts in the IDE were configurable...


Emmett(Posted 2008) [#20]
Huh? toolbar icons?
Clicking on them causes no action.
Hovering "ToolTips" works but "Step" "Step In" "Step Out" icons all look ghosted to me.

What should the Program/Build Options be?
Right now I have Program/Build Options/Debug Build selected only.
Quick Build and Build GUI App are both off.

Thanks


Dreamora(Posted 2008) [#21]
that will not start debugging itself.

you must have a debugstop as the stepping etc will not start until you tell the debugger to do so.


Emmett(Posted 2008) [#22]
Well, I don't understand what happened but,
as discussed above no matter where placed DebugStop would not work in any of three .bmx files I tried it in.
Now, for some unknown reason, it is working 100% no matter where I put DebugStop (except for - above the word Strict).

Anyway, Thank you all for the assistance here. I learned a lot. Almost learned enough to get me to the 1st rung on the ladder. oO


JazzieB(Posted 2008) [#23]
You should also know that DebugStop will only work if you compile your program in debug mode. If you compile in release mode, this and all other debug related commands and error checking code are ignored/not compiled. This may explain why it wasn't working initially.


Dreamora(Posted 2008) [#24]
That would be nice if it didn't work.
actually its worse: a debugstop in release mode when executed from the IDE means stop but without showing anything.

I've started to put debugstop in
?debug
debugstop
?

blocks


Mark Tiffany(Posted 2008) [#25]
???

If that's the case, I'd call that a bug!