aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2006-02-23 07:38:57 +0000
committerNick Roberts2006-02-23 07:38:57 +0000
commita5de75080d6a10a8c357d183f9ba3da5c33dce2a (patch)
treeceb49afc4933b283c6cde3386b49fbd0f06e6916
parente490594672fa5f269caa57360a13414bb1188354 (diff)
downloademacs-a5de75080d6a10a8c357d183f9ba3da5c33dce2a.tar.gz
emacs-a5de75080d6a10a8c357d183f9ba3da5c33dce2a.zip
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
(gdb-debug-ring): Rename from gdb-debug-log-ring. Don't make it a real ring but... (gud-gdba-marker-filter): ...make it work like mark-ring. (gdb-enable-debug): Rename from gdb-enable-debug-log. (gdb-mouse-jump): New function. Add bindings.
-rw-r--r--lisp/progmodes/gdb-ui.el78
1 files changed, 62 insertions, 16 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 7e0cda786c7..db79d43d321 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -259,20 +259,19 @@ detailed description of this mode.
259 (gdb command-line) 259 (gdb command-line)
260 (gdb-init-1)) 260 (gdb-init-1))
261 261
262(defcustom gdb-debug-log-length 128 262(defcustom gdb-debug-ring-max 128
263 "Length of `gdb-debug-log-ring'." 263 "Maximum size of `gdb-debug-ring'."
264 :group 'gud 264 :group 'gud
265 :type 'integer 265 :type 'integer
266 :version "22.1") 266 :version "22.1")
267 267
268(defvar gdb-debug-log-ring (make-ring gdb-debug-log-length) 268(defvar gdb-debug-ring nil
269 "Ring of commands sent to and replies received from GDB. 269 "List of commands, most recent first, sent to and replies received from GDB.
270This variable is used to debug GDB-UI. Just need most recent 270This variable is used to debug GDB-UI.")
271messages and a ring limits the size.")
272 271
273;;;###autoload 272;;;###autoload
274(defcustom gdb-enable-debug-log nil 273(defcustom gdb-enable-debug nil
275 "Non-nil means record the process input and output in `gdb-debug-log-ring'." 274 "Non-nil means record the process input and output in `gdb-debug-ring'."
276 :type 'boolean 275 :type 'boolean
277 :group 'gud 276 :group 'gud
278 :version "22.1") 277 :version "22.1")
@@ -445,11 +444,21 @@ With arg, use separate IO iff arg is positive."
445 'gdb-mouse-set-clear-breakpoint) 444 'gdb-mouse-set-clear-breakpoint)
446 (define-key gud-minor-mode-map [left-fringe mouse-2] 445 (define-key gud-minor-mode-map [left-fringe mouse-2]
447 'gdb-mouse-until) 446 'gdb-mouse-until)
447 (define-key gud-minor-mode-map [left-margin drag-mouse-1]
448 'gdb-mouse-until)
448 (define-key gud-minor-mode-map [left-fringe drag-mouse-1] 449 (define-key gud-minor-mode-map [left-fringe drag-mouse-1]
449 'gdb-mouse-until) 450 'gdb-mouse-until)
450 (define-key gud-minor-mode-map [left-margin mouse-2] 451 (define-key gud-minor-mode-map [left-margin mouse-2]
451 'gdb-mouse-until) 452 'gdb-mouse-until)
452 (define-key gud-minor-mode-map [left-margin mouse-3] 453 (define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
454 'gdb-mouse-jump)
455 (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
456 'gdb-mouse-jump)
457 (define-key gud-minor-mode-map [left-fringe C-mouse-2]
458 'gdb-mouse-jump)
459 (define-key gud-minor-mode-map [left-margin C-mouse-2]
460 'gdb-mouse-jump)
461 (define-key gud-minor-mode-map [left-margin mouse-3]
453 'gdb-mouse-toggle-breakpoint-margin) 462 'gdb-mouse-toggle-breakpoint-margin)
454 (define-key gud-minor-mode-map [left-fringe mouse-3] 463 (define-key gud-minor-mode-map [left-fringe mouse-3]
455 'gdb-mouse-toggle-breakpoint-fringe) 464 'gdb-mouse-toggle-breakpoint-fringe)
@@ -479,7 +488,7 @@ With arg, use separate IO iff arg is positive."
479 gdb-error nil 488 gdb-error nil
480 gdb-macro-info nil 489 gdb-macro-info nil
481 gdb-buffer-fringe-width (car (window-fringes)) 490 gdb-buffer-fringe-width (car (window-fringes))
482 gdb-debug-log-ring (make-ring gdb-debug-log-length) 491 gdb-debug-ring nil
483 gdb-signalled nil) 492 gdb-signalled nil)
484 493
485 (setq gdb-buffer-type 'gdba) 494 (setq gdb-buffer-type 'gdba)
@@ -526,7 +535,9 @@ With arg, use separate IO iff arg is positive."
526 (gdb-init-2)) 535 (gdb-init-2))
527 536
528(defun gdb-mouse-until (event) 537(defun gdb-mouse-until (event)
529 "Execute source lines by dragging the overlay arrow (fringe) with the mouse." 538 "Continue running until a source line past the current line.
539The destination source line can be selected either by clicking with mouse-2
540on the fringe/margin or dragging the arrow with mouse-1 (default bindings)."
530 (interactive "e") 541 (interactive "e")
531 (if gud-overlay-arrow-position 542 (if gud-overlay-arrow-position
532 (let ((start (event-start event)) 543 (let ((start (event-start event))
@@ -552,6 +563,40 @@ With arg, use separate IO iff arg is positive."
552 (forward-char 2) 563 (forward-char 2)
553 (gud-call (concat "until *%a"))))))))) 564 (gud-call (concat "until *%a")))))))))
554 565
566(defun gdb-mouse-jump (event)
567 "Set execution address/line.
568The destination source line can be selected either by clicking with mouse-2
569on the fringe/margin or dragging the arrow with mouse-1 (default bindings).
570Unlike gdb-mouse-until the destination address can be before the current
571line, and no execution takes place."
572 (interactive "e")
573 (if gud-overlay-arrow-position
574 (let ((start (event-start event))
575 (end (event-end event))
576 (buffer (marker-buffer gud-overlay-arrow-position)) (line))
577 (if (not (string-match "Machine" mode-name))
578 (if (equal buffer (window-buffer (posn-window end)))
579 (with-current-buffer buffer
580 (when (or (equal start end)
581 (equal (posn-point start)
582 (marker-position
583 gud-overlay-arrow-position)))
584 (setq line (line-number-at-pos (posn-point end)))
585 (progn (gud-call (concat "tbreak " (number-to-string line)))
586 (gud-call (concat "jump " (number-to-string line)))))))
587 (if (equal (marker-buffer gdb-overlay-arrow-position)
588 (window-buffer (posn-window end)))
589 (when (or (equal start end)
590 (equal (posn-point start)
591 (marker-position
592 gdb-overlay-arrow-position)))
593 (save-excursion
594 (goto-line (line-number-at-pos (posn-point end)))
595 (forward-char 2)
596 (progn
597 (gud-call (concat "tbreak *%a"))
598 (gud-call (concat "jump *%a"))))))))))
599
555(defcustom gdb-speedbar-auto-raise nil 600(defcustom gdb-speedbar-auto-raise nil
556 "If non-nil raise speedbar every time display of watch expressions is\ 601 "If non-nil raise speedbar every time display of watch expressions is\
557 updated." 602 updated."
@@ -974,7 +1019,7 @@ This filter may simply queue input for a later time."
974 (let ((item (concat string "\n"))) 1019 (let ((item (concat string "\n")))
975 (if gud-running 1020 (if gud-running
976 (progn 1021 (progn
977 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log-ring)) 1022 (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring))
978 (process-send-string proc item)) 1023 (process-send-string proc item))
979 (gdb-enqueue-input item)))) 1024 (gdb-enqueue-input item))))
980 1025
@@ -997,8 +1042,7 @@ This filter may simply queue input for a later time."
997 1042
998(defun gdb-send-item (item) 1043(defun gdb-send-item (item)
999 (setq gdb-flush-pending-output nil) 1044 (setq gdb-flush-pending-output nil)
1000 (if gdb-enable-debug-log 1045 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-ring))
1001 (ring-insert gdb-debug-log-ring (cons 'send-item item)))
1002 (setq gdb-current-item item) 1046 (setq gdb-current-item item)
1003 (let ((process (get-buffer-process gud-comint-buffer))) 1047 (let ((process (get-buffer-process gud-comint-buffer)))
1004 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) 1048 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
@@ -1248,8 +1292,10 @@ happens to be appropriate."
1248 "A gud marker filter for gdb. Handle a burst of output from GDB." 1292 "A gud marker filter for gdb. Handle a burst of output from GDB."
1249 (if gdb-flush-pending-output 1293 (if gdb-flush-pending-output
1250 nil 1294 nil
1251 (if gdb-enable-debug-log 1295 (when gdb-enable-debug
1252 (ring-insert gdb-debug-log-ring (cons 'recv string))) 1296 (push (cons 'recv string) gdb-debug-ring)
1297 (if (> (length gdb-debug-ring) gdb-debug-ring-max)
1298 (setcdr (nthcdr (1- gdb-debug-ring-max) gdb-debug-ring) nil)))
1253 ;; Recall the left over gud-marker-acc from last time. 1299 ;; Recall the left over gud-marker-acc from last time.
1254 (setq gud-marker-acc (concat gud-marker-acc string)) 1300 (setq gud-marker-acc (concat gud-marker-acc string))
1255 ;; Start accumulating output for the GUD buffer. 1301 ;; Start accumulating output for the GUD buffer.