show_self function

The show_self function is intended to provide a way for you to display the contents of a C++ object in a meaningful way.

You can make use of this function by coding one of the following member functions in a C++ class:

void show_self();
virtual void show_self();

The function may be public, protected, or private, however, it cannot be inherited from a base class. It cannot be an inlined function or a pure virtual.

If you provide this member function, it can be called from the debugger when your application being debugged is suspended. To call this function, right-click a C++ object or a pointer to a C++ object in the Monitors view or the Variables view. If there is a show_self member function in the class, show_self will appear in the pop-up menu. Select this action to execute the show_self member function.

Note:

With the Version 11.2, or earlier, debug engine, the menu action for show_self is only available for AIX applications.

If you have coded a show_self() member function, but the show_self action does not appear for the class, check to make sure that the function has actually been included in your application. The application linker may have discarded the show_self() member function because it is not referenced in your code or explicitly in the linker command.

Writing a show_self() function

The show_self function is normally used to display the contents of a C++ object. Since the code is executed in the debuggee process, it is not limited to this. The use of a show_self function in a class defined locally to another function is not supported.

The following actions in a show_self function will cause the debug session to fail:

The debugger runs the show_self function on an arbitrary thread in the debuggee process; all other threads are allowed to run. The debugger removes all breakpoints and watchpoints while it is running, and will be unresponsive while the function is executing.

For a list of show_self() limitations, see the related topic.


Feedback