1 ;;; Copyright (C) 2010-2011, 2014 Rocky Bernstein <rocky@gnu.org>
2 ;; `realgud:gdb' Main interface to gdb via Emacs
5 (require 'load-relative)
6 (require-relative-list '("../../common/helper") "realgud-")
7 (require-relative-list '("core" "track-mode") "realgud:gdb-")
9 ;; This is needed, or at least the docstring part of it is needed to
10 ;; get the customization menu to work in Emacs 24.
11 (defgroup realgud:gdb nil
12 "The realgud interface to gdb"
16 ;; -------------------------------------------------------------------
17 ;; User definable variables
20 (defcustom realgud:gdb-command-name
23 "File name for executing the Ruby debugger and command options.
24 This should be an executable on your path, or an absolute file name."
28 (declare-function realgud:gdb-track-mode 'realgud:gdb-track-mode)
29 (declare-function realgud-command 'realgud:gdb-core)
30 (declare-function realgud:gdb-parse-cmd-args 'realgud:gdb-core)
31 (declare-function realgud:gdb-query-cmdline 'realgud:gdb-core)
32 (declare-function realgud:run-process 'realgud-core)
34 ;; -------------------------------------------------------------------
39 (defun realgud:gdb (&optional opt-cmd-line no-reset)
40 "Invoke the gdb debugger and start the Emacs user interface.
42 OPT-CMD-LINE is treated like a shell string; arguments are
43 tokenized by `split-string-and-unquote'.
45 Normally, command buffers are reused when the same debugger is
46 reinvoked inside a command buffer with a similar command. If we
47 discover that the buffer has prior command-buffer information and
48 NO-RESET is nil, then that information which may point into other
49 buffers and source buffers which may contain marks and fringe or
50 marginal icons is reset. See `loc-changes-clear-buffer' to clear
51 fringe and marginal icons.
55 (let* ((cmd-str (or opt-cmd-line (realgud:gdb-query-cmdline "gdb")))
56 (cmd-args (split-string-and-unquote cmd-str))
57 (parsed-args (realgud:gdb-parse-cmd-args cmd-args))
58 (script-args (caddr parsed-args))
59 (script-name (car script-args))
61 (cl-remove-if 'nil (list-utils-flatten parsed-args)))
62 (cmd-buf (realgud:run-process realgud:gdb-command-name
63 script-name parsed-cmd-args
64 'realgud:gdb-track-mode-hook
65 'realgud:gdb-minibuffer-history
69 (with-current-buffer cmd-buf
70 (realgud-command "set annotate 1" nil nil nil)
76 (provide-me "realgud-")
79 ;; byte-compile-warnings: (not cl-functions)