SunDebug


10.4

SunDebug is a GUI debugger developed and implemented using new PL/B internal routines, interfaces, and program metadata. This GUI debugger executes as a standalone PL/B program or as an integrated debugger within the Sunbelt IDE. SunDebug gives fresh and enhanced debugging operations to provide the highest level of debugging for PL/B developers.

 

Note:
Both the Sundebug utility and the PL/B program being debugged must be executed using a 10.4 or newer runtime version. Also, the PL/B program to be debugged must be compiled by the 10.4 or newer compiler version using the compiler 'ws=' option. The 'ws' compiler option causes program metadata to be output to a '.plbm' file. The '.plbm' metadata file is only accessed and used by the Sundebug utility.

Basic Operations:

 

SunDebug requires that a PL/B metadata file (program.plbm) must be generated by the 'plbcmp' compiler. By using the SunIDE, a PL/B project can be created and program compilations executed that provide the PL/B program metadata that is used when SunDebug is invoked.

 

  1. In the SunIDE, perform these actions to enable the SunDebug debugger by the IDE.

  2.  

    1. Select the menu 'Tools\Options' item which brings up the IDE configuration dialog.

    2. Expand the 'Project' treeview selections and click on the 'Debug' selection.

    3. In the Debugger radio button group, select either the 'Integrated' or the 'SunDebug' radio button. The SunDebug is now configured for the IDE debugging after clicking 'Ok'.

 

After the SunDebug configuration is setup,compile a program using SunIDE. Selection of the 'Debug' icon in the IDE toolbar starts a debugging session using SunDebug.

 

  1. Because the SunDebug is a GUI program, it can only be executed by either the PLBWIN or PLBNET runtimes. However, SunDebug can connect to any PL/B runtime including PLB (Linux), Plbserve runtimes, Plbwebsrv runtimes, Plbwin and Plbnet that is started with debugging enabled.

    For the SunDebug utility, the following options are described for the PL/B runtimes (Plbwin and Plbnet), the Plbcmp compiler, and SunDebug.

    PL/B Runtimes Plbwin and Plbnet

    1. The PL/B runtime executing the user PL/B program does not use nor require access to the program metadata found in a file as 'programname.plbm'. The 'programname.plbm' file is only loaded and used by Sundebug when debugging a PL/B program. The '.plbm' metadata file is created by compiling the PL/B program while using the 'WS=1' option.

    2. The PL/B runtimes enable and execute in a debug mode by using runtime options described as follows:

    3. -dg

      Debug and Go. This runtime option causes the PL/B program to start executing in a debug mode. The PL/B program execution starts as is normally expected by the application. Since there is no ip address specified, the PL/B runtime uses the ip address of 127.0.0.1 as the default with a default port number of 52201.

      -dg [ipaddress[:port]]

      Debug and Go. This runtime option invokes the debug behavior as described for '-dg' except the user specified ip address and optional port number are explicitly defined.

      -dw

      Debug and Wait. This runtime option causes the PL/B program to be loaded but the PL/B runtime waits before actively executing the program. After the SunDebug debugger connects to this PL/B runtime, the PL/B program starts executing in debug mode. Since there is no ip address specified, the PL/B runtime uses the ip address of 127.0.0.1 as the default with a default port number of 52201.

       

      -dw [ipaddress[:port]]

      Debug and Wait. This runtime option invokes the debug behavior as described for '-dw' except the user specified ip address and optional port number are explicitly defined.

       

SunDebug GUI debugger

A.   SunDebug requires access to a PL/B program metadata found only in a file named 'programname.plbm'. In addition to the '.plbm' data, SunDebug must have access to the PL/B program source used to compile the program. The SunDebug debugger accesses the program source which is viewed in an active debug session.

B.   SunDebug is a GUI debugger that can be started without specifying any options. If SunDebug is started without specifying any options, the 'File\Connect' menu item can be clicked to connect to a PL/B runtime executing a program in debug mode. In this case, SunDebug connects using the default 127.0.0.1 ip address and the default port number 52201.

C.   Sundebug supports command line options that are described as follows:

Connect
This option causes SunDebug to make a connection using the default 127.0.0.1 and port number 52201 to a PL/B runtime executing a PL/B program in debug mode.
-dw

This option is used by Sundebug to build a command line when the '-program' option is used.

-dg

This option is used by Sundebug to build a command line when the '-program' option is used.

-ip=ipaddress[:port]

This option is used by Sundebug to build a command line when the '-program' option is used.

--program="{path}+{programname}"

This option causes Sundebug to build a command line to start the execution of a PL/B runtime using the 'programname.plc' program. Also, the '-dg', '-dw', and 'ip=' options are used when building the program command line which is invoked using a PL/B BATCH instruction.
 

D.   Examples

 

plbwin SunDebug

SunDebug starts executing. The user must establish a connection to a PL/B runtime executing a program in debug mode by using the 'File\Connect' menu item. The connection is made using the default of 127.0.0.1 and a port number of 52201.

 

plbwin SunDebug connect -program="c:\path\program.plc"

SunDebug starts executing such that a PL/B program is started first. Then SunDebug connects directly to the program using the default of 127.0.0.1 and a port number of 52201. In this case, the PL/B program is started using this command line built by SunDebug:

 

"plbwin -dg c:\path\program.plc"

plbwin sundebug -dw -program="c:\path\program.plc"

Sundebug starts executing such that a PL/B program is started first using the '-dw' and program name. In this case, the runtime executing the 'program.plc' waits until the user executing Sundebug manually connects using the 'File\connect' menu selection. In this case, the PL/B program is started using this command line built by Sundebug:

"plbwin -dw c:\path\program.plc"

PL/B Compiler Plbcmp

The 10.4 or later Plbcmp compiler must compile and build a PL/B program using the option of 'ws=1', 'ws:1', or 'ws#1'. The 'ws' option causes a PL/B metadata file named 'programname.plbm' to be generated. The '.plbm' metadata file is a library of data giving full reflection details about the 'programname.plc' program and its source modules. The reflection data provided in the '.plbm' file is used by SunDebug.

Example of Plbcmp

 

plbwin plbcmp programname.pls -ws=1

The compiler output files are as follows:

 

programname.plc

programname.plbm



PL/B IDE Studio Help Writing Code Program Profiling