Debugging PyTango using GDB python

hi,

have you ever tried debugging a device server written in Python (PyTango)?

I managed to attach the debugger (gdb) to the device server process (like described in wiki article DebuggingWithGdb - Python Wiki)

The standard gdb commands work fine but all the py-{cmd} ones fail with following message:


(gdb) py-bt
#37 (<_Util at remote 0x7f39801300c0>,)
Python Exception <type 'exceptions.AttributeError'> 'PyTupleObjectPtr' object has no attribute 'current_line': 
Error occurred in Python command: 'PyTupleObjectPtr' object has no attribute 'current_line'

The way of attaching the debugger to the process:


~/gdb python <pid of ds process>
~/bt # -> shows full backtrace
~/py-bt # -> fails with above error message

I also tried the internal debugger of PyCharm IDE but it doesn’t seem to be working either.

Thanks in advance,
Gergely

Hi Gergely,

I’ve been using gdb and py-bt to debug segfaults and it worked fine, so I don’t think your problem is related to pytango.

Hope that helps,

/Vincent

Hi Gergely,

Yes, you can use pdb, winpdb.

Other introspection techniques you can use are:
[] spawn rfoo´s rconsole in the server and connect to it
[
] if you use gevent mode, spawn a gevent backdoor and connect to it

thanks for your answers! The issue is probably linked to my particular environment since I cannot debug other (not pytango) mixed code either.

Gergely