1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-13 09:32:47 +00:00

(gdb-signalled): New variable and function.

(gdb-debug-log-ring): Rename from gdb-debug-log and make a ring.
(gdb-send, gdb-send-item, gud-gdba-marker-filter): Use it.
(gdb-debug-log-length): Customize it's length.
(gud-watch, gdb-var-create-handler): Display function::var format
but don't use to create variable object.
(gdb-var-create-handler): Use message-box in place of message.
(gdb-stopped): Call gdb-exited if signalled.
This commit is contained in:
Nick Roberts 2006-02-22 22:01:35 +00:00
parent 039374381c
commit e75116edb6

View File

@ -123,6 +123,7 @@ and #define directives otherwise.")
(defvar gdb-macro-info nil
"Non-nil if GDB knows that the inferior includes preprocessor macro info.")
(defvar gdb-buffer-fringe-width nil)
(defvar gdb-signalled nil)
(defvar gdb-buffer-type nil
"One of the symbols bound in `gdb-buffer-rules'.")
@ -258,11 +259,20 @@ detailed description of this mode.
(gdb command-line)
(gdb-init-1))
(defvar gdb-debug-log nil)
(defcustom gdb-debug-log-length 128
"Length of `gdb-debug-log-ring'."
:group 'gud
:type 'integer
:version "22.1")
(defvar gdb-debug-log-ring (make-ring gdb-debug-log-length)
"Ring of commands sent to and replies received from GDB.
This variable is used to debug GDB-UI. Just need most recent
messages and a ring limits the size.")
;;;###autoload
(defcustom gdb-enable-debug-log nil
"Non-nil means record the process input and output in `gdb-debug-log'."
"Non-nil means record the process input and output in `gdb-debug-log-ring'."
:type 'boolean
:group 'gud
:version "22.1")
@ -390,7 +400,6 @@ With arg, use separate IO iff arg is positive."
expr))
(defun gdb-init-1 ()
(setq gdb-debug-log nil)
(set (make-local-variable 'gud-minor-mode) 'gdba)
(set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
;;
@ -469,14 +478,15 @@ With arg, use separate IO iff arg is positive."
gdb-source-file-list nil
gdb-error nil
gdb-macro-info nil
gdb-buffer-fringe-width (car (window-fringes)))
gdb-buffer-fringe-width (car (window-fringes))
gdb-debug-log-ring (make-ring gdb-debug-log-length)
gdb-signalled nil)
(setq gdb-buffer-type 'gdba)
(if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4)
(setq gdb-version nil)
(gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
'gdb-get-version)))
@ -573,9 +583,6 @@ With arg, automatically raise speedbar iff arg is positive."
(require 'tooltip)
(save-selected-window
(let ((expr (tooltip-identifier-from-point (point))))
(if (and (string-equal gdb-current-language "c")
gdb-use-colon-colon-notation gdb-selected-frame)
(setq expr (concat gdb-selected-frame "::" expr)))
(catch 'already-watched
(dolist (var gdb-var-list)
(if (string-equal expr (car var)) (throw 'already-watched nil)))
@ -593,11 +600,15 @@ With arg, automatically raise speedbar iff arg is positive."
(defun gdb-var-create-handler (expr)
(goto-char (point-min))
(if (re-search-forward gdb-var-create-regexp nil t)
(let ((var (list expr
(match-string 1)
(match-string 2)
(match-string 3)
nil nil)))
(let ((var (list
(if (and (string-equal gdb-current-language "c")
gdb-use-colon-colon-notation gdb-selected-frame)
(setq expr (concat gdb-selected-frame "::" expr))
expr)
(match-string 1)
(match-string 2)
(match-string 3)
nil nil)))
(push var gdb-var-list)
(speedbar 1)
(unless (string-equal
@ -613,7 +624,7 @@ With arg, automatically raise speedbar iff arg is positive."
,(nth 1 var) nil)))))
(if (search-forward "Undefined command" nil t)
(message-box "Watching expressions requires gdb 6.0 onwards")
(message "No symbol \"%s\" in current context." expr))))
(message-box "No symbol \"%s\" in current context." expr))))
(defun gdb-var-evaluate-expression-handler (varnum changed)
(goto-char (point-min))
@ -864,7 +875,7 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'."
"*"))
(defun gdb-display-separate-io-buffer ()
"Display IO of inferior in a separate window."
"Display IO of debugged program in a separate window."
(interactive)
(if gdb-use-separate-io-buffer
(gdb-display-buffer
@ -963,7 +974,7 @@ This filter may simply queue input for a later time."
(let ((item (concat string "\n")))
(if gud-running
(progn
(if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log))
(if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log-ring))
(process-send-string proc item))
(gdb-enqueue-input item))))
@ -986,7 +997,8 @@ This filter may simply queue input for a later time."
(defun gdb-send-item (item)
(setq gdb-flush-pending-output nil)
(if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log))
(if gdb-enable-debug-log
(ring-insert gdb-debug-log-ring (cons 'send-item item)))
(setq gdb-current-item item)
(let ((process (get-buffer-process gud-comint-buffer)))
(if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
@ -1039,7 +1051,7 @@ This filter may simply queue input for a later time."
("source" gdb-source)
("starting" gdb-starting)
("exited" gdb-exited)
("signalled" gdb-exited)
("signalled" gdb-signalled)
("signal" gdb-stopping)
("breakpoint" gdb-stopping)
("watchpoint" gdb-stopping)
@ -1156,6 +1168,9 @@ directives."
(setq gdb-overlay-arrow-position nil)
(gdb-stopping ignored))
(defun gdb-signalled (ignored)
(setq gdb-signalled t))
(defun gdb-frame-begin (ignored)
(let ((sink gdb-output-sink))
(cond
@ -1172,7 +1187,6 @@ directives."
It is just like `gdb-stopping', except that if we already set the output
sink to `user' in `gdb-stopping', that is fine."
(setq gud-running nil)
(setq gdb-active-process t)
(let ((sink gdb-output-sink))
(cond
((eq sink 'inferior)
@ -1180,7 +1194,8 @@ sink to `user' in `gdb-stopping', that is fine."
((eq sink 'user) t)
(t
(gdb-resync)
(error "Unexpected stopped annotation")))))
(error "Unexpected stopped annotation"))))
(if gdb-signalled (gdb-exited ignored)))
(defun gdb-error (ignored)
(setq gdb-error (not gdb-error)))
@ -1233,7 +1248,8 @@ happens to be appropriate."
"A gud marker filter for gdb. Handle a burst of output from GDB."
(if gdb-flush-pending-output
nil
(if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
(if gdb-enable-debug-log
(ring-insert gdb-debug-log-ring (cons 'recv string)))
;; Recall the left over gud-marker-acc from last time.
(setq gud-marker-acc (concat gud-marker-acc string))
;; Start accumulating output for the GUD buffer.