Sun Studio 12: Debugging a Program With dbx

Setting a stop Breakpoint in a Function

You can set a breakpoint in a function, using the stop in command:


(dbx) stop in function

An In Function breakpoint suspends program execution at the beginning of the first source line in a procedure or function.

dbx should be able to determine which variable or function you are referring to except when:

Consider the following set of declarations:


int foo(double);
int foo(int);
int bar();
class x {
   int bar();
};

When you stop at a non-member function, you can type:


stop in foo(int)

to set a breakpoint at the global foo(int).

To set a breakpoint at the member function you can use the command:


stop in x::bar()

If you type:


stop in foo

dbx cannot determine whether you mean the global function foo(int) or the global function foo(double) and may be forced to display an overloaded menu for clarification.

If you type:


stop in `bar

dbx cannot determine whether you mean the global function bar() or the member function bar() and displays an overload menu.

For more information on specifying an in function event, see in function.