|Skip Navigation Links|
|Exit Print View|
|Oracle Solaris Studio 12.3: Debugging a Program With dbx Oracle Solaris Studio 12.3 Information Library|
Using addresses and the examine or x command, you can examine the content of memory locations as well as print the assembly language instruction at each address. Using a command derived from adb(1), the assembly language debugger, you can query for:
The address, using the = (equal sign) character
The contents stored at an address, using the / (slash) character
Use the examine command, or its alias x, to display memory contents or addresses.
Use the following syntax to display the contents of memory starting at address for count items in format format. The default address is the next one after the last address previously displayed. The default count is 1. The default format is the same as was used in the previous examine command, or X if this is the first command given.
The syntax for the examine command is:
examine [address] [/ [count] [format]]
To display the contents of memory from address1 through address2 inclusive, in format format, type:
examine address1, address2 [/ [format]]
Display the address, instead of the contents of the address in the given format by typing:
examine address = [format]
To print the value stored at the next address after the one last displayed by examine, type:
examine +/ i
To print the value of an expression, enter the expression as an address:
examine address=format examine address=
The address is any expression resulting in or usable as an address. The address may be replaced with a + (plus sign), which displays the contents of the next address in the default format.
For example, the following are valid addresses:
Symbolic addresses used to display memory are specified by preceding a name with an ampersand (&). Function names can be used without the ampersand; &main is equal to main. Registers are denoted by preceding a name with a dollar sign ($).
The format is the address display format in which dbx displays the results of a query. The output produced depends on the current display format. To change the display format, supply a different format code.
The count is a repetition count in decimal. The increment size depends on the memory display format.
The following examples show how to use an address with count and format options to display five successive disassembled instructions starting from the current stopping point.
For SPARC based systems:
(dbx) stepi stopped in main at 0x108bc 0x000108bc: main+0x000c: st %l0, [%fp - 0x14] (dbx) x 0x108bc/5i 0x000108bc: main+0x000c: st %l0, [%fp - 0x14] 0x000108c0: main+0x0010: mov 0x1,%l0 0x000108c4: main+0x0014: or %l0,%g0, %o0 0x000108c8: main+0x0018: call 0x00020b90 [unresolved PLT 8: malloc] 0x000108cc: main+0x001c: nop
For x86 based systems:
(dbx) x &main/5i 0x08048988: main : pushl %ebp 0x08048989: main+0x0001: movl %esp,%ebp 0x0804898b: main+0x0003: subl $0x28,%esp 0x0804898e: main+0x0006: movl 0x8048ac0,%eax 0x08048993: main+0x000b: movl %eax,-8(%ebp)
The dis command is equivalent to the examine command with i as the default display format.
Here is the syntax for the dis command.
dis [address] [address1, address2] [/count]
The dis command:
Without arguments displays 10 instructions starting at +.
With the address argument only, disassembles 10 instructions starting at address.
With the address argument and a count, disassembles count instructions starting at address.
With the address1 and address2 arguments, disassembles instructions from address1 through address2.
With only a count, displays count instructions starting at +.
To display source lines with their corresponding assembly instructions, use the listi command, which is equivalent to the command list -i. See the discussion of list -i in Printing a Source Listing.
For SPARC based systems:
(dbx) listi 13, 14 13 i = atoi(argv); 0x0001083c: main+0x0014: ld [%fp + 0x48], %l0 0x00010840: main+0x0018: add %l0, 0x4, %l0 0x00010844: main+0x001c: ld [%l0], %l0 0x00010848: main+0x0020: or %l0, %g0, %o0 0x0001084c: main+0x0024: call 0x000209e8 [unresolved PLT 7: atoi] 0x00010850: main+0x0028: nop 0x00010854: main+0x002c: or %o0, %g0, %l0 0x00010858: main+0x0030: st %l0, [%fp - 0x8] 14 j = foo(i); 0x0001085c: main+0x0034: ld [%fp - 0x8], %l0 0x00010860: main+0x0038: or %l0, %g0, %o0 0x00010864: main+0x003c: call foo 0x00010868: main+0x0040: nop 0x0001086c: main+0x0044: or %o0, %g0, %l0 0x00010870: main+0x0048: st %l0, [%fp - 0xc]
For x86 based systems:
(dbx) listi 13, 14 13 i = atoi(argv); 0x080488fd: main+0x000d: movl 12(%ebp),%eax 0x08048900: main+0x0010: movl 4(%eax),%eax 0x08048903: main+0x0013: pushl %eax 0x08048904: main+0x0014: call atoi <0x8048798> 0x08048909: main+0x0019: addl $4,%esp 0x0804890c: main+0x001c: movl %eax,-8(%ebp) 14 j = foo(i); 0x0804890f: main+0x001f: movl -8(%ebp),%eax 0x08048912: main+0x0022: pushl %eax 0x08048913: main+0x0023: call foo <0x80488c0> 0x08048918: main+0x0028: addl $4,%esp 0x0804891b: main+0x002b: movl %eax,-12(%ebp)