Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Setting a Breakpoint in a Function

You can set a breakpoint in a function by 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 function you are referring to except in the following situations:

  • You reference an overloaded function by name only.

  • You reference a function with a leading `.

  • You reference a function by its linker name (mangled name in C++). In this case, dbx accepts the name if you prefix it with a #. For more information, see Linker Names.

Consider the following set of declarations:

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

To stop at a non-member function, the following command sets a breakpoint at the global foo(int):

stop in foo(int)

To set a breakpoint at the member function:

stop in x::bar()

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

stop in foo

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.


Note -  If a member name is unique, for example unique_member, using stop in unique_member is sufficient. If a member name is not unique, you can use the stop in command and answer the overload menu to specify which member you mean.

For more information about specifying an in-function event, see in Event Specification.