1 ;;; Copyright (C) 2010-2011, 2014 Rocky Bernstein <rocky@gnu.org>
2 ;; `realgud:gdb' Main interface to gdb via Emacs
3 (require 'load-relative)
4 (require-relative-list '("../../common/helper") "realgud-")
5 (require-relative-list '("core" "track-mode") "realgud:gdb-")
7 ;; This is needed, or at least the docstring part of it is needed to
8 ;; get the customization menu to work in Emacs 23.
9 (defgroup realgud:gdb nil
10 "The dbgr 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 ;; -------------------------------------------------------------------
40 (defun realgud:gdb (&optional opt-cmd-line no-reset)
41 "Invoke the gdb debugger and start the Emacs user interface.
43 OPT-CMD-LINE is treated like a shell string; arguments are
44 tokenized by `split-string-and-unquote'.
46 Normally, command buffers are reused when the same debugger is
47 reinvoked inside a command buffer with a similar command. If we
48 discover that the buffer has prior command-buffer information and
49 NO-RESET is nil, then that information which may point into other
50 buffers and source buffers which may contain marks and fringe or
51 marginal icons is reset. See `loc-changes-clear-buffer' to clear
52 fringe and marginal icons.
56 (let* ((cmd-str (or opt-cmd-line (realgud:gdb-query-cmdline "gdb")))
57 (cmd-args (split-string-and-unquote cmd-str))
58 (parsed-args (realgud:gdb-parse-cmd-args cmd-args))
59 (script-args (caddr parsed-args))
60 (script-name (car script-args))
62 (remove-if 'nil (list-utils-flatten parsed-args)))
63 (cmd-buf (realgud:run-process realgud:gdb-command-name
64 script-name parsed-cmd-args
65 'realgud:gdb-track-mode-hook nil))
68 (with-current-buffer cmd-buf
69 (realgud-command "set annotate 1" nil nil nil)
75 (provide-me "realgud-")
78 ;; byte-compile-warnings: (not cl-functions)