So googling up a bit, I came across pdb: it's a really powerful tool, and this guide helped me getting used to it (another one, with extended examples, is here).
Whilst for sure the power of
import pdb;pdb.set_trace()is huge and keep adding it in the right places let me fix the bug, but what I was really searching for was something like
set -xfor a shell script, something that without touching the code, would allow me to debug it. Any suggestions?