Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DEBUG and line numbers
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00823284
Message ID:
00823292
Vues:
17
Check out TIP OF THE DAY: Losing Debuginfo without lineno in errors Thread #451117 Message #451117

>For a long time DEBUG on or off has been overlooked in my development. Upon learning that DEBUG increased the size of the exe and left readable code in the SCX files, I began to investigate. I found that it reduced the size of my exe from 24MG to 19MG which was great. However, I think I've lost my ability to know the line number in an error. Here's the code I used to test:
>
>LPARAMETERS lcInput
>CLOSE ALL
>
>LOCAL lcMsg
>lcMsg = ""
>
>IF PARA() < 1
>	lcInput = "[no parameter passed]"
>ENDIF
>
>ON ERROR DO error_check WITH ERROR(), MESSAGE(), MESSAGE(1), PROGRAM(), LINENO()
>SET PROC TO testPrg
>
>lnTest = 4 + "5"  &&THE ERROR should be created here
>
>lcMsg = "The passed parameter is: " + lcInput + CHR(13)
>lcMsg = lcMsg + "Version with Debug"
>MESSAGEBOX(lcMsg)
>
>CLEAR ALL
>CLOSE ALL
>
>FUNCTION error_check
>	LPARAMETER mnum, mmsg, mcode,mprg,mlineno
>	LOCAL lcMsgErr
>	lcMsgErr = ""
>	
>	lcMsgErr = "Error Number: " 	
>	lcMsgErr = lcMsgErr 	+ ALLTRIM(STR(mnum)) + CHR(13)
>	lcMsgErr = lcMsgErr 	+ "Message: "
>	lcMsgErr = lcMsgErr 	+ ALLTRIM(mmsg)	 + CHR(13)
>	lcMsgErr = lcMsgErr 	+ "Code: "
>	lcMsgErr = lcMsgErr 	+ ALLTRIM(mcode)	 + CHR(13)
>	lcMsgErr = lcMsgErr 	+ "Function: "
>	lcMsgErr = lcMsgErr 	+ ALLTRIM(mprg)	 + CHR(13)
>	lcMsgErr = lcMsgErr 	+ "Line Number: "
>	lcMsgErr = lcMsgErr 	+ ALLTRIM(STR(mlineno))
>	
>	MESSAGEBOX(lcMsgErr)
>ENDFUNC
>
>Then I compiled to versions of the exe one with DEBUG and one with NO DEBUG option set from project info.
>
>When I run DEBUG ON I get line number 14 (appropriate).
>When I run DEBUG OFF I get line number 0.
>
>I find it hard to believe that everyone includes DEBUG info just to get a line number. So is there a way around this problem? My general issue is, if I send out an program with no way to find what line an error occured on, how to I debug? Do you just use the other information such as the function name to find the problem (Note that CODE returned by MESSAGE(1) does not seem to be accurate).
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform