Tracing execution

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.

Two kinds of trace files

You can generate two kinds of trace files:

Tracing execution using /pbdebug

You generate PBDebug trace information for an executable file by invoking the executable with a command-line switch.

StepsTo generate PBDebug trace information:

  1. 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.pbg, 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”.

NoteEnabling 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.