Skip to content

Commit

Permalink
Add realgud:pdb-remote for remote kinds of pdb execution, e.g. telnet
Browse files Browse the repository at this point in the history
hostname port-number. This hasn't been tested.
  • Loading branch information
rocky committed Jul 30, 2015
1 parent e5d0f95 commit a4f3509
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
27 changes: 26 additions & 1 deletion realgud/debugger/pdb/core.el
Expand Up @@ -36,6 +36,9 @@
(defvar realgud:pdb-minibuffer-history nil
"minibuffer history list for the command `pdb'.")

(defvar realgud:pdb-remote-minibuffer-history nil
"minibuffer history list for the command `pdb-remote'.")

(easy-mmode-defmap pdb-minibuffer-local-map
'(("\C-i" . comint-dynamic-complete-filename))
"Keymap for minibuffer prompting of gud startup command."
Expand Down Expand Up @@ -142,7 +145,29 @@ Note that the script name path has been expanded via `expand-file-name'.
)))
(list interpreter-args debugger-args script-args annotate-p))))

;; To silence Warning: reference to free variable
(defun pdb-parse-remote-cmd-args (orig-args)
"Parse command line ORIG-ARGS
ORIG-ARGS should contain a tokenized list of the command line to run.
We return the a list containing:
* the command processor (e.g. python) and it's arguments if any - a list of strings
* the name of the debugger given (e.g. pdb) and its arguments - a list of strings
* the script name and its arguments - list of strings
* nil
For example for the following input:
(map 'list 'symbol-name
'(telnet localhost 6900))
we might return:
((\"telnet\" \"localhost\" \"6900\") (\"pdb\") (\"\") nil)
Note that the script name path has been expanded via `expand-file-name'.
"
(list orig-args '("pdb") '("") nil)
)

;; To silence Warning: reference to free variable
(defvar realgud:pdb-command-name)

(defun pdb-suggest-invocation (debugger-name)
Expand Down
28 changes: 28 additions & 0 deletions realgud/debugger/pdb/pdb.el
Expand Up @@ -75,6 +75,34 @@ fringe and marginal icons.
)


;;;###autoload
(defun realgud:pdb-remote (&optional opt-cmd-line no-reset)
"Invoke the pdb Python debugger and start the Emacs user interface.
String OPT-CMD-LINE specifies how to run pdb. You will be prompted
for a command line is one isn't supplied.
OPT-COMMAND-LINE is treated like a shell string; arguments are
tokenized by `split-string-and-unquote'. The tokenized string is
parsed by `pdb-parse-remote-cmd-args' and path elements found by that
are expanded using `realgud:expand-file-name-if-exists'.
Normally, command buffers are reused when the same debugger is
reinvoked inside a command buffer with a similar command. If we
discover that the buffer has prior command-buffer information and
NO-RESET is nil, then that information which may point into other
buffers and source buffers which may contain marks and fringe or
marginal icons is reset. See `loc-changes-clear-buffer' to clear
fringe and marginal icons.
"
(interactive)
(realgud:run-debugger "pdb" 'pdb-remote-query-cmdline
'pdb-parse-remote-cmd-args
'realgud:pdb-remote-minibuffer-history
opt-cmd-line no-reset)
)


(defalias 'pdb 'realgud:pdb)

(provide-me "realgud-")

0 comments on commit a4f3509

Please sign in to comment.