Running pstack on a process sometimes causes gdb to attach to that process on one of my Linux servers. Why would pstack launch gdb, and how can I prevent that?


  • gdb is running as: /user/bin/gdb --quiet -nx /proc/1234/exe 1234
  • the parent process of gdb is: /bin/sh /user/bin/pstack 1234

Recent versions of pstack are standalone, but older versions (e.g. pstack-gdb, or the version of pstack in RHEL 5) are wrappers around gdb. Presumably “one of your servers” has an older distribution and its version of pstack is one of the gdb wrappers.

To prevent that, you’d have to install a newer version of pstack.

  • With this guidance, I noticed that "head -1 /bin/pstack" reveals "#!/bin/sh". It turns out that pstack is a short shell script on my RHEL7 system. – Kevin Kleinfelter Jun 19 '18 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.