Mercurial > emacs
comparison lisp/gdb-ui.el @ 50962:8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
correctly when frame changes.
(gdb-info-threads-custom, gdb-threads-buffer-name)
(gdb-display-threads-buffer, gdb-frame-threads-buffer)
(gdb-threads-mode-map, gdb-threads-mode, gdb-get-thread-number)
(gdb-threads-select, gdb-threads-mouse-select): New functions and
variable for a buffer that provides a selectable threads list.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Mon, 12 May 2003 23:47:31 +0000 |
parents | 5f329faeef51 |
children | 323ddc93f3fe |
comparison
equal
deleted
inserted
replaced
50961:5e8674d83c8c | 50962:8a38e6c7aa44 |
---|---|
522 ("exited" gdb-stopping) | 522 ("exited" gdb-stopping) |
523 ("signalled" gdb-stopping) | 523 ("signalled" gdb-stopping) |
524 ("signal" gdb-stopping) | 524 ("signal" gdb-stopping) |
525 ("breakpoint" gdb-stopping) | 525 ("breakpoint" gdb-stopping) |
526 ("watchpoint" gdb-stopping) | 526 ("watchpoint" gdb-stopping) |
527 ("frame-begin" gdb-frame-begin) | 527 ; ("frame-begin" gdb-frame-begin) |
528 ("stopped" gdb-stopped) | 528 ("stopped" gdb-stopped) |
529 ("display-begin" gdb-display-begin) | 529 ("display-begin" gdb-display-begin) |
530 ("display-end" gdb-display-end) | 530 ("display-end" gdb-display-end) |
531 ; GDB commands info stack, info locals and frame generate an error-begin | 531 ; GDB commands info stack, info locals and frame generate an error-begin |
532 ; annotation at start when there is no stack but this is a quirk/bug in | 532 ; annotation at start when there is no stack but this is a quirk/bug in |
663 (if (not (gdb-get-pending-triggers)) | 663 (if (not (gdb-get-pending-triggers)) |
664 (progn | 664 (progn |
665 (gdb-get-current-frame) | 665 (gdb-get-current-frame) |
666 (gdb-invalidate-registers ignored) | 666 (gdb-invalidate-registers ignored) |
667 (gdb-invalidate-locals ignored) | 667 (gdb-invalidate-locals ignored) |
668 (gdb-invalidate-display ignored))) | 668 (gdb-invalidate-display ignored) |
669 (gdb-invalidate-threads))) | |
669 (let ((sink (gdb-get-output-sink))) | 670 (let ((sink (gdb-get-output-sink))) |
670 (cond | 671 (cond |
671 ((eq sink 'user) t) | 672 ((eq sink 'user) t) |
672 ((eq sink 'pre-emacs) | 673 ((eq sink 'pre-emacs) |
673 (gdb-set-output-sink 'emacs)) | 674 (gdb-set-output-sink 'emacs)) |
1570 (interactive "e") | 1571 (interactive "e") |
1571 (mouse-set-point event) | 1572 (mouse-set-point event) |
1572 (gdb-frames-select)) | 1573 (gdb-frames-select)) |
1573 | 1574 |
1574 ;; | 1575 ;; |
1576 ;; Threads buffer. This displays a selectable thread list. | |
1577 ;; | |
1578 (gdb-set-buffer-rules 'gdb-threads-buffer | |
1579 'gdb-threads-buffer-name | |
1580 'gdb-threads-mode) | |
1581 | |
1582 (def-gdb-auto-updated-buffer gdb-threads-buffer | |
1583 gdb-invalidate-threads | |
1584 "info threads\n" | |
1585 gdb-info-threads-handler | |
1586 gdb-info-threads-custom) | |
1587 | |
1588 (defun gdb-info-threads-custom () | |
1589 (save-excursion | |
1590 (set-buffer (gdb-get-buffer 'gdb-threads-buffer)) | |
1591 (let ((buffer-read-only nil)) | |
1592 (goto-char (point-min)) | |
1593 (while (< (point) (point-max)) | |
1594 (put-text-property (progn (beginning-of-line) (point)) | |
1595 (progn (end-of-line) (point)) | |
1596 'mouse-face 'highlight) | |
1597 (forward-line 1))))) | |
1598 | |
1599 (defun gdb-threads-buffer-name () | |
1600 (with-current-buffer gud-comint-buffer | |
1601 (concat "*threads of " (gdb-get-target-string) "*"))) | |
1602 | |
1603 (defun gdb-display-threads-buffer () | |
1604 (interactive) | |
1605 (gdb-display-buffer | |
1606 (gdb-get-create-buffer 'gdb-threads-buffer))) | |
1607 | |
1608 (defun gdb-frame-threads-buffer () | |
1609 (interactive) | |
1610 (switch-to-buffer-other-frame | |
1611 (gdb-get-create-buffer 'gdb-threads-buffer))) | |
1612 | |
1613 (defvar gdb-threads-mode-map | |
1614 (let ((map (make-sparse-keymap))) | |
1615 (suppress-keymap map) | |
1616 (define-key map "\r" 'gdb-threads-select) | |
1617 (define-key map [mouse-2] 'gdb-threads-mouse-select) | |
1618 map)) | |
1619 | |
1620 (defun gdb-threads-mode () | |
1621 "Major mode for gdb frames. | |
1622 | |
1623 \\{gdb-frames-mode-map}" | |
1624 (setq major-mode 'gdb-threads-mode) | |
1625 (setq mode-name "Threads") | |
1626 (setq buffer-read-only t) | |
1627 (use-local-map gdb-threads-mode-map) | |
1628 (gdb-invalidate-threads)) | |
1629 | |
1630 (defun gdb-get-thread-number () | |
1631 (save-excursion | |
1632 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) | |
1633 (match-string-no-properties 1))) | |
1634 | |
1635 | |
1636 (defun gdb-threads-select () | |
1637 "Make the thread on the current line become the current thread and display the | |
1638 source in the source buffer." | |
1639 (interactive) | |
1640 (gdb-enqueue-input | |
1641 (list (concat "thread " (gdb-get-thread-number) "\n") 'ignore)) | |
1642 (gud-display-frame)) | |
1643 | |
1644 (defun gdb-threads-mouse-select (event) | |
1645 "Make the selected frame become the current frame and display the source in | |
1646 the source buffer." | |
1647 (interactive "e") | |
1648 (mouse-set-point event) | |
1649 (gdb-threads-select)) | |
1650 | |
1651 ;; | |
1575 ;; Registers buffer. | 1652 ;; Registers buffer. |
1576 ;; | 1653 ;; |
1577 (gdb-set-buffer-rules 'gdb-registers-buffer | 1654 (gdb-set-buffer-rules 'gdb-registers-buffer |
1578 'gdb-registers-buffer-name | 1655 'gdb-registers-buffer-name |
1579 'gdb-registers-mode) | 1656 'gdb-registers-mode) |
1898 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) | 1975 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) |
1899 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) | 1976 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
1900 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) | 1977 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) |
1901 (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer)) | 1978 (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer)) |
1902 (define-key menu [display] '("Display" . gdb-display-display-buffer)) | 1979 (define-key menu [display] '("Display" . gdb-display-display-buffer)) |
1980 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) | |
1903 (define-key menu [assembler] '("Assembler" . gdb-display-assembler-buffer))) | 1981 (define-key menu [assembler] '("Assembler" . gdb-display-assembler-buffer))) |
1904 | 1982 |
1905 (defun gdb-frame-gdb-buffer () | 1983 (defun gdb-frame-gdb-buffer () |
1906 (interactive) | 1984 (interactive) |
1907 (switch-to-buffer-other-frame | 1985 (switch-to-buffer-other-frame |
1914 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) | 1992 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) |
1915 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) | 1993 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) |
1916 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) | 1994 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) |
1917 (define-key menu [breakpoints] '("Breakpoints" . gdb-frame-breakpoints-buffer)) | 1995 (define-key menu [breakpoints] '("Breakpoints" . gdb-frame-breakpoints-buffer)) |
1918 (define-key menu [display] '("Display" . gdb-frame-display-buffer)) | 1996 (define-key menu [display] '("Display" . gdb-frame-display-buffer)) |
1997 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) | |
1919 (define-key menu [assembler] '("Assembler" . gdb-frame-assembler-buffer))) | 1998 (define-key menu [assembler] '("Assembler" . gdb-frame-assembler-buffer))) |
1920 | 1999 |
1921 (defvar gdb-main-file nil "Source file from which program execution begins.") | 2000 (defvar gdb-main-file nil "Source file from which program execution begins.") |
1922 | 2001 |
1923 ;; layout for all the windows | 2002 ;; layout for all the windows |
2244 (progn | 2323 (progn |
2245 ;; take previous disassemble command off the queue | 2324 ;; take previous disassemble command off the queue |
2246 (save-excursion | 2325 (save-excursion |
2247 (set-buffer gud-comint-buffer) | 2326 (set-buffer gud-comint-buffer) |
2248 (let ((queue gdb-idle-input-queue) (item)) | 2327 (let ((queue gdb-idle-input-queue) (item)) |
2249 (while queue | 2328 (dolist (item queue) |
2250 (setq item (car queue)) | 2329 (setq item (car queue)) |
2251 (if (equal (cdr item) '(gdb-assembler-handler)) | 2330 (if (equal (cdr item) '(gdb-assembler-handler)) |
2252 (delete item gdb-idle-input-queue)) | 2331 (setq gdb-idle-input-queue |
2253 (setq queue (cdr queue))))) | 2332 (delete item gdb-idle-input-queue)))))) |
2254 (gdb-enqueue-idle-input | 2333 (gdb-enqueue-idle-input |
2255 (list (concat "server disassemble " gdb-main-or-pc "\n") | 2334 (list (concat "server disassemble " gdb-main-or-pc "\n") |
2256 'gdb-assembler-handler)) | 2335 'gdb-assembler-handler)) |
2257 (gdb-set-pending-triggers | 2336 (gdb-set-pending-triggers |
2258 (cons 'gdb-invalidate-assembler | 2337 (cons 'gdb-invalidate-assembler |