Title: make pdb.set_trace() accept debugger commands as arguments and run them after entering the debugger
Type: enhancement Stage:
Components: Extension Modules, Library (Lib) Versions: Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: THRlWiTi, georg.brandl
Priority: normal Keywords:

Created on 2016-04-10 12:22 by THRlWiTi, last changed 2016-04-10 14:58 by SilentGhost.

Messages (1)
msg263135 - (view) Author: Thrlwiti (THRlWiTi) * Date: 2016-04-10 12:22
I usually insert the following line in the middle of code to start the debugger from there:

import pdb; pdb.set_trace()

More often than not, I need to run some commands immediately after entering the debug mode, e.g. watch (display) some variables, create some additional break points, etc.

AFAIK currently you have to enter those commands manually on each run and there is no simple way to pass those commands from the source code.

Of-course one can invoke pdb as a script ("python3 -m pdb -c ...") and pass the desired commands to the script. But still using pdb.set_trace() is a popular method and I think it would be very useful to have set_trace() accept a list of strings as arguments and execute them right after entering the debugger.
Date User Action Args
2016-04-10 14:58:11SilentGhostsetnosy: + georg.brandl
components: + Extension Modules, Library (Lib), - Interpreter Core
2016-04-10 12:22:09THRlWiTicreate