comparison lisp/progmodes/gdb-ui.el @ 83480:3cc2ba972850

Merged from Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-116 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-117 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-118 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-119 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-38 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-39 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-520
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 24 Feb 2006 13:44:56 +0000
parents 856efda75a1b 8ff0077b3342
children 8976b9f5eda1
comparison
equal deleted inserted replaced
83479:b0c0309b2727 83480:3cc2ba972850
257 ;; 257 ;;
258 ;; Let's start with a basic gud-gdb buffer and then modify it a bit. 258 ;; Let's start with a basic gud-gdb buffer and then modify it a bit.
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.
270 This variable is used to debug GDB-UI. Just need most recent 270 This variable is used to debug GDB-UI.")
271 messages 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")
279 278
280 (defcustom gdb-cpp-define-alist-program "gcc -E -dM -" 279 (defcustom gdb-cpp-define-alist-program "gcc -E -dM -"
443 'gdb-mouse-set-clear-breakpoint) 442 'gdb-mouse-set-clear-breakpoint)
444 (define-key gud-minor-mode-map [left-fringe mouse-1] 443 (define-key gud-minor-mode-map [left-fringe mouse-1]
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)
456 465
457 (setq comint-input-sender 'gdb-send) 466 (setq comint-input-sender 'gdb-send)
477 gdb-location-alist nil 486 gdb-location-alist nil
478 gdb-source-file-list nil 487 gdb-source-file-list nil
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)
486 495
487 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io)) 496 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
524 (setq gdb-version "pre-6.4") 533 (setq gdb-version "pre-6.4")
525 (setq gdb-version "6.4+")) 534 (setq gdb-version "6.4+"))
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.
539 The destination source line can be selected either by clicking with mouse-2
540 on 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))
533 (end (event-end event)) 544 (end (event-end event))
534 (buffer (marker-buffer gud-overlay-arrow-position)) (line)) 545 (buffer (marker-buffer gud-overlay-arrow-position)) (line))
549 gdb-overlay-arrow-position))) 560 gdb-overlay-arrow-position)))
550 (save-excursion 561 (save-excursion
551 (goto-line (line-number-at-pos (posn-point end))) 562 (goto-line (line-number-at-pos (posn-point end)))
552 (forward-char 2) 563 (forward-char 2)
553 (gud-call (concat "until *%a"))))))))) 564 (gud-call (concat "until *%a")))))))))
565
566 (defun gdb-mouse-jump (event)
567 "Set execution address/line.
568 The destination source line can be selected either by clicking with mouse-2
569 on the fringe/margin or dragging the arrow with mouse-1 (default bindings).
570 Unlike gdb-mouse-until the destination address can be before the current
571 line, 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"))))))))))
554 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."
558 :type 'boolean 603 :type 'boolean
972 (let ((inhibit-read-only t)) 1017 (let ((inhibit-read-only t))
973 (remove-text-properties (point-min) (point-max) '(face)))) 1018 (remove-text-properties (point-min) (point-max) '(face))))
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
981 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it 1026 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it
982 ;; is a query, or other non-top-level prompt. 1027 ;; is a query, or other non-top-level prompt.
995 (unless (nbutlast queue) (setq gdb-input-queue '())) 1040 (unless (nbutlast queue) (setq gdb-input-queue '()))
996 last)))) 1041 last))))
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)
1005 (if (stringp item) 1049 (if (stringp item)
1006 (progn 1050 (progn
1246 1290
1247 (defun gud-gdba-marker-filter (string) 1291 (defun gud-gdba-marker-filter (string)
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.
1256 (let ((output "")) 1302 (let ((output ""))
1257 ;; 1303 ;;