2

realgud seems to want to guess the path of the second argument of the command supplied to M-x pdb (or M-x realgud:pdb). When I'm visiting a buffer in /some/path/foo.py, without realgud:

(hiding the long docker command here -- the ... should be understood to mean the rest of the middle of that long command)

M-x pdb
Run pdb (like this): docker run ... some_test
# Command supplied is run

with realgud:

M-x pdb
Run pdb (like this): docker run ... some_test
# Output:
Current directory: /some/path/
Command: docker /some/path/run ... some_test
docker: '/some/path/run' is not a docker command.
See 'docker --help'.

Process pdb exited abnormally with code 127

That of course immediately fails, because run here is not the path of some program, but an argument to docker. Why does realgud think it knows this, and how can I prevent it from doing that?

realgud:trepan2 doesn't suffer from this problem, and neither does plain old M-x pdb when realgud is not installed, so it seems it's not fundamantal.

Croad Langshan
  • 3,192
  • 14
  • 42

1 Answers1

1

I'm not sure I fully understand, let alone can reproduce, your kind of specific situation. It is a more unusual way to invoke pdb. More context in what you are doing might be useful.

However, the underlying elisp function you want to run is something like this:

(realgud:run-process "pdb" "/usr/bin/pdb" '("pdb" "foo") realgud:pdb-minibuffer-history)

The first argument "pdb" sets how realgud sets up debugger settings to use in order to interpret subsequent interaction with the debugger.

The second argument "/usr/bin/pdb", gives the specific debugger script to run.

The 3rd argument '("pdb" "foo") gives the command and arguments used to invoke the debugger.

The 4th argument realgud:pdb-minibuf-history will store the invocation (if successful) in the history of pdb invocations.

Let me explain a little bit about the motivation for why realgud does what it does.

When you run a debugger like pdb, realgud in contrast to gud, makes an attempt to sort the specific debugger options, e.g to pdb, from the debugged script options. In other words it parses what you type; undoubtedly that parsing is failing here.

Why does it try to parse the full debugger command? In some cases the debugger options may get filtered or expanded upon. For example for gdb we need to add option --annotation-level=2; realgud would like to know the script name and short debugger name so that it can use that in creating the command buffer.

Finally, if you feel there is a problem with realgud, open a github issue.

rocky
  • 888
  • 7
  • 26