Chapter 29: Debugging Assembler Programs

This chapter provides a description of Assembler Option's debugging facilities.

29.1 Introduction

When an Assembler module is debugged, a separate character-based window opens containing the Assembler debugger. This window overlays the Application Output window, which remains available to you via a debugger option.

These are some of the things you can do during debugging:

For step-by-step instructions on how to use the Assembler debugger, click Help Topics on the Mainframe Express Help menu, then on the Contents tab click Assembler Option, Debugging, then select from the categories shown.

29.2 Starting and Stopping Debugging

Before you can debug an Assembler module, you must compile the module with Create Debug Information checked. You can find this check box on the General page of the Assembler page of the Build Settings for Project or Build Settings for filename dialog box. If you want to debug a module that is part of an application containing several modules, you must check Create Debug Information for every module in the application. If your application has a separate link file, you must also check Create Debug Information on the General page of the Linker page of the Build Settings for Project or Build Settings for filename dialog box.

You start debugging by clicking Start Debugging on the Debug menu. On the Start Debugging dialog box, check Enable Assembler debugging, then click OK. If you debug the module again during the same session, you can start it by clicking Start Debugging, Run or Debug. Whenever control is passed to an Assembler module, the Assembler debugger window opens automatically and waits for an action from you (unless you have previously requested that the entire application should be executed with no more debugging).

The Assembler debugger also starts automatically if an abend occurs.

Certain actions from you stop the debugger automatically, such as rebuilding the project or opening a different project. Alternatively you can stop the debugger yourself in the following ways:

29.3 The Assembler Debugger Window

Figure 29-1 shows the Assembler debugger with the program mfasm03.mlc loaded. This program is part of the project acobdemo, which you can find in \mfuser\projects\gmdemo\acobdemo\acobdemo.mvp. See the chapters Assembler Applications and Debugging Assembler in your Getting Started for descriptions of how to build and run this project.



Figure 29-1: The Assembler Debugger Window

The Assembler debugger window is divided into four panels:

You can toggle synchronization of the trace and list panels on and off using the M (syncMode) command.

You can change the background and foreground colors used in each of the four panels using the C (Color) command.

29.4 Running and Stepping Through the Module

There are a number of ways to execute all or part of the module:

For more information see the online help.

29.5 Moving around the Source Code

You can move around your source code in the listing panel using the + and - keys or Page Up and Page Down. If you then want to resynchronize with the trace panel you can press L (syncList) to display the next instruction to be executed on line 18.

You can use the F (Find) command to locate various parts of the code:

The debugger scrolls through the code until the instruction containing the part of the code you specified is on line 18.

29.6 Halting Execution

You can halt execution by monitoring module exits with the E (Exit) command, and by setting breakpoints.

You can use the B (Breakpoint) command to set breakpoints on:

In all cases, the debugger monitors the breakpoints you have set, and halts execution in accordance with them.

Use the U (Unset) command to clear all breakpoints of all types. You can do a certain amount of selective clearing within the four breakpoint options.

You can specify that execution is to be halted when the following types of module exit occur:

29.7 Examining and Changing Values

You can view and change values in registers and areas of memory.

29.7.1 Register Values

The general-purpose registers are permanently displayed. You can use the R (Reg) command to:

29.7.2 Memory Dumps

You can use the D (Dump) command to view one or two dumps at once. Each dump displays 32 bytes of memory starting with the byte at the address you specify. Figure 29-2 shows the debugger window with two dumps displayed.



Figure 29-2: Dump Windows

Notice that the menu panel (on lines 22 through 24) now contains the dump menu. This includes facilities to:

Once you have closed the dump windows, you can see the dumps last requested by pressing O (Odump, which stands for Old dump).

29.8 Examining Instructions

You can examine the instruction that is currently on line 18 of the trace panel using the P (probe) command. There are two levels of information available as explained in this example.

When you press P the first time, you obtain the Probe window. Figure 29-3 shows the Probe window for a CP (Compare Packed-decimal) instruction in mfasm03.mlc.



Figure 29-3: Probing the Compare Packed-decimal Instruction

The information in the Probe window is in three categories:

Line 1 Quick-reference information for the Assembler instruction.
Lines 2 through 10 Detailed description of the Assembler instruction to be executed. The machine code for the instruction is shown in the center of the Probe window.
Lines 11 through 12 Brief description of the Assembler instruction.

When you press P a second time you see the dump windows shown in Figure 29-2. The first dump begins with the first operand of the instruction and the second dump begins with the second operand. The operands are highlighted.

When you press P a third time the Assembler debugger returns to Step mode to enable you to continue stepping through the program.


Note: Pressing Escape escapes from each Probe window a single step at a time.


29.9 Sources of Information

The Assembler debugger displays messages on line 1. Most messages disappear when you perform another debugger function. You can recall the last message by pressing Shift+?

You can obtain a status report on the current debugging activity using the I (Info) command.

You can view the Application Output window by pressing F2. Pressing F2 again redisplays the debugger.

You can obtain a list of all Assembler instructions by pressing F1, then 1 from the menu displayed. Once you have obtained the list, you can press S (for Select) then enter an opcode; the debugger then displays the same instruction information that you get when you use the Probe instruction, except that actual addresses are missing.

29.10 Working with Hexadecimal Notation

The Assembler debugger provides a calculator for doing additions. You can add up to three numbers and can work in either hexadecimal or decimal. You can keep the calculator displayed while you return to debugging operations.

While you are working with the Assembler debugger you often have to enter hexadecimal values a byte at a time, which requires eight hexadecimal characters. The debugger provides a number of short-cut techniques for entering hexadecimal values.

For further information see the online help: click Help Topics on the Mainframe Express Help menu, then on the Contents tab click Assembler Option, Debugging, then select from the categories shown..


Copyright © 2001 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.