GSTACK(1)

πŸ“¦
version 17.2 Β· 3 versions
, in ubuntu stonking

✨ GSTACK(1) ✨

okay bestie, this is the manual page for gstack, living in the GNU Development Tools section of your friendly neighborhood Unix manual πŸ’–


πŸŽ€ NAME πŸŽ€

gstack β€” literally prints a stack trace of a running program. that's it, that's the vibe πŸ’…


🌸 SYNOPSIS 🌸

gstack [-h | --help] [-v | --version] pid

πŸ¦‹ DESCRIPTION πŸ¦‹

So like… you've got a program running, you know its process ID (pid), and you want to know where in the code it's hanging out right this second. gstack said "say less" and prints a stack trace of that running program. ✨

And if the process is multi-threaded? bestie it does NOT play favorites β€” gstack outputs backtraces for every thread that exists in the process. every single one. no thread left behind 🫢

Here's the tea on how it actually works: the script invokes GDB, attaches to the given process ID, prints the stack trace, and detaches from the process. that's the whole lil routine πŸ’«

⚠️ and now the serious part, no cap: gstack exits with non-zero status if gdb was unable to attach to the given process ID for any reason β€” like a non-existent process ID, or not having sufficient privileges to attach to the process. so if it's giving failure, check your pid and check your privileges πŸ‘‘πŸ’€

⭐ OPTIONS ⭐

  • --help, -h β€” lists all the options, with brief explanations. it's giving "menu, but make it helpful" πŸ“
  • --version, -v β€” prints version information and then exits. little flyby, in and out, iconic 🌈

πŸ’œ ENVIRONMENT πŸ’œ

  • AWK β€” full file name for an Awk interpreter to use. if it's not set, PATH will be searched for an "awk" program. 🧚
  • GDB β€” full file name for a GDB executable to use to generate stack backtraces. if it's not set, PATH will be searched for a "gdb" program. πŸ”₯
  • GDBARGS β€” optional arguments to be passed to the "gdb" program. lil extra seasoning, iykyk πŸ’…

🌺 SEE ALSO 🌺

The full documentation for GDB is maintained as a Texinfo manual. If the "info" and "gdb" programs and GDB's Texinfo documentation are properly installed at your site, the command

info gdb

should give you access to the complete manual. periodt πŸ“–βœ¨

Also on the reading list:

  • Using GDB: A Guide to the GNU Source-Level Debugger, Richard M. Stallman and Roland H. Pesch, July 1991.

Copyright (c) 1988-2025 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being "Free Software" and "Free Software Needs Free Documentation", with the Front-Cover Texts being "A GNU Manual," and with the Back-Cover Texts as in (a) below.

(a) The FSF's Back-Cover Text is: "You are free to copy and modify this GNU Manual. Buying copies from GNU Press supports the FSF in developing GNU and promoting software freedom."


and that's the whole page bestie!! this one came from gdb-17.2, dated 2026-05-17, and it's page GSTACK(1) of the GNU Development Tools lineup. go get those backtraces, you main character πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from