Skip to content

Add argument checking on pdb commands #103464

Description

@gaogaotiantian

Feature or enhancement

Add some argument checking on pdb commands so it is not ignored silently

Pitch

Currently for some pdb commands, we simply throw out provided arguments and proceed. This could confuse users. A super common case that I had (more than a few times) was this:

(Pdb) a = 1
(Pdb) 

Guess what it does? It lists all the arguments to the function(which was empty). The command succeeded (in a way the user would never expect) without any kind of warning.

Similar thing for step or next, which does not take any argument. gdb and some other debuggers provide a count for such commands, so people might do

(Pdb) step 3

And pdb just does a step. Normally the user would expect it does something different than step, but that's not the case. Of course it has the similar issue when the user does s = "abc" - surprise! the code goes forward!

We should catch these cases (and it's pretty cheap) and let the users know it's not the correct way to use the command (or for most cases, let them know that this IS actually a command).

So we could have something like:

(Pdb) a = 1
*** Invalid argument: = 1
      Usage: a(rgs)
(Pdb) step 3
*** Invalid argument: 3
      Usage: s(tep)
(Pdb) 

Linked PRs

Activity

  1. added a commit that references this issue on May 31, 2023
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

    type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions