]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/realgud/debugger/gdb/gdb.el
3f2994afd98f77d76b1fa682c5dc7fb8c97a0edc
[gnu-emacs-elpa] / packages / realgud / realgud / debugger / gdb / gdb.el
1 ;;; Copyright (C) 2010-2011, 2014-2015 Rocky Bernstein <rocky@gnu.org>
2 ;; `realgud:gdb' Main interface to gdb via Emacs
3 (require 'cl)
4 (require 'list-utils)
5 (require 'load-relative)
6 (require-relative-list '("../../common/helper" "../../common/utils")
7 "realgud-")
8 (require-relative-list '("core" "track-mode") "realgud:gdb-")
9
10 ;; This is needed, or at least the docstring part of it is needed to
11 ;; get the customization menu to work in Emacs 24.
12 (defgroup realgud:gdb nil
13 "The realgud interface to gdb"
14 :group 'realgud
15 :version "24.1")
16
17 ;; -------------------------------------------------------------------
18 ;; User definable variables
19 ;;
20
21 (defcustom realgud:gdb-command-name
22 ;;"gdb --emacs 3"
23 "gdb"
24 "File name for executing the and command options.
25 This should be an executable on your path, or an absolute file name."
26 :type 'string
27 :group 'realgud:gdb)
28
29 (declare-function realgud:gdb-track-mode 'realgud:gdb-track-mode)
30 (declare-function realgud-command 'realgud:gdb-core)
31 (declare-function realgud:gdb-parse-cmd-args 'realgud:gdb-core)
32 (declare-function realgud:gdb-query-cmdline 'realgud:gdb-core)
33 (declare-function realgud:run-process 'realgud-core)
34 (declare-function realgud:flatten 'realgud-utils)
35
36 ;; -------------------------------------------------------------------
37 ;; The end.
38 ;;
39
40 ;;;###autoload
41 (defun realgud:gdb (&optional opt-cmd-line no-reset)
42 "Invoke the gdb debugger and start the Emacs user interface.
43
44 OPT-CMD-LINE is treated like a shell string; arguments are
45 tokenized by `split-string-and-unquote'.
46
47 Normally, command buffers are reused when the same debugger is
48 reinvoked inside a command buffer with a similar command. If we
49 discover that the buffer has prior command-buffer information and
50 NO-RESET is nil, then that information which may point into other
51 buffers and source buffers which may contain marks and fringe or
52 marginal icons is reset. See `loc-changes-clear-buffer' to clear
53 fringe and marginal icons.
54 "
55
56 (interactive)
57 (let* ((cmd-str (or opt-cmd-line (realgud:gdb-query-cmdline "gdb")))
58 (cmd-args (split-string-and-unquote cmd-str))
59 (parsed-args (realgud:gdb-parse-cmd-args cmd-args))
60 (script-args (caddr parsed-args))
61 (script-name (car script-args))
62 (parsed-cmd-args
63 (cl-remove-if 'nil (realgud:flatten parsed-args)))
64 (cmd-buf (realgud:run-process realgud:gdb-command-name
65 script-name parsed-cmd-args
66 'realgud:gdb-minibuffer-history
67 nil))
68 )
69 (if cmd-buf
70 (with-current-buffer cmd-buf
71 (realgud-command "set annotate 1" nil nil nil)
72 )
73 )
74 )
75 )
76
77 (provide-me "realgud-")
78
79 ;; Local Variables:
80 ;; byte-compile-warnings: (not cl-functions)
81 ;; End: