PDA

View Full Version : Debugging GVMS



Ron
October 13th, 2002, 12:55 PM
yeah the [pld1] should be pld1, without the brackets. Let me know where the bug is in gvms.

Ron
October 13th, 2002, 12:55 PM
hmmm i think i already fixed this bug:

try this update :

http://www.girder.nl/temp/GVMS.zip

mflaster
October 13th, 2002, 12:55 PM
How does everyone debug GVMS's? I'm trying to write one for DVDSpy. I get a string of the form "____ ;w,h,x,y; _____". I'm trying to pick out w and h.

When I try my script, I get a GPF in GVMS.dll. Girder exits, and I don't know which line failed. I'm sure one of my string manipulation lines is wrong.

Can you comment out lines, or add an explicit return, so that I can easily see which line is bad? I guess I could cut the lines, and then paste them back later, but that seems ugly.

Here is my script, BTW:


string input;
string midterm;
int index;
int semi1;
int semi2;
int comma1;
int comma2;
int width;
int height;
input = [pld1];
input="1,1,1,1;768,768,1,1;1,1,1,1";
semi1 = substr(input,";",0);
semi2 = substr(input,";",semi1+1);
midterm = cut(input, semi1+1, semi2-semi1-1);
comma1 = substr(midterm,",",0);
width = strtoint(cut(midterm,0,comma1));
height = strtoint(cut(midterm,comma1+1,comma2-comma1));
width > 800;


Thanks!

Mike

mflaster
October 13th, 2002, 12:55 PM
OK, that's a good idea, I can add a line with an error as a "Stop Here" command. Then I can at least figure out which line makes the dll crash.

Mike

mflaster
October 13th, 2002, 12:55 PM
OK, I found the problem.

comma1 = substr(midterm,",",0);
...
height = strtoint(cut(midterm,comma1+1,comma2-comma1));

I forgot to define comma2!

So, girder sees:
midterm = "768,768,1,1";
comma1 = 3;
comma2 = 0;

strtoint(cut(midterm,4,-3)) causes girder to crash.

Mike

Francois
October 13th, 2002, 12:55 PM
mflaster,

When you execute a GVMS script, Girder will tell you if there is an error (There will be a message such as 'Parse Error on Line xx' at the bottom of the Girder window)... Finding the line which causes trouble can be tricky though, as the GVMS window is small and lines wrap around.

Creating errors in GVMS scripts can provide some rudimentary debuging solution as Girder will not execute the remainder of the script, and you can use F10 to view your all your variables right before the error was detected

BTW, I'm not sure you need the brackets around pld1...

Hope this helps.

Eiffel.