JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Debugging a Program With dbx     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information

Preface

1.  Getting Started With dbx

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

5.  Controlling Program Execution

6.  Setting Breakpoints and Traces

7.  Using the Call Stack

8.  Evaluating and Displaying Data

9.  Using Runtime Checking

10.  Fixing and Continuing

11.  Debugging Multithreaded Applications

12.  Debugging Child Processes

13.  Debugging OpenMP Programs

14.  Working With Signals

15.  Debugging C++ With dbx

16.  Debugging Fortran Using dbx

17.  Debugging a Java Application With dbx

18.  Debugging at the Machine-Instruction Level

Examining the Contents of Memory

Using the examine or x Command

Using Addresses

Using Formats

Using Count

Examples of Using an Address

Using the dis Command

Using the listi Command

Stepping and Tracing at Machine-Instruction Level

Single Stepping at the Machine-Instruction Level

Tracing at the Machine-Instruction Level

Setting Breakpoints at the Machine-Instruction Level

Setting a Breakpoint at an Address

Using the regs Command

Platform-Specific Registers

SPARC Register Information

x86 Register Information

AMD64 Register Information

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Macros

D.  Command Reference

Index

Stepping and Tracing at Machine-Instruction Level

Machine-instruction level commands behave the same as their source level counterparts except that they operate at the level of single instructions instead of source lines.

Single Stepping at the Machine-Instruction Level

To single step from one machine instruction to the next machine instruction, use the nexti command or the stepi command

The nexti command and the stepi command behave the same as their source-code level counterparts: the nexti command steps over functions, the stepi command steps into a function called by the next instruction (stopping at the first instruction in the called function). The command forms are also the same. See next Command and step Command for a description.

The output from the nexti command and the stepi command differ from the corresponding source level commands in two ways:

For example:

(dbx) func
hand::ungrasp
(dbx) nexti
ungrasp +0x18:  call support
(dbx)

For more information, see nexti Command and stepi Command.

Tracing at the Machine-Instruction Level

Tracing techniques at the machine-instruction level work the same as at the source code level, except you use the tracei command. For the tracei command, dbx executes a single instruction only after each check of the address being executed or the value of the variable being traced. The tracei command produces automatic stepi-like behavior: the program advances one instruction at a time, stepping into function calls.

When you use the tracei command, it causes the program to stop for a moment after each instruction while dbx checks for the address execution or the value of the variable or expression being traced. Using the tracei command can slow execution considerably.

For more information on trace and its event specifications and modifiers, see Tracing Execution and tracei Command.

Here is the general syntax for the tracei command:

tracei event-specification [modifier]

Commonly used forms of the tracei command are:

tracei step
Trace each instruction.
tracei next
Trace each instruction, but skip over calls.
tracei at address
Trace the given code address.

For more information, see tracei Command.

For SPARC:

(dbx) tracei next -in main
(dbx) cont
0x00010814: main+0x0004: clr %l0
0x00010818: main+0x0008:  st      %l0, [%fp - 0x8]
0x0001081c: main+0x000c:  call    foo
0x00010820: main+0x0010:  nop
0x00010824: main+0x0014:  clr     %l0
....
....
(dbx) (dbx) tracei step -in foo -if glob == 0
(dbx) cont
0x000107dc: foo+0x0004:  mov     0x2, %l1
0x000107e0: foo+0x0008:  sethi   %hi(0x20800), %l0
0x000107e4: foo+0x000c:  or      %l0, 0x1f4, %l0     ! glob
0x000107e8: foo+0x0010:  st      %l1, [%l0]
0x000107ec: foo+0x0014:  ba      foo+0x1c
....
....