There are three types of breakpoint action commands:
stop breakpoints. If the program arrives at a breakpoint created with a stop command, the program halts. The program cannot resume until you issue another debugging command, such as cont, step, or next.
when breakpoints. The program halts and dbx executes one or more debugging commands, then the program continues (unless one of the commands is stop).
trace breakpoints. the program halts and an event-specific trace information line is emitted, then the program continues.
You can set a breakpoint at a line number, using the dbx stop at command:
(dbx) stop at filename: n
where n is a source code line number and filename is an optional program file name qualifier. For example
(dbx)stop at main.cc:3
If the line specified in a stop or when command is not an executable line of source code, dbx sets the breakpoint at the next executable line.
A when breakpoint command accepts other dbx commands like list, allowing you to write your own version of trace.
(dbx) when at 123 { list $lineno;} |
when operates with an implied cont command. In the example above, after listing the source code at the current line, the program continues executing.
dbx provides full debugging support for code that makes use of the programmatic interface to the run-time linker; code that calls dlopen(), dlclose() and their associated functions. The run-time linker binds and unbinds shared libraries during program execution. Debugging support for dlopen()/dlclose() allows you to step into a function or set a breakpoint in functions in a dynamically shared library just as you can in a library linked when the program is started.
There are three exceptions:
You cannot set a breakpoint in a library loaded by dlopen()before that library is loaded by dlopen().
You cannot set a breakpoint in a filter library loaded by dlopen() until the first function in it is called.
When a library is loaded by dlopen(), an initialization routine named _init() is called. This routine may call other routines in the library. dbx cannot place breakpoints in the loaded library until after this initialization is completed. You cannot have dbx stop at _init() in a library loaded by dlopen().
You may want to check for problems related to calls to members of different classes, calls to any members of a given class, or calls to overloaded top-level functions. You can use a keyword--inmember, inclass, infunction, or inobject--with a stop, when, or trace command to set multiple breaks in C++ code.
To set a breakpoint in each of the object-specific variants of a particular member function (same member function name, different classes), use stop inmember.
To set a when breakpoint, use when inmember.
For example, if the function draw is defined in several different classes, then to place a breakpoint in each function :
(dbx) stop inmember draw
To set a breakpoint in all member functions of a specific class, use the stop inclass command.
To set a when breakpoint, use when inclass.
To set a breakpoint in all member functions of the class draw:
(dbx) stop inclass draw
Breakpoints are inserted in only the class member functions defined in the class. It does not include those that it may inherit from base classes.
Due to the large number of breakpoints that may be inserted by stop inclass and other breakpoint selections, you should be sure to set your dbxenv step_events to on to speed up step and next.
To set multiple breakpoints in nonmember functions with overloaded names (same name, different type or number of arguments), use the stop infunction command.
To set a when breakpoint, use when infunction.
For example, if a C++ program has defined two versions of a function named sort(), one which passes an int type argument, the other a float, then, to place a breakpoint in both functions:
(dbx) when infunction sort {cmd;}
Set an In Object breakpoint to check the operations applied to a specific object. An In Object breakpoint suspends program execution in all nonstatic member functions of the object's class when called from the object.
To set a breakpoint in object foo:
(dbx) stop inobject foo