0

I understand mechanically from here:

I can use C-x C-q to disable read-only mode on the python file I am debugging. I can then make changes and use run to restart the debugger.

However, I find that when I do this, whenever I edit the file that I am debugging, I am faced with the following error:

That’s all folks.... exited abnormally with code 1

How can I make changes to a file I am debugging and then re-run it without the debugger crashing? My read is that the file is read-only for a reason, and when I modify it while pdb is running I invite disaster---but this suggests to me there is an approved way to do this correctly. What is it?

1
  • This is specifically edits in the file I'm running like changing APIs or dependencies. – Mittenchops Nov 3 '20 at 2:44
1

The thing is, the pdb debugger has the file loaded, so when you are editing the file (or buffer), it doesn't change it in the memory of the debugger, so it will ignore the changes until you call it again.

This issue is more related to the debugger itself, realgud it's just making sure of the file consistency, so it doesn't make too much sense to edit it in that scenario.

Still, there is probably a way to "hot reload" the debugger and get back to the pdb previous stage, but it's not implemented.

2
  • Is realgud uniquely not capable of this? Are other debugger backends that do this more easily? – Mittenchops Nov 3 '20 at 21:27
  • 1
    I'm not aware of any other debugger capable of this, still, you can try it with the Melpa package dap-mode, that has a python backend available – f-sasa Nov 3 '20 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.