diff options
| author | Nick Roberts | 2007-02-07 21:57:04 +0000 |
|---|---|---|
| committer | Nick Roberts | 2007-02-07 21:57:04 +0000 |
| commit | f7ddc2ce5af43ae2c9ef5621d5c72ddd737fd6ff (patch) | |
| tree | 8106127e86709980e730abcc61e1f2b1a6ddc8f6 | |
| parent | f2b3ba1ea3b37572ca81e18b94aa9360fee5d9d3 (diff) | |
| download | emacs-f7ddc2ce5af43ae2c9ef5621d5c72ddd737fd6ff.tar.gz emacs-f7ddc2ce5af43ae2c9ef5621d5c72ddd737fd6ff.zip | |
(gdb-if-arrow): New macro.
(gdb-mouse-until, gdb-mouse-jump): Use it.
| -rw-r--r-- | lisp/progmodes/gdb-ui.el | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 21a00448166..02c65ae07df 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -606,6 +606,16 @@ With arg, use separate IO iff arg is positive." | |||
| 606 | (setq gdb-version "6.4+")) | 606 | (setq gdb-version "6.4+")) |
| 607 | (gdb-init-2)) | 607 | (gdb-init-2)) |
| 608 | 608 | ||
| 609 | (defmacro gdb-if-arrow (arrow-position &rest body) | ||
| 610 | `(if ,arrow-position | ||
| 611 | (let ((buffer (marker-buffer ,arrow-position)) (line)) | ||
| 612 | (if (equal buffer (window-buffer (posn-window end))) | ||
| 613 | (with-current-buffer buffer | ||
| 614 | (when (or (equal start end) | ||
| 615 | (equal (posn-point start) | ||
| 616 | (marker-position ,arrow-position))) | ||
| 617 | ,@body)))))) | ||
| 618 | |||
| 609 | (defun gdb-mouse-until (event) | 619 | (defun gdb-mouse-until (event) |
| 610 | "Continue running until a source line past the current line. | 620 | "Continue running until a source line past the current line. |
| 611 | The destination source line can be selected either by clicking with mouse-2 | 621 | The destination source line can be selected either by clicking with mouse-2 |
| @@ -613,28 +623,14 @@ on the fringe/margin or dragging the arrow with mouse-1 (default bindings)." | |||
| 613 | (interactive "e") | 623 | (interactive "e") |
| 614 | (let ((start (event-start event)) | 624 | (let ((start (event-start event)) |
| 615 | (end (event-end event))) | 625 | (end (event-end event))) |
| 616 | (if gud-overlay-arrow-position | 626 | (gdb-if-arrow gud-overlay-arrow-position |
| 617 | (let ((buffer (marker-buffer gud-overlay-arrow-position)) (line)) | ||
| 618 | (if (equal buffer (window-buffer (posn-window end))) | ||
| 619 | (with-current-buffer buffer | ||
| 620 | (when (or (equal start end) | ||
| 621 | (equal (posn-point start) | ||
| 622 | (marker-position | ||
| 623 | gud-overlay-arrow-position))) | ||
| 624 | (setq line (line-number-at-pos (posn-point end))) | 627 | (setq line (line-number-at-pos (posn-point end))) |
| 625 | (gud-call (concat "until " (number-to-string line)))))))) | 628 | (gud-call (concat "until " (number-to-string line)))) |
| 626 | (if gdb-overlay-arrow-position | 629 | (gdb-if-arrow gdb-overlay-arrow-position |
| 627 | (let ((buffer (marker-buffer gdb-overlay-arrow-position))) | 630 | (save-excursion |
| 628 | (if (equal buffer (window-buffer (posn-window end))) | 631 | (goto-line (line-number-at-pos (posn-point end))) |
| 629 | (with-current-buffer buffer | 632 | (forward-char 2) |
| 630 | (when (or (equal start end) | 633 | (gud-call (concat "until *%a")))))) |
| 631 | (equal (posn-point start) | ||
| 632 | (marker-position | ||
| 633 | gdb-overlay-arrow-position))) | ||
| 634 | (save-excursion | ||
| 635 | (goto-line (line-number-at-pos (posn-point end))) | ||
| 636 | (forward-char 2) | ||
| 637 | (gud-call (concat "until *%a")))))))))) | ||
| 638 | 634 | ||
| 639 | (defun gdb-mouse-jump (event) | 635 | (defun gdb-mouse-jump (event) |
| 640 | "Set execution address/line. | 636 | "Set execution address/line. |
| @@ -645,32 +641,18 @@ line, and no execution takes place." | |||
| 645 | (interactive "e") | 641 | (interactive "e") |
| 646 | (let ((start (event-start event)) | 642 | (let ((start (event-start event)) |
| 647 | (end (event-end event))) | 643 | (end (event-end event))) |
| 648 | (if gud-overlay-arrow-position | 644 | (gdb-if-arrow gud-overlay-arrow-position |
| 649 | (let ((buffer (marker-buffer gud-overlay-arrow-position)) (line)) | ||
| 650 | (if (equal buffer (window-buffer (posn-window end))) | ||
| 651 | (with-current-buffer buffer | ||
| 652 | (when (or (equal start end) | ||
| 653 | (equal (posn-point start) | ||
| 654 | (marker-position | ||
| 655 | gud-overlay-arrow-position))) | ||
| 656 | (setq line (line-number-at-pos (posn-point end))) | 645 | (setq line (line-number-at-pos (posn-point end))) |
| 657 | (progn | 646 | (progn |
| 658 | (gud-call (concat "tbreak " (number-to-string line))) | 647 | (gud-call (concat "tbreak " (number-to-string line))) |
| 659 | (gud-call (concat "jump " (number-to-string line))))))))) | 648 | (gud-call (concat "jump " (number-to-string line))))) |
| 660 | (if gdb-overlay-arrow-position | 649 | (gdb-if-arrow 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 | 650 | (save-excursion |
| 669 | (goto-line (line-number-at-pos (posn-point end))) | 651 | (goto-line (line-number-at-pos (posn-point end))) |
| 670 | (forward-char 2) | 652 | (forward-char 2) |
| 671 | (progn | 653 | (progn |
| 672 | (gud-call (concat "tbreak *%a")) | 654 | (gud-call (concat "tbreak *%a")) |
| 673 | (gud-call (concat "jump *%a"))))))))))) | 655 | (gud-call (concat "jump *%a"))))))) |
| 674 | 656 | ||
| 675 | (defcustom gdb-speedbar-auto-raise nil | 657 | (defcustom gdb-speedbar-auto-raise nil |
| 676 | "If non-nil raise speedbar every time display of watch expressions is\ | 658 | "If non-nil raise speedbar every time display of watch expressions is\ |