Multithreaded Programming Guide

Exit Print View

Updated: July 2014
 
 

Using dbx

The dbx utility is a debugger included in the Oracle Solaris Studio developer tools, available from http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html. With the Oracle Solaris Studio dbx command-line debugger, you can debug and execute source programs that are written in C, C++, and Fortran. You can use dbx by starting it in a terminal window and interactively debugging your program with dbx commands. If you prefer a graphical interface, you can use the same dbx functionality in the Debugging windows of the Oracle Solaris Studio IDE (Integrated Development Environment). For a description of how to start dbx, see the dbx(1) man page. See the manual Oracle Solaris Studio 12.3: Debugging a Program With dbx for an overview of dbx. The Debugging features in the Oracle Solaris Studio IDE are described in the IDE online help.

See Chapter 11, Debugging Multithreaded Applications, in Oracle Solaris Studio 12.3: Debugging a Program With dbx for detailed information about debugging multithreaded programs. The dbx debugger provides commands to manipulate event handlers for thread events, which are described inAppendix B, Event Management, in Oracle Solaris Studio 12.3: Debugging a Program With dbx.

All the dbx options that are listed in Table 8–1 can support multithreaded applications.

Table 8-1  dbx Options for MT Programs
Option
Action
cont at line [-sig signo id]
Continues execution at line with signal signo. The id, if present, specifies which thread or LWP to continue. The default value is all.
lwp [lwpid]
Displays current LWP. Switches to given LWP [lwpid].
lwps
Lists all LWPs in the current process.
next ... tid
Steps the given thread. When a function call is skipped, all LWPs are implicitly resumed for the duration of that function call. Nonactive threads cannot be stepped.
next ... lwpid
Steps the given LWP. Does not implicitly resume all LWPs when skipping a function. The LWP on which the given thread is active. Does not implicitly resume all LWP when skipping a function.
step... tid
Steps the given thread. When a function call is skipped, all LWPs are implicitly resumed for the duration of that function call. Nonactive threads cannot be stepped.
step... lwpid
Steps the given LWP. Does not implicitly resume all LWPs when skipping a function.
stepi... lwpid
Steps machine instructions (stepping into calls) in the given LWP.
stepi... tid
Steps machine instructions in the LWP on which the given thread is active.
thread [ tid ]
Displays current thread, or switches to thread tid. In all the following variations, omitting the l tid implies the current thread.
thread -info [ tid ]
Prints everything known about the given thread.
thread -blocks [ tid ]
Prints all locks held by the given thread blocking other threads.
thread -suspend [ tid ]
Puts the given thread into suspended state, which prevents it from running. A suspended thread displays with an “S” in the threads listing.
thread -resume [ tid ]
Unsuspends the given thread so it resumes running.
thread -hide [ tid ]
Hides the given or current thread. The thread does not appear in the generic threads listing.
thread -unhide [ tid ]
Unhides the given or current thread.
thread -unhide all
Unhides all threads.
threads
Prints the list of all known threads.
threads -all
Prints threads that are not usually printed (zombies).
threads -mode all|filter
Controls whether threads prints all threads or filters threads by default. When filtering is on, threads that have been hidden by the thread -hide command are not listed.
threads -mode auto|manual
Enables automatic updating of the thread listing.
threads -mode
Echoes the current modes. Any of the previous forms can be followed by a thread or LWP ID to get the traceback for the specified entity.