Skip to content

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

Closed

Description

@THRlWiTi
mannequin
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']

Activity

  1. THRlWiTi commented on Apr 10, 2016

    THRlWiTimannequin
    MannequinAuthor

    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.

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    and removed
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    on Apr 10, 2016
  3. transferred this issue fromon Apr 10, 2022
  4. gaogaotiantian commented on Feb 18, 2025

    @gaogaotiantian
    Member

    This is done in #120255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions