How Do You Debug a Process in Linux?
Contents

How do I debug a Linux process?

Attaching an Already Running GDB to an Already Running Process

  1. Use the shell GDB command to run the ps command and find the program’s process id (pid): (gdb) shell ps -C program -o pid h pid. Replace program with a file name or path to the program.
  2. Use the attach command to attach GDB to the program: (gdb) attach pid.

How do you debug a stuck process?

To install and use Debugging Tool for Windows

  1. Run the program that is freezing or hanging, and that you wish to debug.
  2. Run the Debugging Tool for Windows. …
  3. Click on the File menu, and select Attach to a Process. …
  4. Find the process for the program which you wish to debug. …
  5. The command window should automatically open.
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest