Mercurial > emacs
comparison lisp/progmodes/gdb-ui.el @ 75714:9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
work when there is just an assembler buffer (no source buffer).
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Wed, 07 Feb 2007 21:12:52 +0000 |
parents | cb2393a69028 |
children | 8bfa58061d79 |
comparison
equal
deleted
inserted
replaced
75713:f0eb82656af7 | 75714:9ed49c89489b |
---|---|
609 (defun gdb-mouse-until (event) | 609 (defun gdb-mouse-until (event) |
610 "Continue running until a source line past the current line. | 610 "Continue running until a source line past the current line. |
611 The destination source line can be selected either by clicking with mouse-2 | 611 The destination source line can be selected either by clicking with mouse-2 |
612 on the fringe/margin or dragging the arrow with mouse-1 (default bindings)." | 612 on the fringe/margin or dragging the arrow with mouse-1 (default bindings)." |
613 (interactive "e") | 613 (interactive "e") |
614 (if gud-overlay-arrow-position | 614 (let ((start (event-start event)) |
615 (let ((start (event-start event)) | 615 (end (event-end event))) |
616 (end (event-end event)) | 616 (if gud-overlay-arrow-position |
617 (buffer (marker-buffer gud-overlay-arrow-position)) (line)) | 617 (let ((buffer (marker-buffer gud-overlay-arrow-position)) (line)) |
618 (if (not (string-match "Machine" mode-name)) | 618 (if (equal buffer (window-buffer (posn-window end))) |
619 (if (equal buffer (window-buffer (posn-window end))) | 619 (with-current-buffer buffer |
620 (with-current-buffer buffer | 620 (when (or (equal start end) |
621 (when (or (equal start end) | 621 (equal (posn-point start) |
622 (equal (posn-point start) | 622 (marker-position |
623 (marker-position | 623 gud-overlay-arrow-position))) |
624 gud-overlay-arrow-position))) | 624 (setq line (line-number-at-pos (posn-point end))) |
625 (setq line (line-number-at-pos (posn-point end))) | 625 (gud-call (concat "until " (number-to-string line)))))))) |
626 (gud-call (concat "until " (number-to-string line)))))) | 626 (if gdb-overlay-arrow-position |
627 (if (equal (marker-buffer gdb-overlay-arrow-position) | 627 (let ((buffer (marker-buffer gdb-overlay-arrow-position))) |
628 (window-buffer (posn-window end))) | 628 (if (equal buffer (window-buffer (posn-window end))) |
629 (when (or (equal start end) | 629 (with-current-buffer buffer |
630 (equal (posn-point start) | 630 (when (or (equal start end) |
631 (marker-position | 631 (equal (posn-point start) |
632 gdb-overlay-arrow-position))) | 632 (marker-position |
633 (save-excursion | 633 gdb-overlay-arrow-position))) |
634 (goto-line (line-number-at-pos (posn-point end))) | 634 (save-excursion |
635 (forward-char 2) | 635 (goto-line (line-number-at-pos (posn-point end))) |
636 (gud-call (concat "until *%a"))))))))) | 636 (forward-char 2) |
637 (gud-call (concat "until *%a")))))))))) | |
637 | 638 |
638 (defun gdb-mouse-jump (event) | 639 (defun gdb-mouse-jump (event) |
639 "Set execution address/line. | 640 "Set execution address/line. |
640 The destination source line can be selected either by clicking with mouse-2 | 641 The destination source line can be selected either by clicking with mouse-2 |
641 on the fringe/margin or dragging the arrow with mouse-1 (default bindings). | 642 on the fringe/margin or dragging the arrow with mouse-1 (default bindings). |
642 Unlike gdb-mouse-until the destination address can be before the current | 643 Unlike gdb-mouse-until the destination address can be before the current |
643 line, and no execution takes place." | 644 line, and no execution takes place." |
644 (interactive "e") | 645 (interactive "e") |
645 (if gud-overlay-arrow-position | 646 (let ((start (event-start event)) |
646 (let ((start (event-start event)) | 647 (end (event-end event))) |
647 (end (event-end event)) | 648 (if gud-overlay-arrow-position |
648 (buffer (marker-buffer gud-overlay-arrow-position)) (line)) | 649 (let ((buffer (marker-buffer gud-overlay-arrow-position)) (line)) |
649 (if (not (string-match "Machine" mode-name)) | 650 (if (equal buffer (window-buffer (posn-window end))) |
650 (if (equal buffer (window-buffer (posn-window end))) | 651 (with-current-buffer buffer |
651 (with-current-buffer buffer | 652 (when (or (equal start end) |
652 (when (or (equal start end) | 653 (equal (posn-point start) |
653 (equal (posn-point start) | 654 (marker-position |
654 (marker-position | 655 gud-overlay-arrow-position))) |
655 gud-overlay-arrow-position))) | 656 (setq line (line-number-at-pos (posn-point end))) |
656 (setq line (line-number-at-pos (posn-point end))) | |
657 (progn (gud-call (concat "tbreak " (number-to-string line))) | |
658 (gud-call (concat "jump " (number-to-string line))))))) | |
659 (if (equal (marker-buffer gdb-overlay-arrow-position) | |
660 (window-buffer (posn-window end))) | |
661 (when (or (equal start end) | |
662 (equal (posn-point start) | |
663 (marker-position | |
664 gdb-overlay-arrow-position))) | |
665 (save-excursion | |
666 (goto-line (line-number-at-pos (posn-point end))) | |
667 (forward-char 2) | |
668 (progn | 657 (progn |
669 (gud-call (concat "tbreak *%a")) | 658 (gud-call (concat "tbreak " (number-to-string line))) |
670 (gud-call (concat "jump *%a")))))))))) | 659 (gud-call (concat "jump " (number-to-string line))))))))) |
660 (if gdb-overlay-arrow-position | |
661 (let ((buffer (marker-buffer gdb-overlay-arrow-position))) | |
662 (if (equal buffer (window-buffer (posn-window end))) | |
663 (with-current-buffer buffer | |
664 (when (or (equal start end) | |
665 (equal (posn-point start) | |
666 (marker-position | |
667 gdb-overlay-arrow-position))) | |
668 (save-excursion | |
669 (goto-line (line-number-at-pos (posn-point end))) | |
670 (forward-char 2) | |
671 (progn | |
672 (gud-call (concat "tbreak *%a")) | |
673 (gud-call (concat "jump *%a"))))))))))) | |
671 | 674 |
672 (defcustom gdb-speedbar-auto-raise nil | 675 (defcustom gdb-speedbar-auto-raise nil |
673 "If non-nil raise speedbar every time display of watch expressions is\ | 676 "If non-nil raise speedbar every time display of watch expressions is\ |
674 updated." | 677 updated." |
675 :type 'boolean | 678 :type 'boolean |