Get the latest tech news

Debugging running Python scripts with PDB via GDB


Disconnect3d's blog.

A friend of mine had an interesting case recently where they wanted to debug an already running Python script on Linux and after some testing it turned out this is possible, so let’s see how it can be done in CPython :). I have only tested this method on Python 3.11.6 and generally speaking, I am not sure if this doesn’t corrupt the internal CPython state somehow – and if it does – this could end up crashing our script. I would also like to thanks Ian Smith from Trail of Bits for an interesting problem to solve and ptrtofuture from justCatTheFish team for showing me a similar technique in the past :)

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Python scripts

Python scripts

Photo of GDB

GDB

Photo of PDB

PDB

Related news:

News photo

Telegram fixes Windows app zero-day used to launch Python scripts