[Gambas-user] Weird errors using debug

richard terry rterry at ...1946...
Sat Sep 20 06:50:40 CEST 2008


I think i need a mini-tutorial on how to user debug.

I assumed that the statement could be used in place of PRINT to print out 
messages in the console, but after 8-10 hours of wondering why my program  
was suddenly doing bizaare things, I eventually tracked it down to my use of 
putting in lines line

Debug "Starting to save....."

.... my code here

Debug "Finished saving"

What happened was really really bizarre. The program flow became altered, If 
the code within one suboutine had called on another subroutine, the program 
flow in the orginal routine continued without waiting for the execution of 
the subroutine, and even weider, the contents of some variables  I'd been 
using in the calling routine where partially internally overwritten by code 
statements from within my gambas program itself and in part from some of the 
console output!, not necessarily from the routine I was in.

Almost like memory addresses somehow were getting mixed up.

I was doing some complex parsing of html, substituting src= statements 
contianing temporary file names, for the database pk of the image I was 
saving in the html.After 10 frustrating hours, I did a global substitution of 
all my Debug with PRINT, and hey presto - the problem disappeared.

I note this from the documentation: 

Prints expressions to the standard error output, only if your program is 
compiled with debugging informations. 

Maybe my program is somehow not containing 'debugging information(s) -wrong 
spelling by the way, perhaps someone can explain to me how to use debug.

Regards

Richard




More information about the User mailing list