]> code.delx.au - gnu-emacs-elpa/blob - dbgr/debugger/pdb/pdb.el
Add stock Python debugger.
[gnu-emacs-elpa] / dbgr / debugger / pdb / pdb.el
1 ;;; Copyright (C) 2012 Rocky Bernstein <rocky@gnu.org>
2 ;; `pdb' Main interface to pdb via Emacs
3 (require 'load-relative)
4 (require-relative-list '("../../common/helper"
5 "../../common/track") "dbgr-")
6 (require-relative-list '("core" "track-mode") "dbgr-pdb-")
7
8 ;; This is needed, or at least the docstring part of it is needed to
9 ;; get the customization menu to work in Emacs 23.
10 (defgroup pdb nil
11 "The Python pdb debugger"
12 :group 'processes
13 :group 'dbgr
14 :group 'python
15 :version "23.1")
16
17 ;; -------------------------------------------------------------------
18 ;; User definable variables
19 ;;
20
21 (defcustom pdb-command-name
22 "pdb"
23 "File name for executing the stock Python debugger and command options.
24 This should be an executable on your path, or an absolute file name."
25 :type 'string
26 :group 'pdb)
27
28 (declare-function pdb-track-mode (bool))
29
30 ;; -------------------------------------------------------------------
31 ;; The end.
32 ;;
33
34 ;;;###autoload
35 (defun dbgr-pdb (&optional opt-command-line no-reset)
36 "Invoke the pdb Python debugger and start the Emacs user interface.
37
38 String COMMAND-LINE specifies how to run pdb.
39
40 Normally command buffers are reused when the same debugger is
41 reinvoked inside a command buffer with a similar command. If we
42 discover that the buffer has prior command-buffer information and
43 NO-RESET is nil, then that information which may point into other
44 buffers and source buffers which may contain marks and fringe or
45 marginal icons is reset."
46
47
48 (interactive)
49 (let* (
50 (cmd-str (or opt-command-line (pdb-query-cmdline
51 "pdb")))
52 (cmd-args (split-string-and-unquote cmd-str))
53 (parsed-args (pdb-parse-cmd-args cmd-args))
54 (script-args (cdr cmd-args))
55 (script-name (car script-args))
56 (cmd-buf))
57 (dbgr-run-process "pdb" script-name cmd-args
58 'pdb-track-mode no-reset)
59 )
60 )
61
62
63 (defalias 'pdb 'dbgr-pdb)
64
65 (provide-me "dbgr-")