JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: Debugging a Program With dbx
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

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Command Reference

assign Command

Native Mode Syntax

Java Mode Syntax

attach Command

Syntax

To Attach to a Running Java Process

bsearch Command

Syntax

call Command

Native Mode Syntax

Java Mode Syntax

cancel Command

Syntax

catch Command

Syntax

check Command

Syntax

clear Command

Syntax

collector Command

Syntax

collector archive Command

Syntax

collector dbxsample Command

Syntax

collector disable Command

Syntax

collector enable Command

Syntax

collector heaptrace Command

Syntax

collector hw_profile Command

Syntax

collector limit Command

Syntax

collector mpitrace Command

Syntax

collector pause Command

Syntax

collector profile Command

Syntax

collector resume Command

Syntax

collector sample Command

Syntax

collector show Command

Syntax

collector status Command

Syntax

collector store Command

Syntax

collector synctrace Command

Syntax

collector tha Command

Syntax

collector version Command

Syntax

cont Command

Syntax

dalias Command

Syntax

dbx Command

Native Mode Syntax

Java Mode Syntax

Options

dbxenv Command

Syntax

debug Command

Native Mode Syntax

Java Mode Syntax

Options

delete Command

Syntax

detach Command

Native Mode Syntax

Java Mode Syntax

dis Command

Syntax

Options

display Command

Native Mode Syntax

Java Mode Syntax

down Command

Syntax

dump Command

Syntax

edit Command

Syntax

examine Command

Syntax

exception Command

Syntax

exists Command

Syntax

file Command

Syntax

files Command

Native Mode Syntax

Java Mode Syntax

fix Command

Syntax

fixed Command

Syntax

fortran_modules Command

Syntax

frame Command

Syntax

func Command

Native Mode Syntax

Java Mode Syntax

funcs Command

Syntax

gdb Command

Syntax

handler Command

Syntax

hide Command

Syntax

ignore Command

Syntax

import Command

Syntax

intercept Command

Syntax

java Command

Syntax

jclasses Command

Syntax

joff Command

Syntax

jon Command

Syntax

jpkgs Command

Syntax

kill Command

Syntax

language Command

Syntax

line Command

Syntax

Examples

list Command

Syntax

Options

Examples

listi Command

loadobject Command

Syntax

loadobject -dumpelf Command

Syntax

loadobject -exclude Command

Syntax

loadobject -hide Command

Syntax

loadobject -list Command

Syntax

loadobject -load Command

Syntax

loadobject -unload Command

Syntax

loadobject -use Command

Syntax

lwp Command

Syntax

lwps Command

Syntax

mmapfile Command

Syntax

Example

module Command

Syntax

modules Command

Syntax

native Command

Syntax

next Command

Native Mode Syntax

Java Mode Syntax

nexti Command

Syntax

omp_loop Command

Syntax

omp_pr Command

Syntax

omp_serialize Command

Syntax

omp_team Command

Syntax

omp_tr Command

Syntax

pathmap Command

Syntax

Examples

pop Command

Syntax

print Command

Native Mode Syntax

Java Mode Syntax

proc Command

Syntax

prog Command

Syntax

quit Command

Syntax

regs Command

Syntax

Example (SPARC platform)

replay Command

Syntax

rerun Command

Syntax

restore Command

Syntax

rprint Command

Syntax

rtc showmap Command

Syntax

rtc skippatch Command

Syntax

run Command

Native Mode Syntax

Java Mode Syntax

runargs Command

Syntax

save Command

Syntax

scopes Command

Syntax

search Command

Syntax

showblock Command

Syntax

showleaks Command

Syntax

showmemuse Command

Syntax

source Command

Syntax

status Command

Syntax

Example

step Command

Native Mode Syntax

Java Mode Syntax

stepi Command

Syntax

stop Command

Syntax

Native Mode Syntax

Java Mode Syntax

stopi Command

Syntax

suppress Command

Syntax

sync Command

Syntax

syncs Command

Syntax

thread Command

Native Mode Syntax

Java Mode Syntax

threads Command

Native Mode Syntax

Java Mode Syntax

trace Command

Syntax

Native Mode Syntax

Java Mode Syntax

tracei Command

