Skip to content
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

Add argument checking on pdb commands #103464

Closed
gaogaotiantian opened this issue Apr 12, 2023 · 0 comments
Closed

Add argument checking on pdb commands #103464

gaogaotiantian opened this issue Apr 12, 2023 · 0 comments
Labels
type-feature A feature request or enhancement

Comments

@gaogaotiantian
Copy link
Member

gaogaotiantian commented Apr 12, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants