Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does Debug Info do?

Status
Not open for further replies.

pctest

Programmer
Apr 12, 2004
89
US
If I build an exe with Debug Info checked, does it mean that I can see the source code of VCX, PRG, SCX with the trace window?

Is there a way to build an exe so that source code cannot be seen but the line # can be shown if an error occurs?


Thank you for any help.
 
Since you control what's displayed when there is an error, you really don't have to show any source code! (Using ON ERROR handling, the form's ERROR() method or in VFP 8.0+ using the TRY ... CATCH ... technique, you should be handling ALL VFP errors.)

Note: There are techniques for stripping the source code out of .VCXs and SCXs, but it does require a disciplined environment (including great backups) or you can get your self in trouble very quickly!

Rick
 
I'll cover the part that Rick left out. ;-)

Without source code, you'll never be able to get lineno() to return anything other than 0.

Dan
 
Hi Rick,

What happen if they run the exe in VFP IDE and have the trace window up? According to help, it sounds like that the source code will show up if the Debug Info is checked.

Thank you for your help.
 
The sourcecode will not show up in that case.
The debug option is ment for the developer during the testing of the application.

When the developer reached his/her final debugged version of the app he/she turns off the debug code option and compiles an exe for distribution.

Rob.
 
Case 1.

Debug Info is checked. Codings are not stripped from vcx and scx.

Case 2.

Debug Info is checked. Codings are stripped from vcx and scx.

Case 3.

Debug Info is unchecked. Codings are not stripped from vcx and scx.

Case 4.

Debug Info is unchecked. Codings are stripped from vcx and scx.

For each of the above cases,

1. Will source code be shown in trace window or can be retrieved by using functions such as message(), astackinfo() and others if there are any?

2. Can line # be shown using functions functions such as message(), astackinfo() and others if there are any?

The main thing I want to know is how to show the line # of the coding that is causing an error without source code.


Thank you for any help.




 
No sourcecode will be found on a system where the sourcecode doesn't reside.

If you send an exe with debug info to another computer and this computer doesn't have the sources already on it, it will not show any source information.

There are decompilers for (visual) foxpro such as:
refox
unfoxall
Those decompilers are able to regenerate a complete project including sources.

Rob.
 
Then what is the difference having an exe with debug info checked and one without debug info checked?

 
pctest

1.If you compiled your application into an executable with the debug info checked, when your application encouters an error the error message will return the line number where the error occured (if you code your error trapping as Rick suggested).
2. If you compile your executable with debug info unchecked, it will return line 0.

The debugger (ie Trace), should never pop-up in a compiled executable as it is a programmer's tool, not a user's tool. Once your executable is "bug-free", recompile it unchecked (it reduces the size of your executable).



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
One thing that hasn't been mentioned. If you uncheck Debug Info, the resulting EXE will be smaller because the debug information will not be included.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
I'm using on error, aerror(), and astackinfo() to return error message, program info, line # and source line content.

This is my understanding of all the replies:

1. If the exe is built with Debug Info "checked" AND the source code files (scx/sct, prg, frx, vcx/vct) exist in the machine, functions such as lineno(), message(1) and astackinfo() can be used to return the line # and source line content.

2. If the exe is built with Debug Info "unchecked" OR the source code files (scx/sct, prg, frx, vcx/vct) do not exist in the machine, functions such as lineno() and astackinfo() will return 0 as line # and message(1) and astackinfo() will return nothing as source line content.

Note: Whether the source code of scx/sct and vcx/vct are stripped or not won't affect #1 and #2. Will refox the exe affect #1 and #2?

3. The exe built with Debug Info "checked" is larger than the one built with Debug Info "unchecked".

4. The final version of an exe should be built with Debug Info "unchecked".


I still don't understand the sentence "If this is not checked, you cannot view program execution in the Trace window." in the VFP help for the Debug Info. From what I have tried using an exe which is built with Debug Info "unchecked", I can view program execution in the Trace window if the source code files exist in the machine.

This is from VFP help:
Debug Info
Specifies whether debugging information is included with the compiled file. If this is not checked, you cannot view program execution in the Trace window. Corresponds to the NODEBUG argument in the COMPILE command.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top