Debugging a Program With dbx

Visiting Functions

You can use the func command to visit a function. To visit a function, type the command func followed by the function name. The func command by itself echoes the currently visited function. For example:


(dbx) func adjust_speed

Selecting from a List of C++ Ambiguous Function Names

If you try to visit a C++ member function with an ambiguous name or an overloaded function name, a list is displayed, showing all functions with the overloaded name.

If the specified function is ambiguous, type the number of the function you want to visit. If you know which specific class a function belong to, you can type:


(dbx) func block::block

Choosing Among Multiple Occurrences

If multiple symbols are accessible from the same scope level, dbx prints a message reporting the ambiguity:


(dbx) func main
(dbx) which block::block
Class block has more than one function member named block.

In the context of the which command, choosing from the list of occurrences does not affect the state of dbx or the program. Whichever occurrence you choose, dbx merely echoes the name.

Remember that the which command tells you which symbol dbx would pick. In the case of ambiguous names, the overload display list indicates that dbx does not yet know which occurrence of two or more names it would use. dbx lists the possibilities and waits for you to choose one.