Syntax

uncheck Command

Syntax

undisplay Command

Native Mode Syntax

Java Mode Syntax

unhide Command

Syntax

unintercept Command

Syntax

unsuppress Command

Syntax

unwatch Command

Syntax

up Command

Syntax

use Command

watch Command

Syntax

whatis Command

Native Mode Syntax

Java Mode Syntax

when Command

Syntax

Native Mode Syntax

Java Mode Syntax

wheni Command

Syntax

where Command

Native Mode Syntax

Java Mode Syntax

whereami Command

Syntax

whereis Command

Syntax

which Command

Syntax

whocatches Command

Syntax

Index

check Command

The check command enables checking of memory access, leaks, or usage, and prints the current status of runtime checking (RTC). It is valid only in native mode.

The features of runtime checking that are enabled by this command are reset to their initial state by the debug command.

Syntax

check -access

Turn on access checking. RTC reports the following errors:

baf

Bad free

duf

Duplicate free

maf

Misaligned free

mar

Misaligned read

maw

Misaligned write

oom

Out of memory

rob

Read from array out-of-bounds memory

rua

Read from unallocated memory

rui

Read from uninitialized memory

wob

Write to array out-of-bounds memory

wro

Write to read-only memory

wua

Write to unallocated memory

The default behavior is to stop the process after detecting each access error, which can be changed using the rtc_auto_continue dbx environment variable. When set to on access errors are logged to a file (the file name is controlled by the dbx environment variable rtc_error_log_file_name). See dbxenv Command.

By default each unique access error is only reported the first time it happens. Change this behavior using the dbx environment variable rtc_auto_suppress (the default setting of this variable is on). See dbxenv Command.

check -leaks [-frames n] [-match m]

Turn on leak checking. RTC reports the following errors:

aib

Possible memory leak - only pointer points in the middle of the block

air

Possible memory leak - pointer to the block exists only in register

mel

Memory leak - no pointers to the block

With leak checking turned on, you get an automatic leak report when the program exits. All leaks including possible leaks are reported at that time. By default, a non-verbose report is generated (controlled by the dbx environment variable rtc_mel_at_exit). However, you can ask for a leak report at any time (see showleaks Command).

-frames n implies that up to n distinct stack frames are displayed when reporting leaks. -matchm is used for combining leaks; if the call stack at the time of allocation for two or more leaks matches n frames, then these leaks are reported in a single combined leak report.

The default value of n is 8 or the value of m (whichever is larger). Maximum value of n is 16. The default value of m is 3 for C++, and 2 otherwise.

check -memuse [-frames n] [-match m]

The -memuse option behaves similarly to the -leaks option, and also enables a blocks in use report (biu) when the program exits. By default a non-verbose blocks in use report is generated (controlled by the dbx environment variable rtc_biu_at_exit) At any time during program execution you can see where the memory in your program has been allocated (see showmemuse Command).

-frames n implies that up to n distinct stack frames will be displayed while reporting memory use and leaks. -matchm is used for combining these reports; if the call stack at the time of allocation for two or more leaks matches m frames, then these are reported in a single combined memory leak report.

The default value of n is 8 or the value of m (whichever is larger). Maximum value of n is 16. The default value of m is 3 for C++, and 2 otherwise. See check -leaks as well.

check -all [-frames n] [-match m]

Equivalent to check -access and check -memuse [-frames n] [-match m]

The value of the dbx environment variable rtc_biu_at_exit is not changed with check -all, so by default no memory use report is generated at exit. See dbx Command for the description of the rtc_biu_at_exit environment variable.

check [functions] [files] [loadobjects]

Equivalent to check -all; suppress all; unsuppress all in functions, files, and loadobjects

where:

functions is one or more function names.

files is one or more file names.

loadobjects is one or more load object names

You can use this to focus runtime checking on places of interest.


Note - To detect all errors, RTC does not require the program be compiled -g. However, symbolic ( -g) information is sometimes needed to guarantee the correctness of certain errors (mostly read from uninitialized memory). For this reason certain errors ( rui for a.out and rui + aib + air for shared libraries) are suppressed if no symbolic information is available. This behavior can be changed by using suppress and unsuppress.