function::print_ubacktrace_brief - Linux


Overview

function::print_ubacktrace_brief is a built-in GDB command used for debugging C++ programs by retrieving and printing a brief version of the call stack.

Syntax

print_ubacktrace_brief

Options/Flags

None.

Examples

Simple Usage

Run the command to print a brief stack trace:

(gdb) print_ubacktrace_brief
#0  0x0000000000000000 in main () at main.cpp:7

Printing the First N Frames

Specify the number of frames to print:

(gdb) print_ubacktrace_brief 3
#0  0x0000000000000000 in main () at main.cpp:7
#1  0x0000000000000000 in foo () at main.cpp:12
#2  0x0000000000000000 in bar () at main.cpp:17

Common Issues

None.

Integration

function::print_ubacktrace_brief can be used alongside other GDB commands:

  • bt: Print a detailed call stack traceback.
  • frame: Switch to a specific stack frame for further analysis.

Related Commands

  • backtrace: Print a formatted stack trace.
  • info stack: Display the current stack frames.