You are on page 1of 37

IBM i Debugger

1

IBM i Debugger

Overview
Service Entry Points
Debugger Functions
Attach to an IBM i Job
Launch Configurations and Settings

2

Integrated Debugger - Overview
 RPG, COBOL, CL, C, and C++
 IBM i - ILE and non ILE, incl. free-form RPG
 DB2 and SQL stored procedures
 Source and Listing view
 Batch, interactive, and Multi-Threaded Applications
 Client/Server Applications
 Distributed Applications

3

Overview  Manage program execution – Step/Run commands – Multiple breakpoint types  Work with content of variables – Display – Modify  Work with content of memory – Display – Modify for teraspace enabled programs 4 . Debugger Functions .

. right click a subsystem (Objects. Commands.WRKSRVTBLE add or change the entry QDBGSVR2 5 . from 5250 session. Start/Stop Debug Server . issue command STRDBGSVR to start and ENDDBGSVR to stop. . or IFS Files).Default port 3825 .Or.Select Remote Servers > Debug > Start to start and Stop to stop. Jobs. .Once per i system .From RSE.

STRRSESVR Multi-threaded Creates BCI job Job Specified job 6 . Where does the Application run? Debug As… Batch Submitted to batch Interactive 5250 emulation.

Debug view Programs Outline view Editor – LPEX or Debug Editor 7 . Debug Perspective Notebook with views for Breakpoints. Variables.

Debug perspective Collection of editor and views Users can customize the perspective Views can be re-sized and re- positioned through drag and drop Views can be closed Views can be added Use Save Perspective As… to save customized perspective 8 .

the communication between debug client and debug server will be through SSH tunnel. Secure connection for debug session  If you use SSL support for a RSE connection. 9 . This feature is only available on OS400 V6R1 and later version.

IBM i Debugger Overview Service Entry Points Debugger Functions Attach to an IBM i Job Launch Configurations and Settings 10 .

Service Entry Points  Service Entry Points for ILE on V5R2 or later – You know the program you want to debug but the program gets started in a server environment – You know the userid the program will be running under – You don’t know the job name where the program will be running 11 .

Service Entry Points (continued)  Great for: – WebFaced applications – Web applications – Toolbox calls – Any ILE program you want to debug 12 .

except RSE server job  From the Service Entry Points view – In the pop-up menu. select the program. or procedure – In the pop-up menu. select Debug (Service Entry) > Set Service Entry Point – Run the application from anywhere. Setting Service Entry Points  From the Remote System Explorer – In the Remote Systems view. service program. module. or press the toolbar button – Fill in the Set Service Entry Point dialog – Run the application from anywhere 13 . select Set.

Modify. Service Entry Points view Service Entry Points view is automatically displayed when Service Entry Point set. Otherwise display from Window > Show view > Other > IBM i > IBM i Service Entry Points  List of all Service Entry Points set from the RSE  Pop-up menu to work with Service Entry Points – Set. Enable/Disable  Pull down menu to Clear all or selected Service Entry Points 14 . Refresh. Remove.

15 . Service Entry Points -Refresh  Service entry points not valid after program is recompiled. Use Refresh in IBM i Service Entry Points view to re-set the service entry points.

Service Entry Points . 16 .Modify  When Service Entry Point is set.  If you want to debug a job running under user profile other than this RSE logon ID. its user profile property (user whose job is going to hit the Service Entry Point) is set to the user ID used to logon to RSE connection. you can modify the SEP to set to the proper user profile.

IBM i Debugger Overview Service Entry Points Debugger Functions Attach to an IBM i Job Launch Configurations and Settings 17 .

Terminate. Suspend. Step Return Variables Breakpoints Call Monitored variables Stack Programs under debug Current Break Line Point Outline Add Properties: Window -> Show View -> Other -> General 18 . Debug Perspective Resume. Step Over. Step Into.

Program Execution  Step Into – Debug the next call level  Step Over – Run the next call level and stop at the next statement  Step Return (for ILE on V5R3 or higher) – Run until you are back in the previous call level and stop at the next statement  Resume – Run until an event is encountered  Run To Location – Run and stop at the current cursor position or until an event is encountered  Suspend – Halt program at point of execution  Terminate – End the debug session 19 .

select Add/Remove Breakpoint from pop-up menu In Breakpoints view. select Add Watch Breakpoint from pop-up menu In Breakpoints view. 20 . Setting Breakpoints Ways to set a Line Breakpoint: Double click in prefix area In prefix area. select Add/Remove Breakpoint from pop-up menu In Editor. Editor breakpoints in bound service programs Ways to set a Watch Breakpoint: Double click variable and In Editor. select Add Breakpoint > Line from pop-up menu. select Add Breakpoint > Watch from pop-up menu.

Conditional Line Breakpoint Set Frequency Value to start Value to stop Breaks to skip Set Expression Conditions must be true for break to happen 21 .

Watch Breakpoint Number of bytes to watch set to 0 for defined length of variable Maximum length 128 Maximum of 256 watches per system Variable spanning a page break uses 2 watches Watches disabled when restored 22 .

Right-click 3. Variable listed in Monitors view 23 . Monitors View To monitor selected variables independent of their scope: 1. Monitor Expression 4. Double click variable 2.

Can add dimension •Data in Monitor view updated at each stop •Changed data marked in red with triangle icon •Double click on entry to open for edit. Variable pre-filled 4. Select variable 2. modify value and press Enter 24 . Monitor Expression Dialog 1. Click plus sign for dialog 3.

 Variables view automatically displays all variables of current scope. local variables support is available for ILE RPG and ILE COBOL. Variables view  In V5R3 or later. for C and C++ also in earlier releases. 25 .

Select Monitor Memory > Hex and Character • Memory displayed starting with address of selected variable • Edit for teraspace enabled pgms Press Toggle Split Pane to display hex and char 26 . Select variable to display in Memory view 2. Display Memory Content 1.

Programs view Click plus to add a Program or Service Program Pop-up menu to remove programs from debug Expand program entry and double click to display source 27 .

IBM i Debugger Overview Service Entry Points Debugger Functions Attach to an IBM i Job Launch Configurations and Settings 28 .

Attach to an IBM i Job Job subsystem Interactive debugging requires 5250 session and STRRSESVR command 29 .

30 . Attach to an IBM i Job You can add program to debug here.

Note: Terminating the debug session does not terminate the interactive program 31 . Attach to an IBM i Job Click Step or Resume button. and then switch to emulation to start your application.

IBM i Debugger Overview Service Entry Points Debugger Functions Debugging interactive Applications Launch Configurations and Settings 32 .

Launch Configuration – How to Start Command to start application required for service programs How to invoke your application Default: Call (selected program) Batch: SBMJOB (selected program) 33 .

Source Locator Scenario Development system Production system PGM A PGM A source object Debug Debug source locator 34 .

Launch Configuration – source location If source remains in the original library (compilation time). Moved to a different folder Resides on a different IBM i Source locator can be specified from Source tab of launch configuration 35 . use Remote Folder source locator. RTC for Power. debugger will find it If source member has been moved since compile occurred. etc If IFS source is moved. use source locator (next slide) Moved to a different library Resides on a different system.

Click Add button 2. Select source physical file 6. Select IBM i Source File or Remote Folder 3. Select connection 4. File is added to list in Source Lookup Path 36 . Launch Configuration – Source tab 1. Specify library if not in library list 5.

Debug Preferences • Update production files • Prompt when SEP is set • Prompt when SEP is hit • Include bound srvpgms and exclude libraries default: not checked 37 .