1 ;;; Copyright (C) 2010-2011, 2014-2015 Rocky Bernstein <rocky@gnu.org>
2 ;; `realgud:gdb' Main interface to gdb via Emacs
5 (require 'load-relative)
6 (require-relative-list '("../../common/helper" "../../common/utils")
8 (require-relative-list '("core" "track-mode") "realgud:gdb-")
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"
17 ;; -------------------------------------------------------------------
18 ;; User definable variables
21 (defcustom realgud:gdb-command-name
24 "File name for executing the and command options.
25 This should be an executable on your path, or an absolute file name."
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)
36 ;; -------------------------------------------------------------------
41 (defun realgud:gdb (&optional opt-cmd-line no-reset)
42 "Invoke the gdb debugger and start the Emacs user interface.
44 OPT-CMD-LINE is treated like a shell string; arguments are
45 tokenized by `split-string-and-unquote'.
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.
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))
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
70 (with-current-buffer cmd-buf
71 (realgud-command "set annotate 1" nil nil nil)
77 (provide-me "realgud-")
80 ;; byte-compile-warnings: (not cl-functions)