You can trace execution of an executable file built with PowerBuilder. By tracing execution, you can troubleshoot your application if it does not behave the same way when run as an executable file as it does when run in the PowerBuilder development environment. You can also use the trace output to profile your application: for example, you can see how many times particular scripts and functions are being executed.
You can generate two kinds of trace files:
With timing information You collect trace information by adding code to the scripts in the application or adding a window that lets users turn tracing on and off. PowerBuilder generates a binary trace file that you analyze using a comprehensive set of objects and functions or the Profiling tools. For more information about tracing and profiling, see “About tracing and profiling an application”.
Without timing information You collect information by running the application with the /pbdebug command-line switch. PowerBuilder generates a text file that logs the creation and destruction of objects and the execution of scripts and functions.
You generate PBDebug trace information for an executable file by invoking the executable with a command-line switch.
To generate PBDebug trace information:
Invoke the executable file using the /pbdebug command-line switch:
EXEFILE /pbdebug
As the application executes, PowerBuilder records the trace output in a file called exefile.dbg, which is a text file that you can read in any editor. For information about PBDebug tracing in the development environment, see “Generating a trace file without timing information”.
Enabling tracing If you are compiling machine code, you must enable tracing at compile time by selecting Trace Information in the Project painter Compile Options group. If you have not enabled tracing when you compile for machine code, no trace information is generated and the /pbdebug switch has no effect.
If you compile your project in Pcode, the compiler automatically adds the information needed to enable tracing.