Skip to content

make pdb.set_trace() accept debugger commands as arguments and run them after entering the debugger #70915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
THRlWiTi mannequin opened this issue Apr 10, 2016 · 2 comments
Labels
extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@THRlWiTi
Copy link
Mannequin

THRlWiTi mannequin commented Apr 10, 2016

BPO 26728
Nosy @birkenfeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2016-04-10.12:22:09.028>
labels = ['extension-modules', 'type-feature', 'library']
title = 'make pdb.set_trace() accept debugger commands as arguments and run them after entering the debugger'
updated_at = <Date 2016-04-10.14:58:11.509>
user = 'https://bugs.python.org/THRlWiTi'

bugs.python.org fields:

activity = <Date 2016-04-10.14:58:11.509>
actor = 'SilentGhost'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Extension Modules', 'Library (Lib)']
creation = <Date 2016-04-10.12:22:09.028>
creator = 'THRlWiTi'
dependencies = []
files = []
hgrepos = []
issue_num = 26728
keywords = []
message_count = 1.0
messages = ['263135']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'THRlWiTi']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue26728'
versions = ['Python 3.6']

@THRlWiTi
Copy link
Mannequin Author

THRlWiTi mannequin commented Apr 10, 2016

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.

@THRlWiTi THRlWiTi mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Apr 10, 2016
@SilentGhost SilentGhost mannequin added extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir and removed interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Apr 10, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@gaogaotiantian
Copy link
Member

This is done in #120255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant