Difference between revisions of "Interactive debugger"

From MidrangeWiki
Jump to: navigation, search
(Categories)
m (+RDi)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[WDSC]] contains an {{AN}} which can be used to debug programs written in multiple languages.  The debugger can connect to programs running on the local PC as well as those on remote servers, including those [[i5/OS]] jobs.
+
[[WDSC]] and [[RDi]] contain an {{AN}} which can be used to debug programs written in multiple languages.  The debugger can connect to programs running on the local PC as well as those on remote servers, including those [[i5/OS]] jobs.
  
 
== Interactive Debugger Overview ==
 
== Interactive Debugger Overview ==
Line 6: Line 6:
 
== Using the debugger ==
 
== Using the debugger ==
 
This is the section in which to add usage notes
 
This is the section in which to add usage notes
 +
 +
===Prerequisites===
 +
Before a program can be debugged, several things must be in place.
 +
* The debug server ([[STRDBGSVR]]) must be started
 +
* The program must be compiled with a debugging view enabled
 +
** For RPG, this means DBGVIEW(*LIST) or DBGVIEW(*SOURCE)
  
 
=== Breakpoints ===
 
=== Breakpoints ===
Line 36: Line 42:
 
#* WDSC version: enter <expression> in the 'Expression' textbox
 
#* WDSC version: enter <expression> in the 'Expression' textbox
 
# Click Finish.
 
# Click Finish.
 +
 +
 +
Conditional breakpoint expressions can include several logical operators:
 +
{| class="wikitable"
 +
|+ Logical operators
 +
! Symbol !! Meaning !! Example
 +
|-
 +
| < || Less than || a < b
 +
|-
 +
| <= || Less than or equal || a <= b
 +
|-
 +
| > || Greater than || a > b
 +
|-
 +
| >= || Greater than or equal || a >= b
 +
|-
 +
| = || Equal to || a = b
 +
|-
 +
| <> || Not equal to || a <> b
 +
|-
 +
| AND || Logical AND || a > b AND b <> c
 +
|-
 +
| NOT || Logical NOT || NOT a > b
 +
|-
 +
| OR || Logical OR || a > b OR b = c
 +
|}
 +
 +
 +
Conditional breakpoint expressions can include several built-in functions:
 +
{| class="wikitable"
 +
|+ Built-in functions
 +
! Function !! Meaning !! Example
 +
|-
 +
| %SUBSTR || Substring a variable || %substr(email 1 10)
 +
|-
 +
| %ADDR || Return the address of a variable || %addr(email)
 +
|-
 +
| %INDEX || Set the index of a table, array or multiple-occurrence data structure || tab1 = %index(4)
 +
|-
 +
| %VARS || Escape a reserved debugger name as a variable || %vars(eval)
 +
|}
 +
 +
More information is available in the [http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzasc/hdbg.htm ILE RPG Programmer's Guide]
  
 
==== Watch breakpoints ====
 
==== Watch breakpoints ====
Line 56: Line 104:
  
 
==Categories==
 
==Categories==
 
Return to [[WDSC tips]]
 
 
[[Category:WDSC]]
 
[[Category:WDSC]]
 +
[[Category:Debugging]]
 +
[[Category:RDi]]
 +
{{stub}}

Latest revision as of 23:51, 10 October 2016

WDSC and RDi contain an Interactive debugger which can be used to debug programs written in multiple languages. The debugger can connect to programs running on the local PC as well as those on remote servers, including those i5/OS jobs.

Interactive Debugger Overview

Overview goes here

Using the debugger

This is the section in which to add usage notes

Prerequisites

Before a program can be debugged, several things must be in place.

  • The debug server (STRDBGSVR) must be started
  • The program must be compiled with a debugging view enabled
    • For RPG, this means DBGVIEW(*LIST) or DBGVIEW(*SOURCE)

Breakpoints

Breakpoints cause the execution of the program to stop at a given point so that the programmer can inspect the program state. In large programs, this is somewhat easier than stepping through each line of the program. Breakpoints can be added both while the debugger is active and while it is not. More complex breakpoints such as watch breakpoints require the debugger to be active.

Adding breakpoints

You can add a breakpoint in at least two ways. The debugger need not be active to add a breakpoint from the LPEX editor.

  1. Adding breakpoints from the LPEX editor
    1. Right-click in the source, then 'Add breakpoint'.


  1. Adding breakpoints using the Breakpoints view
    1. The debugger must be active
    2. Right-click in the Breakpoints view
    3. Select 'Add Breakpoint -> Line'
    4. Fill in the information for the breakpoint you wish to set.

Conditional breakpoints

On the second 'page' of the 'Edit breakpoint' dialogue, breakpoints can be modified to only fire when a certain condition is met.

  1. Open the 'Edit breakpoint' dialogue by
    • creating a new breakpoint
    • editing an existing breakpoint
  2. Changed desired values on the first page and click Next.
  3. Enter the condition in the Expression textbox. Syntax is similar to green screen debug.
    • Green screen version: break <line> when <expression>
    • WDSC version: enter <expression> in the 'Expression' textbox
  4. Click Finish.


Conditional breakpoint expressions can include several logical operators:

Logical operators
Symbol Meaning Example
< Less than a < b
<= Less than or equal a <= b
> Greater than a > b
>= Greater than or equal a >= b
= Equal to a = b
<> Not equal to a <> b
AND Logical AND a > b AND b <> c
NOT Logical NOT NOT a > b
OR Logical OR a > b OR b = c


Conditional breakpoint expressions can include several built-in functions:

Built-in functions
Function Meaning Example
 %SUBSTR Substring a variable  %substr(email 1 10)
 %ADDR Return the address of a variable  %addr(email)
 %INDEX Set the index of a table, array or multiple-occurrence data structure tab1 = %index(4)
 %VARS Escape a reserved debugger name as a variable  %vars(eval)

More information is available in the ILE RPG Programmer's Guide

Watch breakpoints

You can add a breakpoint in at least two ways. The debugger must be active to add watch breakpoints.

  1. Adding breakpoints from the LPEX editor
    1. Right-click in the source, then 'Add watch breakpoint'.
    2. Type the variable name if it's not there already
    3. Put the %size() of the variable in the 'Number of bytes to watch' dropdown.
    4. Click Finish.


  1. Adding breakpoints using the Breakpoints view
    1. Right-click in the Breakpoints view
    2. Select 'Add Breakpoint -> Watch'
    3. Type the variable name if it's not there already
    4. Put the %size() of the variable in the 'Number of bytes to watch' dropdown.
    5. Click Finish.


Categories

This article is a stub. You can help by editing it.