1

I have a python script that is running on my machine like this:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                       
 1018 root      24   0 98836 9108 3352 S  0.0  0.1   0:00.03 python /usr/mine.py                                                                                                         

This process has been running all day, while it is supposed to run for a few seconds and then to stop.

I wonder if there is a way, to get the current point of the code that is being executed, which is the point that the script is stuck.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Anastasios Andronidis
  • 6,310
  • 4
  • 30
  • 53

1 Answers1

0

You can attach using gdb and get a backtrace. It may or may not give you something easily discernible depending on what debug symbols you may or may not have installed.

Something like:

>>> gdb -p 1018
(gdb) bt

More info here:

How to attach a process in gdb

Backtraces

Debugging Python in gdb

Community
  • 1
  • 1
jbee
  • 206
  • 2
  • 8