From a4f3509e14515f37e96932ac88388367bc460e1f Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 29 Jul 2015 21:22:58 -0400 Subject: [PATCH] Add realgud:pdb-remote for remote kinds of pdb execution, e.g. telnet hostname port-number. This hasn't been tested. --- realgud/debugger/pdb/core.el | 27 ++++++++++++++++++++++++++- realgud/debugger/pdb/pdb.el | 28 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/realgud/debugger/pdb/core.el b/realgud/debugger/pdb/core.el index 36a76349..520c7c7a 100644 --- a/realgud/debugger/pdb/core.el +++ b/realgud/debugger/pdb/core.el @@ -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." @@ -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) diff --git a/realgud/debugger/pdb/pdb.el b/realgud/debugger/pdb/pdb.el index 5c643a3a..8fad6b98 100644 --- a/realgud/debugger/pdb/pdb.el +++ b/realgud/debugger/pdb/pdb.el @@ -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-")