Mercurial > emacs
annotate lisp/gdb-ui.el @ 53272:bb2708b976f1
(comint-quote-filename): Correctly handle backslash
in comint-file-name-quote-list.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Wed, 24 Dec 2003 10:05:31 +0000 |
parents | 97802d013c5c |
children | 8597554d56e6 |
rev | line source |
---|---|
48292 | 1 ;;; gdb-ui.el --- User Interface for running GDB |
2 | |
3 ;; Author: Nick Roberts <nick@nick.uklinux.net> | |
4 ;; Maintainer: FSF | |
5 ;; Keywords: unix, tools | |
6 | |
52810
f49c1c4d92de
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-79
Miles Bader <miles@gnu.org>
parents:
52698
diff
changeset
|
7 ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
48292 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
49249 | 28 ;; This mode acts as a graphical user interface to GDB. You can interact with |
29 ;; GDB through the GUD buffer in the usual way, but there are also further | |
30 ;; buffers which control the execution and describe the state of your program. | |
31 ;; It separates the input/output of your program from that of GDB and displays | |
32 ;; expressions and their current values in their own buffers. It also uses | |
33 ;; features of Emacs 21 such as the display margin for breakpoints, and the | |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
34 ;; toolbar (see the GDB Graphical Interface section in the Emacs info manual). |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
35 |
49249 | 36 ;; Start the debugger with M-x gdba. |
37 | |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
38 ;; This file has evolved from gdba.el from GDB 5.0 written by Tom Lord and Jim |
49249 | 39 ;; Kingdon and uses GDB's annotation interface. You don't need to know about |
40 ;; annotations to use this mode as a debugger, but if you are interested | |
41 ;; developing the mode itself, then see the Annotations section in the GDB | |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
42 ;; info manual. Some GDB/MI commands are also used through th CLI command |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
43 ;; 'interpreter mi <mi-command>'. |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
44 ;; |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
45 ;; Known Bugs: |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
46 ;; |
48292 | 47 |
48 ;;; Code: | |
49 | |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
50 (require 'gud) |
48292 | 51 |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
52 (defvar gdb-current-address "main" "Initialisation for Assembler buffer.") |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
53 (defvar gdb-previous-address nil) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
54 (defvar gdb-previous-frame nil) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
55 (defvar gdb-current-frame "main") |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
56 (defvar gdb-current-language nil) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
57 (defvar gdb-view-source t "Non-nil means that source code can be viewed.") |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
58 (defvar gdb-selected-view 'source "Code type that user wishes to view.") |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
59 (defvar gdb-var-list nil "List of variables in watch window") |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
60 (defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed.") |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
61 (defvar gdb-buffer-type nil) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
62 (defvar gdb-variables '() |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
63 "A list of variables that are local to the GUD buffer.") |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
64 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
65 ;;;###autoload |
48292 | 66 (defun gdba (command-line) |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
67 "Run gdb on program FILE in buffer *gud-FILE*. |
48292 | 68 The directory containing FILE becomes the initial working directory |
69 and source-file directory for your debugger. | |
70 | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
71 If `gdb-many-windows' is nil (the default value) then gdb starts with |
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
72 just two windows : the GUD and the source buffer. If it is t the |
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
73 following layout will appear (keybindings given in relevant buffer) : |
48292 | 74 |
75 --------------------------------------------------------------------- | |
76 GDB Toolbar | |
77 --------------------------------------------------------------------- | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
78 GUD buffer (I/O of GDB) | Locals buffer |
48292 | 79 | |
80 | | |
81 | | |
82 --------------------------------------------------------------------- | |
83 Source buffer | Input/Output (of debuggee) buffer | |
84 | (comint-mode) | |
85 | | |
86 | | |
87 | | |
88 | | |
89 | | |
90 | | |
91 --------------------------------------------------------------------- | |
92 Stack buffer | Breakpoints buffer | |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
93 RET gdb-frames-select | SPC gdb-toggle-breakpoint |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
94 | RET gdb-goto-breakpoint |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
95 | d gdb-delete-breakpoint |
48292 | 96 --------------------------------------------------------------------- |
97 | |
98 All the buffers share the toolbar and source should always display in the same | |
99 window e.g after typing g on a breakpoint in the breakpoints buffer. Breakpoint | |
100 icons are displayed both by setting a break with gud-break and by typing break | |
101 in the GUD buffer. | |
102 | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
103 This works best (depending on the size of your monitor) using most of the |
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
104 screen. |
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
105 |
48292 | 106 Displayed expressions appear in separate frames. Arrays may be displayed |
107 as slices and visualised using the graph program from plotutils if installed. | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
108 Pointers in structures may be followed in a tree-like fashion. |
48292 | 109 |
110 The following interactive lisp functions help control operation : | |
111 | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
112 `gdb-many-windows' - Toggle the number of windows gdb uses. |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
113 `gdb-restore-windows' - To restore the window layout." |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
114 ;; |
48292 | 115 (interactive (list (gud-query-cmdline 'gdba))) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
116 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
117 ;; Let's start with a basic gud-gdb buffer and then modify it a bit. |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
118 (gdb command-line) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
119 ;; |
48292 | 120 (set (make-local-variable 'gud-minor-mode) 'gdba) |
48884
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
121 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
122 ;; |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
123 (gud-def gud-break (if (not (string-equal mode-name "Machine")) |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
124 (gud-call "break %f:%l" arg) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
125 (save-excursion |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
126 (beginning-of-line) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
127 (forward-char 2) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
128 (gud-call "break *%a" arg))) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
129 "\C-b" "Set breakpoint at current line or address.") |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
130 ;; |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
131 (gud-def gud-remove (if (not (string-equal mode-name "Machine")) |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
132 (gud-call "clear %f:%l" arg) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
133 (save-excursion |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
134 (beginning-of-line) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
135 (forward-char 2) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
136 (gud-call "clear *%a" arg))) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
137 "\C-d" "Remove breakpoint at current line or address.") |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
138 ;; |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
139 (gud-def gud-until (if (not (string-equal mode-name "Machine")) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
140 (gud-call "until %f:%l" arg) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
141 (save-excursion |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
142 (beginning-of-line) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
143 (forward-char 2) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
144 (gud-call "until *%a" arg))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
145 "\C-u" "Continue to current line or address.") |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
146 |
53134
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
147 (define-key gud-minor-mode-map [left-margin mouse-1] 'gdb-mouse-toggle-breakpoint) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
148 (define-key gud-minor-mode-map [left-fringe mouse-1] 'gdb-mouse-toggle-breakpoint) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
149 |
48292 | 150 (setq comint-input-sender 'gdb-send) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
151 ;; |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
152 ;; (re-)initialise |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
153 (setq gdb-current-address "main") |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
154 (setq gdb-previous-address nil) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
155 (setq gdb-previous-frame nil) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
156 (setq gdb-current-frame "main") |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
157 (setq gdb-view-source t) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
158 (setq gdb-selected-view 'source) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
159 (setq gdb-var-list nil) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
160 (setq gdb-var-changed nil) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
161 ;; |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
162 (mapc 'make-local-variable gdb-variables) |
48884
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
163 (setq gdb-buffer-type 'gdba) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
164 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
165 (gdb-clear-inferior-io) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
166 ;; |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
167 (if (eq window-system 'w32) |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
168 (gdb-enqueue-input (list "set new-console off\n" 'ignore))) |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
169 (gdb-enqueue-input (list "set height 0\n" 'ignore)) |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
170 ;; find source file and compilation directory here |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
171 (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program |
51172
61a988cae9b2
(gdba): Accommodate Fortran programs.
Nick Roberts <nickrob@snap.net.nz>
parents:
51123
diff
changeset
|
172 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran program |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
173 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
174 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
175 (run-hooks 'gdba-mode-hook)) |
48292 | 176 |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
177 (defcustom gdb-use-colon-colon-notation t |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
178 "Non-nil means use FUNCTION::VARIABLE format to display variables in the |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
179 speedbar." |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
180 :type 'boolean |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
181 :group 'gud) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
182 |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
183 (defun gud-watch () |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
184 "Watch expression at point." |
48292 | 185 (interactive) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
186 (let ((expr (tooltip-identifier-from-point (point)))) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
187 (if (and (string-equal gdb-current-language "c") |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
188 gdb-use-colon-colon-notation) |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
189 (setq expr (concat gdb-current-frame "::" expr))) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
190 (catch 'already-watched |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
191 (dolist (var gdb-var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
192 (if (string-equal expr (car var)) (throw 'already-watched nil))) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
193 (set-text-properties 0 (length expr) nil expr) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
194 (gdb-enqueue-input |
53193
f62f33c4d0fb
(gud-watch, gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
53134
diff
changeset
|
195 (list (concat "server interpreter mi \"-var-create - * " expr "\"\n") |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
196 `(lambda () (gdb-var-create-handler ,expr)))))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
197 (select-window (get-buffer-window gud-comint-buffer))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
198 |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
199 (defconst gdb-var-create-regexp |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
200 "name=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
201 |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
202 (defun gdb-var-create-handler (expr) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
203 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
204 (goto-char (point-min)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
205 (if (re-search-forward gdb-var-create-regexp nil t) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
206 (let ((var (list expr |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
207 (match-string 1) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
208 (match-string 2) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
209 (match-string 3) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
210 nil nil))) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
211 (push var gdb-var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
212 (speedbar 1) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
213 (if (equal (nth 2 var) "0") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
214 (gdb-enqueue-input |
53193
f62f33c4d0fb
(gud-watch, gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
53134
diff
changeset
|
215 (list (concat "server interpreter mi \"-var-evaluate-expression " |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
216 (nth 1 var) "\"\n") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
217 `(lambda () (gdb-var-evaluate-expression-handler |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
218 ,(nth 1 var) nil)))) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
219 (setq gdb-var-changed t))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
220 (if (re-search-forward "Undefined command" nil t) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
221 (message "Watching expressions requires gdb 6.0 onwards") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
222 (message "No symbol %s in current context." expr))))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
223 |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
224 (defun gdb-var-evaluate-expression-handler (varnum changed) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
225 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
226 (goto-char (point-min)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
227 (re-search-forward ".*value=\"\\(.*?\\)\"" nil t) |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
228 (catch 'var-found |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
229 (let ((var-list nil) (num 0)) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
230 (dolist (var gdb-var-list) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
231 (if (string-equal varnum (cadr var)) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
232 (progn |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
233 (if changed (setcar (nthcdr 5 var) t)) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
234 (setcar (nthcdr 4 var) (match-string 1)) |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
235 (setcar (nthcdr num gdb-var-list) var) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
236 (throw 'var-found nil))) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
237 (setq num (+ num 1)))))) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
238 (setq gdb-var-changed t)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
239 |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
240 (defun gdb-var-list-children (varnum) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
241 (gdb-enqueue-input |
53193
f62f33c4d0fb
(gud-watch, gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
53134
diff
changeset
|
242 (list (concat "server interpreter mi \"-var-list-children " varnum "\"\n") |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
243 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
244 |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
245 (defconst gdb-var-list-children-regexp |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
246 "name=\"\\(.*?\\)\",exp=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"") |
48292 | 247 |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
248 (defun gdb-var-list-children-handler (varnum) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
249 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
250 (goto-char (point-min)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
251 (let ((var-list nil)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
252 (catch 'child-already-watched |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
253 (dolist (var gdb-var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
254 (if (string-equal varnum (cadr var)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
255 (progn |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
256 (push var var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
257 (while (re-search-forward gdb-var-list-children-regexp nil t) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
258 (let ((varchild (list (match-string 2) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
259 (match-string 1) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
260 (match-string 3) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
261 (match-string 5) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
262 (match-string 4) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
263 nil))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
264 (dolist (var1 gdb-var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
265 (if (string-equal (cadr var1) (cadr varchild)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
266 (throw 'child-already-watched nil))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
267 (push varchild var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
268 (if (equal (nth 2 varchild) "0") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
269 (gdb-enqueue-input |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
270 (list |
53193
f62f33c4d0fb
(gud-watch, gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
53134
diff
changeset
|
271 (concat |
f62f33c4d0fb
(gud-watch, gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
53134
diff
changeset
|
272 "server interpreter mi \"-var-evaluate-expression " |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
273 (nth 1 varchild) "\"\n") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
274 `(lambda () (gdb-var-evaluate-expression-handler |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
275 ,(nth 1 varchild) nil)))))))) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
276 (push var var-list))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
277 (setq gdb-var-list (nreverse var-list)))))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
278 |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
279 (defun gdb-var-update () |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
280 (if (not (member 'gdb-var-update (gdb-get-pending-triggers))) |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
281 (progn |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
282 (gdb-enqueue-input (list "server interpreter mi \"-var-update *\"\n" |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
283 'gdb-var-update-handler)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
284 (gdb-set-pending-triggers (cons 'gdb-var-update |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
285 (gdb-get-pending-triggers)))))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
286 |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
287 (defconst gdb-var-update-regexp "name=\"\\(.*?\\)\"") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
288 |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
289 (defun gdb-var-update-handler () |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
290 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
291 (goto-char (point-min)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
292 (while (re-search-forward gdb-var-update-regexp nil t) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
293 (let ((varnum (match-string 1))) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
294 (gdb-enqueue-input |
53193
f62f33c4d0fb
(gud-watch, gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
53134
diff
changeset
|
295 (list (concat "server interpreter mi \"-var-evaluate-expression " |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
296 varnum "\"\n") |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
297 `(lambda () (gdb-var-evaluate-expression-handler |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
298 ,varnum t))))))) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
299 (gdb-set-pending-triggers |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
300 (delq 'gdb-var-update (gdb-get-pending-triggers)))) |
48292 | 301 |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
302 (defun gdb-var-delete (text token indent) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
303 "Delete watched expression." |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
304 (interactive) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
305 (when (eq indent 0) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
306 (string-match "\\(\\S-+\\)" text) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
307 (let* ((expr (match-string 1 text)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
308 (var (assoc expr gdb-var-list)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
309 (varnum (cadr var))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
310 (gdb-enqueue-input |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
311 (list (concat "server interpreter mi \"-var-delete " varnum "\"\n") |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
312 'ignore)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
313 (setq gdb-var-list (delq var gdb-var-list)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
314 (dolist (varchild gdb-var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
315 (if (string-match (concat (nth 1 var) "\\.") (nth 1 varchild)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
316 (setq gdb-var-list (delq varchild gdb-var-list))))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
317 (setq gdb-var-changed t))) |
48292 | 318 |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
319 (defun gdb-edit-value (text token indent) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
320 "Assign a value to a variable displayed in the speedbar" |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
321 (interactive) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
322 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
323 (varnum (cadr var)) (value)) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
324 (setq value (read-string "New value: ")) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
325 (gdb-enqueue-input |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
326 (list (concat "server interpreter mi \"-var-assign " |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
327 varnum " " value "\"\n") |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
328 'ignore)))) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
329 |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
330 (defcustom gdb-show-changed-values t |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
331 "Non-nil means use font-lock-warning-face to display values that have |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
332 recently changed in the speedbar." |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
333 :type 'boolean |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
334 :group 'gud) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
335 |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
336 (defun gdb-speedbar-expand-node (text token indent) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
337 "Expand the node the user clicked on. |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
338 TEXT is the text of the button we clicked on, a + or - item. |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
339 TOKEN is data related to this node. |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
340 INDENT is the current indentation depth." |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
341 (cond ((string-match "+" text) ;expand this node |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
342 (gdb-var-list-children token)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
343 ((string-match "-" text) ;contract this node |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
344 (dolist (var gdb-var-list) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
345 (if (string-match (concat token "\\.") (nth 1 var)) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
346 (setq gdb-var-list (delq var gdb-var-list)))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
347 (setq gdb-var-changed t)))) |
48292 | 348 |
349 | |
350 ;; ====================================================================== | |
351 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
352 ;; In this world, there are gdb variables (of unspecified |
48292 | 353 ;; representation) and buffers associated with those objects. |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
354 ;; The list of variables is built up by the expansions of |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
355 ;; def-gdb-variable |
48292 | 356 |
357 (defmacro def-gdb-var (root-symbol &optional default doc) | |
358 (let* ((root (symbol-name root-symbol)) | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
359 (accessor (intern (concat "gdb-get-" root))) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
360 (setter (intern (concat "gdb-set-" root))) |
48640
7bc8b0b65a02
(gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48639
diff
changeset
|
361 (name (intern (concat "gdb-" root)))) |
7bc8b0b65a02
(gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48639
diff
changeset
|
362 `(progn |
7bc8b0b65a02
(gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48639
diff
changeset
|
363 (defvar ,name ,default ,doc) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
364 (if (not (memq ',name gdb-variables)) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
365 (push ',name gdb-variables)) |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
366 (defun ,accessor () |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
367 (buffer-local-value ',name gud-comint-buffer)) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
368 (defun ,setter (val) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
369 (with-current-buffer gud-comint-buffer |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
370 (setq ,name val)))))) |
48292 | 371 |
372 (def-gdb-var buffer-type nil | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
373 "One of the symbols bound in gdb-buffer-rules") |
48292 | 374 |
375 (def-gdb-var burst "" | |
376 "A string of characters from gdb that have not yet been processed.") | |
377 | |
378 (def-gdb-var input-queue () | |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
379 "A list of gdb command objects.") |
48292 | 380 |
381 (def-gdb-var prompting nil | |
382 "True when gdb is idle with no pending input.") | |
383 | |
384 (def-gdb-var output-sink 'user | |
385 "The disposition of the output of the current gdb command. | |
386 Possible values are these symbols: | |
387 | |
388 user -- gdb output should be copied to the GUD buffer | |
389 for the user to see. | |
390 | |
391 inferior -- gdb output should be copied to the inferior-io buffer | |
392 | |
393 pre-emacs -- output should be ignored util the post-prompt | |
394 annotation is received. Then the output-sink | |
395 becomes:... | |
396 emacs -- output should be collected in the partial-output-buffer | |
397 for subsequent processing by a command. This is the | |
398 disposition of output generated by commands that | |
399 gdb mode sends to gdb on its own behalf. | |
400 post-emacs -- ignore input until the prompt annotation is | |
401 received, then go to USER disposition. | |
402 ") | |
403 | |
404 (def-gdb-var current-item nil | |
405 "The most recent command item sent to gdb.") | |
406 | |
407 (def-gdb-var pending-triggers '() | |
408 "A list of trigger functions that have run later than their output | |
409 handlers.") | |
410 | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
411 ;; end of gdb variables |
48292 | 412 |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
413 (defun gdb-get-target-string () |
48884
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
414 (with-current-buffer gud-comint-buffer |
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
415 gud-target-name)) |
48292 | 416 |
417 | |
418 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
419 ;; gdb buffers. |
48292 | 420 ;; |
421 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
422 ;; of that particular buffer. | |
423 ;; | |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
424 ;; The usual gdb interaction buffer is given the type `gdba' and |
48292 | 425 ;; is constructed specially. |
426 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
427 ;; Others are constructed by gdb-get-create-buffer and |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
428 ;; named according to the rules set forth in the gdb-buffer-rules-assoc |
48292 | 429 |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
430 (defvar gdb-buffer-rules-assoc '()) |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
431 |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
432 (defun gdb-get-buffer (key) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
433 "Return the gdb buffer tagged with type KEY. |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
434 The key should be one of the cars in `gdb-buffer-rules-assoc'." |
48292 | 435 (save-excursion |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
436 (gdb-look-for-tagged-buffer key (buffer-list)))) |
48292 | 437 |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
438 (defun gdb-get-create-buffer (key) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
439 "Create a new gdb buffer of the type specified by KEY. |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
440 The key should be one of the cars in `gdb-buffer-rules-assoc'." |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
441 (or (gdb-get-buffer key) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
442 (let* ((rules (assoc key gdb-buffer-rules-assoc)) |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
443 (name (funcall (gdb-rules-name-maker rules))) |
48292 | 444 (new (get-buffer-create name))) |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
445 (with-current-buffer new |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
446 ;; FIXME: This should be set after calling the function, since the |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
447 ;; function should run kill-all-local-variables. |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
448 (set (make-local-variable 'gdb-buffer-type) key) |
48292 | 449 (if (cdr (cdr rules)) |
450 (funcall (car (cdr (cdr rules))))) | |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
451 (set (make-local-variable 'gud-comint-buffer) gud-comint-buffer) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
452 (set (make-local-variable 'gud-minor-mode) 'gdba) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
453 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
48292 | 454 new)))) |
455 | |
456 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
457 | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
458 (defun gdb-look-for-tagged-buffer (key bufs) |
48292 | 459 (let ((retval nil)) |
460 (while (and (not retval) bufs) | |
461 (set-buffer (car bufs)) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
462 (if (eq gdb-buffer-type key) |
48292 | 463 (setq retval (car bufs))) |
464 (setq bufs (cdr bufs))) | |
465 retval)) | |
466 | |
467 ;; | |
468 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
469 ;; at least one and possible more functions. The functions have these | |
470 ;; roles in defining a buffer type: | |
471 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
472 ;; NAME - Return a name for this buffer type. |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
473 ;; |
48292 | 474 ;; The remaining function(s) are optional: |
475 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
476 ;; MODE - called in a new buffer with no arguments, should establish |
48292 | 477 ;; the proper mode for the buffer. |
478 ;; | |
479 | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
480 (defun gdb-set-buffer-rules (buffer-type &rest rules) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
481 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) |
48292 | 482 (if binding |
483 (setcdr binding rules) | |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
484 (push (cons buffer-type rules) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
485 gdb-buffer-rules-assoc)))) |
48292 | 486 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
487 ;; GUD buffers are an exception to the rules |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
488 (gdb-set-buffer-rules 'gdba 'error) |
48292 | 489 |
490 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
491 ;; Partial-output buffer : This accumulates output from a command executed on |
48292 | 492 ;; behalf of emacs (rather than the user). |
493 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
494 (gdb-set-buffer-rules 'gdb-partial-output-buffer |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
495 'gdb-partial-output-name) |
48292 | 496 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
497 (defun gdb-partial-output-name () |
48292 | 498 (concat "*partial-output-" |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
499 (gdb-get-target-string) |
48292 | 500 "*")) |
501 | |
502 | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
503 (gdb-set-buffer-rules 'gdb-inferior-io |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
504 'gdb-inferior-io-name |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
505 'gdb-inferior-io-mode) |
48292 | 506 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
507 (defun gdb-inferior-io-name () |
48292 | 508 (concat "*input/output of " |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
509 (gdb-get-target-string) |
48292 | 510 "*")) |
511 | |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
512 (defvar gdb-inferior-io-mode-map |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
513 (let ((map (make-sparse-keymap))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
514 (define-key map "\C-c\C-c" 'gdb-inferior-io-interrupt) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
515 (define-key map "\C-c\C-z" 'gdb-inferior-io-stop) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
516 (define-key map "\C-c\C-\\" 'gdb-inferior-io-quit) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
517 (define-key map "\C-c\C-d" 'gdb-inferior-io-eof) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
518 map)) |
48292 | 519 |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
520 (define-derived-mode gdb-inferior-io-mode comint-mode "Debuggee I/O" |
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
521 "Major mode for gdb inferior-io." |
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
522 :syntax-table nil :abbrev-table nil |
48292 | 523 ;; We want to use comint because it has various nifty and familiar |
524 ;; features. We don't need a process, but comint wants one, so create | |
525 ;; a dummy one. | |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
526 (make-comint-in-buffer |
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
527 (substring (buffer-name) 1 (- (length (buffer-name)) 1)) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
528 (current-buffer) "hexl") |
48292 | 529 (setq comint-input-sender 'gdb-inferior-io-sender)) |
530 | |
531 (defun gdb-inferior-io-sender (proc string) | |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
532 ;; PROC is the pseudo-process created to satisfy comint. |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
533 (with-current-buffer (process-buffer proc) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
534 (setq proc (get-buffer-process gud-comint-buffer)) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
535 (process-send-string proc string) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
536 (process-send-string proc "\n"))) |
48292 | 537 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
538 (defun gdb-inferior-io-interrupt () |
48292 | 539 "Interrupt the program being debugged." |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
540 (interactive) |
48292 | 541 (interrupt-process |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
542 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
48292 | 543 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
544 (defun gdb-inferior-io-quit () |
48292 | 545 "Send quit signal to the program being debugged." |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
546 (interactive) |
48292 | 547 (quit-process |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
548 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
48292 | 549 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
550 (defun gdb-inferior-io-stop () |
48292 | 551 "Stop the program being debugged." |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
552 (interactive) |
48292 | 553 (stop-process |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
554 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
48292 | 555 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
556 (defun gdb-inferior-io-eof () |
48292 | 557 "Send end-of-file to the program being debugged." |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
558 (interactive) |
48292 | 559 (process-send-eof |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
560 (get-buffer-process gud-comint-buffer))) |
48292 | 561 |
562 | |
563 ;; | |
564 ;; gdb communications | |
565 ;; | |
566 | |
567 ;; INPUT: things sent to gdb | |
568 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
569 ;; The queues are lists. Each element is either a string (indicating user or |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
570 ;; user-like input) or a list of the form: |
48292 | 571 ;; |
572 ;; (INPUT-STRING HANDLER-FN) | |
573 ;; | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
574 ;; The handler function will be called from the partial-output buffer when the |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
575 ;; command completes. This is the way to write commands which invoke gdb |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
576 ;; commands autonomously. |
48292 | 577 ;; |
578 ;; These lists are consumed tail first. | |
579 ;; | |
580 | |
581 (defun gdb-send (proc string) | |
582 "A comint send filter for gdb. | |
583 This filter may simply queue output for a later time." | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
584 (gdb-enqueue-input (concat string "\n"))) |
48292 | 585 |
586 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
587 ;; is a query, or other non-top-level prompt. |
48292 | 588 |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
589 (defun gdb-enqueue-input (item) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
590 (if (gdb-get-prompting) |
48292 | 591 (progn |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
592 (gdb-send-item item) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
593 (gdb-set-prompting nil)) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
594 (gdb-set-input-queue |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
595 (cons item (gdb-get-input-queue))))) |
48292 | 596 |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
597 (defun gdb-dequeue-input () |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
598 (let ((queue (gdb-get-input-queue))) |
48292 | 599 (and queue |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
600 (let ((last (car (last queue)))) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
601 (unless (nbutlast queue) (gdb-set-input-queue '())) |
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
602 last)))) |
48292 | 603 |
604 | |
605 ;; | |
606 ;; output -- things gdb prints to emacs | |
607 ;; | |
608 ;; GDB output is a stream interrupted by annotations. | |
609 ;; Annotations can be recognized by their beginning | |
610 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
611 ;; | |
612 ;; The tag is a string obeying symbol syntax. | |
613 ;; | |
614 ;; The optional part `<opt>' can be either the empty string | |
615 ;; or a space followed by more data relating to the annotation. | |
616 ;; For example, the SOURCE annotation is followed by a filename, | |
617 ;; line number and various useless goo. This data must not include | |
618 ;; any newlines. | |
619 ;; | |
620 | |
53101
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
621 (defcustom gud-gdba-command-name "gdb -annotate=3" |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
622 "Default command to execute an executable under the GDB-UI debugger." |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
623 :type 'string |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
624 :group 'gud) |
48292 | 625 |
626 (defvar gdb-annotation-rules | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
627 '(("pre-prompt" gdb-pre-prompt) |
48292 | 628 ("prompt" gdb-prompt) |
629 ("commands" gdb-subprompt) | |
630 ("overload-choice" gdb-subprompt) | |
631 ("query" gdb-subprompt) | |
632 ("prompt-for-continue" gdb-subprompt) | |
633 ("post-prompt" gdb-post-prompt) | |
634 ("source" gdb-source) | |
635 ("starting" gdb-starting) | |
636 ("exited" gdb-stopping) | |
637 ("signalled" gdb-stopping) | |
638 ("signal" gdb-stopping) | |
639 ("breakpoint" gdb-stopping) | |
640 ("watchpoint" gdb-stopping) | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
641 ("frame-begin" gdb-frame-begin) |
48292 | 642 ("stopped" gdb-stopped) |
643 ) "An assoc mapping annotation tags to functions which process them.") | |
644 | |
645 (defconst gdb-source-spec-regexp | |
646 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:\\(0x[a-f0-9]*\\)") | |
647 | |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
648 ;; Do not use this except as an annotation handler. |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
649 (defun gdb-source (args) |
48292 | 650 (string-match gdb-source-spec-regexp args) |
651 ;; Extract the frame position from the marker. | |
652 (setq gud-last-frame | |
653 (cons | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
654 (match-string 1 args) |
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
655 (string-to-int (match-string 2 args)))) |
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
656 (setq gdb-current-address (match-string 3 args)) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
657 (setq gdb-view-source t)) |
48292 | 658 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
659 (defun gdb-send-item (item) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
660 (gdb-set-current-item item) |
48292 | 661 (if (stringp item) |
662 (progn | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
663 (gdb-set-output-sink 'user) |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
664 (process-send-string (get-buffer-process gud-comint-buffer) item)) |
48292 | 665 (progn |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
666 (gdb-clear-partial-output) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
667 (gdb-set-output-sink 'pre-emacs) |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
668 (process-send-string (get-buffer-process gud-comint-buffer) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
669 (car item))))) |
48292 | 670 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
671 (defun gdb-pre-prompt (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
672 "An annotation handler for `pre-prompt'. This terminates the collection of |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
673 output from a previous command if that happens to be in effect." |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
674 (let ((sink (gdb-get-output-sink))) |
48292 | 675 (cond |
676 ((eq sink 'user) t) | |
677 ((eq sink 'emacs) | |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
678 (gdb-set-output-sink 'post-emacs)) |
48292 | 679 (t |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
680 (gdb-set-output-sink 'user) |
50378
6e0c9823bcc0
(gdb-inferior-io-mode): Remove Unix pathname for cat
Nick Roberts <nickrob@snap.net.nz>
parents:
49588
diff
changeset
|
681 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
48292 | 682 |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
683 (defun gdb-prompt (ignored) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
684 "An annotation handler for `prompt'. |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
685 This sends the next command (if any) to gdb." |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
686 (let ((sink (gdb-get-output-sink))) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
687 (cond |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
688 ((eq sink 'user) t) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
689 ((eq sink 'post-emacs) |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
690 (gdb-set-output-sink 'user) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
691 (let ((handler |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
692 (car (cdr (gdb-get-current-item))))) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
693 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
694 (funcall handler)))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
695 (t |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
696 (gdb-set-output-sink 'user) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
697 (error "Phase error in gdb-prompt (got %s)" sink)))) |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
698 (let ((input (gdb-dequeue-input))) |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
699 (if input |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
700 (gdb-send-item input) |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
701 (progn |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
702 (gdb-set-prompting t) |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
703 (gud-display-frame))))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
704 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
705 (defun gdb-subprompt (ignored) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
706 "An annotation handler for non-top-level prompts." |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
707 (gdb-set-prompting t)) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
708 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
709 (defun gdb-starting (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
710 "An annotation handler for `starting'. This says that I/O for the |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
711 subprocess is now the program being debugged, not GDB." |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
712 (let ((sink (gdb-get-output-sink))) |
48292 | 713 (cond |
714 ((eq sink 'user) | |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
715 (progn |
48639
00993d9b9cb7
(gdba, gdb-starting, gdb-stopped, gdb-quit): Update gdb-running -> gud-running.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48600
diff
changeset
|
716 (setq gud-running t) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
717 (gdb-set-output-sink 'inferior))) |
48292 | 718 (t (error "Unexpected `starting' annotation"))))) |
719 | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
720 (defun gdb-stopping (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
721 "An annotation handler for `exited' and other annotations which say that I/O |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
722 for the subprocess is now GDB, not the program being debugged." |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
723 (let ((sink (gdb-get-output-sink))) |
48292 | 724 (cond |
725 ((eq sink 'inferior) | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
726 (gdb-set-output-sink 'user)) |
48292 | 727 (t (error "Unexpected stopping annotation"))))) |
728 | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
729 (defun gdb-frame-begin (ignored) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
730 (let ((sink (gdb-get-output-sink))) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
731 (cond |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
732 ((eq sink 'inferior) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
733 (gdb-set-output-sink 'user)) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
734 ((eq sink 'user) t) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
735 ((eq sink 'emacs) t) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
736 (t (error "Unexpected frame-begin annotation (%S)" sink))))) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
737 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
738 (defun gdb-stopped (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
739 "An annotation handler for `stopped'. It is just like gdb-stopping, except |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
740 that if we already set the output sink to 'user in gdb-stopping, that is fine." |
48639
00993d9b9cb7
(gdba, gdb-starting, gdb-stopped, gdb-quit): Update gdb-running -> gud-running.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48600
diff
changeset
|
741 (setq gud-running nil) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
742 (let ((sink (gdb-get-output-sink))) |
48292 | 743 (cond |
744 ((eq sink 'inferior) | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
745 (gdb-set-output-sink 'user)) |
48292 | 746 ((eq sink 'user) t) |
747 (t (error "Unexpected stopped annotation"))))) | |
748 | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
749 (defun gdb-post-prompt (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
750 "An annotation handler for `post-prompt'. This begins the collection of |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
751 output from the current command if that happens to be appropriate." |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
752 (if (not (gdb-get-pending-triggers)) |
48292 | 753 (progn |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
754 (gdb-get-current-frame) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
755 (gdb-invalidate-frames) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
756 (gdb-invalidate-breakpoints) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
757 (gdb-invalidate-assembler) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
758 (gdb-invalidate-registers) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
759 (gdb-invalidate-locals) |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
760 (gdb-invalidate-threads) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
761 (dolist (frame (frame-list)) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
762 (when (string-equal (frame-parameter frame 'name) "Speedbar") |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
763 (setq gdb-var-changed t) ; force update |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
764 (dolist (var gdb-var-list) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
765 (setcar (nthcdr 5 var) nil)))) |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
766 (gdb-var-update))) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
767 (let ((sink (gdb-get-output-sink))) |
48292 | 768 (cond |
769 ((eq sink 'user) t) | |
770 ((eq sink 'pre-emacs) | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
771 (gdb-set-output-sink 'emacs)) |
48292 | 772 (t |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
773 (gdb-set-output-sink 'user) |
50378
6e0c9823bcc0
(gdb-inferior-io-mode): Remove Unix pathname for cat
Nick Roberts <nickrob@snap.net.nz>
parents:
49588
diff
changeset
|
774 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
48292 | 775 |
48884
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
776 (defun gud-gdba-marker-filter (string) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
777 "A gud marker filter for gdb. Handle a burst of output from GDB." |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
778 (let ( |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
779 ;; Recall the left over burst from last time |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
780 (burst (concat (gdb-get-burst) string)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
781 ;; Start accumulating output for the GUD buffer |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
782 (output "")) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
783 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
784 ;; Process all the complete markers in this chunk. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
785 (while (string-match "\n\032\032\\(.*\\)\n" burst) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
786 (let ((annotation (match-string 1 burst))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
787 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
788 ;; Stuff prior to the match is just ordinary output. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
789 ;; It is either concatenated to OUTPUT or directed |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
790 ;; elsewhere. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
791 (setq output |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
792 (gdb-concat-output |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
793 output |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
794 (substring burst 0 (match-beginning 0)))) |
48292 | 795 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
796 ;; Take that stuff off the burst. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
797 (setq burst (substring burst (match-end 0))) |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
798 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
799 ;; Parse the tag from the annotation, and maybe its arguments. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
800 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
801 (let* ((annotation-type (match-string 1 annotation)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
802 (annotation-arguments (match-string 2 annotation)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
803 (annotation-rule (assoc annotation-type |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
804 gdb-annotation-rules))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
805 ;; Call the handler for this annotation. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
806 (if annotation-rule |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
807 (funcall (car (cdr annotation-rule)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
808 annotation-arguments) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
809 ;; Else the annotation is not recognized. Ignore it silently, |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
810 ;; so that GDB can add new annotations without causing |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
811 ;; us to blow up. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
812 )))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
813 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
814 ;; Does the remaining text end in a partial line? |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
815 ;; If it does, then keep part of the burst until we get more. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
816 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'" |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
817 burst) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
818 (progn |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
819 ;; Everything before the potential marker start can be output. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
820 (setq output |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
821 (gdb-concat-output output |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
822 (substring burst 0 (match-beginning 0)))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
823 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
824 ;; Everything after, we save, to combine with later input. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
825 (setq burst (substring burst (match-beginning 0)))) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
826 ;; |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
827 ;; In case we know the burst contains no partial annotations: |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
828 (progn |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
829 (setq output (gdb-concat-output output burst)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
830 (setq burst ""))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
831 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
832 ;; Save the remaining burst for the next call to this function. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
833 (gdb-set-burst burst) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
834 output)) |
48292 | 835 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
836 (defun gdb-concat-output (so-far new) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
837 (let ((sink (gdb-get-output-sink ))) |
48292 | 838 (cond |
839 ((eq sink 'user) (concat so-far new)) | |
840 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
841 ((eq sink 'emacs) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
842 (gdb-append-to-partial-output new) |
48292 | 843 so-far) |
844 ((eq sink 'inferior) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
845 (gdb-append-to-inferior-io new) |
48292 | 846 so-far) |
847 (t (error "Bogon output sink %S" sink))))) | |
848 | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
849 (defun gdb-append-to-partial-output (string) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
850 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
48292 | 851 (goto-char (point-max)) |
852 (insert string))) | |
853 | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
854 (defun gdb-clear-partial-output () |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
855 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
856 (erase-buffer))) |
48292 | 857 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
858 (defun gdb-append-to-inferior-io (string) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
859 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io) |
48292 | 860 (goto-char (point-max)) |
861 (insert-before-markers string)) | |
48884
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
862 (if (not (string-equal string "")) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
863 (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io)))) |
48292 | 864 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
865 (defun gdb-clear-inferior-io () |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
866 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
867 (erase-buffer))) |
48292 | 868 |
869 | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
870 ;; One trick is to have a command who's output is always available in a buffer |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
871 ;; of it's own, and is always up to date. We build several buffers of this |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
872 ;; type. |
48292 | 873 ;; |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
874 ;; There are two aspects to this: gdb has to tell us when the output for that |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
875 ;; command might have changed, and we have to be able to run the command |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
876 ;; behind the user's back. |
48292 | 877 ;; |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
878 ;; The output phasing associated with the variable gdb-output-sink |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
879 ;; help us to run commands behind the user's back. |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
880 ;; |
48292 | 881 ;; Below is the code for specificly managing buffers of output from one |
882 ;; command. | |
883 ;; | |
884 | |
885 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
886 ;; It adds an input for the command we are tracking. It should be the |
48292 | 887 ;; annotation rule binding of whatever gdb sends to tell us this command |
888 ;; might have changed it's output. | |
889 ;; | |
890 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. | |
891 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the | |
892 ;; input in the input queue (see comment about ``gdb communications'' above). | |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
893 |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
894 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
895 output-handler) |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
896 `(defun ,name (&optional ignored) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
897 (if (and (,demand-predicate) |
48292 | 898 (not (member ',name |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
899 (gdb-get-pending-triggers)))) |
48292 | 900 (progn |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
901 (gdb-enqueue-input |
48292 | 902 (list ,gdb-command ',output-handler)) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
903 (gdb-set-pending-triggers |
48292 | 904 (cons ',name |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
905 (gdb-get-pending-triggers))))))) |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
906 |
48292 | 907 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) |
908 `(defun ,name () | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
909 (gdb-set-pending-triggers |
48292 | 910 (delq ',trigger |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
911 (gdb-get-pending-triggers))) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
912 (let ((buf (gdb-get-buffer ',buf-key))) |
48292 | 913 (and buf |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
914 (with-current-buffer buf |
48292 | 915 (let ((p (point)) |
916 (buffer-read-only nil)) | |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
917 (erase-buffer) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
918 (insert-buffer-substring (gdb-get-create-buffer |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
919 'gdb-partial-output-buffer)) |
48292 | 920 (goto-char p))))) |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
921 ;; put customisation here |
48292 | 922 (,custom-defun))) |
923 | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
924 (defmacro def-gdb-auto-updated-buffer (buffer-key trigger-name gdb-command |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
925 output-handler-name custom-defun) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
926 `(progn |
48292 | 927 (def-gdb-auto-update-trigger ,trigger-name |
928 ;; The demand predicate: | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
929 (lambda () (gdb-get-buffer ',buffer-key)) |
48292 | 930 ,gdb-command |
931 ,output-handler-name) | |
932 (def-gdb-auto-update-handler ,output-handler-name | |
933 ,trigger-name ,buffer-key ,custom-defun))) | |
934 | |
935 | |
936 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
937 ;; Breakpoint buffer : This displays the output of `info breakpoints'. |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
938 ;; |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
939 (gdb-set-buffer-rules 'gdb-breakpoints-buffer |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
940 'gdb-breakpoints-buffer-name |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
941 'gdb-breakpoints-mode) |
48292 | 942 |
943 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
944 ;; This defines the auto update rule for buffers of type | |
945 ;; `gdb-breakpoints-buffer'. | |
946 ;; | |
947 ;; It defines a function to serve as the annotation handler that | |
948 ;; handles the `foo-invalidated' message. That function is called: | |
949 gdb-invalidate-breakpoints | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
950 ;; |
48292 | 951 ;; To update the buffer, this command is sent to gdb. |
952 "server info breakpoints\n" | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
953 ;; |
48292 | 954 ;; This also defines a function to be the handler for the output |
955 ;; from the command above. That function will copy the output into | |
956 ;; the appropriately typed buffer. That function will be called: | |
957 gdb-info-breakpoints-handler | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
958 ;; buffer specific functions |
48292 | 959 gdb-info-breakpoints-custom) |
960 | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
961 (defvar gdb-cdir nil "Compilation directory.") |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
962 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
963 (defconst breakpoint-xpm-data "/* XPM */ |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
964 static char *magick[] = { |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
965 /* columns rows colors chars-per-pixel */ |
52868
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
966 \"10 10 2 1\", |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
967 \" c red\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
968 \"+ c None\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
969 /* pixels */ |
53101
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
970 \"+++ +++\", |
52868
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
971 \"++ ++\", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
972 \"+ +\", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
973 \" \", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
974 \" \", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
975 \" \", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
976 \" \", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
977 \"+ +\", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
978 \"++ ++\", |
53101
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
979 \"+++ +++\", |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
980 };" |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
981 "XPM data used for breakpoint icon.") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
982 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
983 (defconst breakpoint-enabled-pbm-data |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
984 "P1 |
52868
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
985 10 10\", |
53101
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
986 0 0 0 0 1 1 1 1 0 0 0 0 |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
987 0 0 0 1 1 1 1 1 1 0 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
988 0 0 1 1 1 1 1 1 1 1 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
989 0 1 1 1 1 1 1 1 1 1 1 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
990 0 1 1 1 1 1 1 1 1 1 1 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
991 0 1 1 1 1 1 1 1 1 1 1 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
992 0 1 1 1 1 1 1 1 1 1 1 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
993 0 0 1 1 1 1 1 1 1 1 0 0 |
53101
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
994 0 0 0 1 1 1 1 1 1 0 0 0 |
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
995 0 0 0 0 1 1 1 1 0 0 0 0" |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
996 "PBM data used for enabled breakpoint icon.") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
997 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
998 (defconst breakpoint-disabled-pbm-data |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
999 "P1 |
52868
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1000 10 10\", |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1001 0 0 1 0 1 0 1 0 0 0 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1002 0 1 0 1 0 1 0 1 0 0 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1003 1 0 1 0 1 0 1 0 1 0 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1004 0 1 0 1 0 1 0 1 0 1 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1005 1 0 1 0 1 0 1 0 1 0 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1006 0 1 0 1 0 1 0 1 0 1 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1007 1 0 1 0 1 0 1 0 1 0 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1008 0 1 0 1 0 1 0 1 0 1 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1009 0 0 1 0 1 0 1 0 1 0 |
34fccd9658c6
(breakpoint-xpm-data, breakpoint-enabled-pbm-data)
Nick Roberts <nickrob@snap.net.nz>
parents:
52810
diff
changeset
|
1010 0 0 0 1 0 1 0 1 0 0" |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1011 "PBM data used for disabled breakpoint icon.") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1012 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1013 (defvar breakpoint-enabled-icon |
53101
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
1014 (find-image `((:type xpm :data ,breakpoint-xpm-data :ascent 100) |
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
1015 (:type pbm :data ,breakpoint-enabled-pbm-data :ascent 100))) |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1016 "Icon for enabled breakpoint in display margin") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1017 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1018 (defvar breakpoint-disabled-icon |
53101
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
1019 (find-image `((:type xpm :data ,breakpoint-xpm-data :conversion disabled :ascent 100) |
b34783a00130
(gud-gdba-command-name): Find gdb command via PATH.
Kim F. Storm <storm@cua.dk>
parents:
52905
diff
changeset
|
1020 (:type pbm :data ,breakpoint-disabled-pbm-data :ascent 100))) |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1021 "Icon for disabled breakpoint in display margin") |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1022 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
1023 ;;-put breakpoint icons in relevant margins (even those set in the GUD buffer) |
48292 | 1024 (defun gdb-info-breakpoints-custom () |
1025 (let ((flag)(address)) | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1026 ;; |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1027 ;; remove all breakpoint-icons in source buffers but not assembler buffer |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1028 (dolist (buffer (buffer-list)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1029 (with-current-buffer buffer |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1030 (if (and (eq gud-minor-mode 'gdba) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1031 (not (string-match "^\*" (buffer-name)))) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1032 (if (display-images-p) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1033 (remove-images (point-min) (point-max)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1034 (gdb-remove-strings (point-min) (point-max)))))) |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1035 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
48292 | 1036 (save-excursion |
1037 (goto-char (point-min)) | |
1038 (while (< (point) (- (point-max) 1)) | |
1039 (forward-line 1) | |
1040 (if (looking-at "[^\t].*breakpoint") | |
1041 (progn | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1042 (looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)") |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1043 (setq flag (char-after (match-beginning 1))) |
48292 | 1044 (beginning-of-line) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1045 (if (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1046 (progn |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1047 (looking-at "\\(\\S-*\\):\\([0-9]+\\)") |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1048 (let ((line (match-string 2)) (buffer-read-only nil) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1049 (file (match-string 1))) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1050 (add-text-properties (point-at-bol) (point-at-eol) |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1051 '(mouse-face highlight |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1052 help-echo "mouse-2, RET: visit breakpoint")) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1053 (with-current-buffer |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1054 (find-file-noselect |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1055 (if (file-exists-p file) file |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1056 (expand-file-name file gdb-cdir))) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1057 (save-current-buffer |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1058 (set (make-local-variable 'gud-minor-mode) 'gdba) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1059 (set (make-local-variable 'tool-bar-map) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1060 gud-tool-bar-map) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1061 (setq left-margin-width 2) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1062 (if (get-buffer-window (current-buffer)) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1063 (set-window-margins (get-buffer-window |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1064 (current-buffer)) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1065 left-margin-width |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1066 right-margin-width))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1067 ;; only want one breakpoint icon at each location |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1068 (save-excursion |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1069 (goto-line (string-to-number line)) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1070 (let ((start (progn (beginning-of-line) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1071 (- (point) 1))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1072 (end (progn (end-of-line) (+ (point) 1)))) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1073 (if (display-images-p) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1074 (progn |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1075 (remove-images start end) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1076 (if (eq ?y flag) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1077 (put-image breakpoint-enabled-icon |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1078 (+ start 1) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1079 "breakpoint icon enabled" |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1080 'left-margin) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1081 (put-image breakpoint-disabled-icon |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1082 (+ start 1) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1083 "breakpoint icon disabled" |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1084 'left-margin))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1085 (gdb-remove-strings start end) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1086 (if (eq ?y flag) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1087 (gdb-put-string "B" (+ start 1)) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1088 (gdb-put-string "b" (+ start 1)))))))))))) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1089 (end-of-line))))) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1090 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) |
48292 | 1091 |
53134
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1092 (defun gdb-mouse-toggle-breakpoint (event) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1093 "Toggle breakpoint with mouse click in left margin." |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1094 (interactive "e") |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1095 (mouse-minibuffer-check event) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1096 (let ((posn (event-end event))) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1097 (message "pt=%S posn=%S" (posn-point posn) posn) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1098 (if (numberp (posn-point posn)) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1099 (with-selected-window (posn-window posn) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1100 (save-excursion |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1101 (goto-char (posn-point posn)) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1102 (if (posn-object posn) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1103 (gud-remove nil) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1104 (gud-break nil))))))) |
5983bf0859dc
(gdb-mouse-toggle-breakpoint): New defun.
Kim F. Storm <storm@cua.dk>
parents:
53101
diff
changeset
|
1105 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1106 (defun gdb-breakpoints-buffer-name () |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1107 (with-current-buffer gud-comint-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1108 (concat "*breakpoints of " (gdb-get-target-string) "*"))) |
48292 | 1109 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1110 (defun gdb-display-breakpoints-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1111 (interactive) |
48292 | 1112 (gdb-display-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1113 (gdb-get-create-buffer 'gdb-breakpoints-buffer))) |
48292 | 1114 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1115 (defun gdb-frame-breakpoints-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1116 (interactive) |
48292 | 1117 (switch-to-buffer-other-frame |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1118 (gdb-get-create-buffer 'gdb-breakpoints-buffer))) |
48292 | 1119 |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1120 (defvar gdb-breakpoints-mode-map |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1121 (let ((map (make-sparse-keymap)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1122 (menu (make-sparse-keymap "Breakpoints"))) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1123 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1124 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1125 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
48292 | 1126 |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1127 (suppress-keymap map) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1128 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1129 (define-key map " " 'gdb-toggle-breakpoint) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1130 (define-key map "d" 'gdb-delete-breakpoint) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1131 (define-key map "\r" 'gdb-goto-breakpoint) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1132 (define-key map [mouse-2] 'gdb-mouse-goto-breakpoint) |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1133 map)) |
48292 | 1134 |
1135 (defun gdb-breakpoints-mode () | |
1136 "Major mode for gdb breakpoints. | |
1137 | |
1138 \\{gdb-breakpoints-mode-map}" | |
1139 (setq major-mode 'gdb-breakpoints-mode) | |
1140 (setq mode-name "Breakpoints") | |
1141 (use-local-map gdb-breakpoints-mode-map) | |
1142 (setq buffer-read-only t) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1143 (gdb-invalidate-breakpoints)) |
48292 | 1144 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1145 (defun gdb-toggle-breakpoint () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1146 "Enable/disable the breakpoint at current line." |
48292 | 1147 (interactive) |
1148 (save-excursion | |
1149 (beginning-of-line 1) | |
1150 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) | |
1151 (error "Not recognized as break/watchpoint line") | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1152 (gdb-enqueue-input |
48292 | 1153 (list |
1154 (concat | |
1155 (if (eq ?y (char-after (match-beginning 2))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1156 "server disable " |
48292 | 1157 "server enable ") |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1158 (match-string 1) "\n") |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
1159 'ignore))))) |
48292 | 1160 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1161 (defun gdb-delete-breakpoint () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1162 "Delete the breakpoint at current line." |
48292 | 1163 (interactive) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1164 (beginning-of-line 1) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1165 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1166 (error "Not recognized as break/watchpoint line") |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1167 (gdb-enqueue-input |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1168 (list (concat "server delete " (match-string 1) "\n") 'ignore)))) |
48292 | 1169 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1170 (defvar gdb-source-window nil) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1171 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1172 (defun gdb-goto-breakpoint () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1173 "Display the file in the source buffer at the breakpoint specified on the |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1174 current line." |
48292 | 1175 (interactive) |
1176 (save-excursion | |
1177 (beginning-of-line 1) | |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1178 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) |
48292 | 1179 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1180 (if (match-string 2) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1181 (let ((line (match-string 2)) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1182 (file (match-string 1))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1183 (save-selected-window |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1184 (select-window gdb-source-window) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1185 (switch-to-buffer (find-file-noselect |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1186 (if (file-exists-p file) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1187 file |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1188 (expand-file-name file gdb-cdir)))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1189 (goto-line (string-to-number line)))))) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1190 |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1191 (defun gdb-mouse-goto-breakpoint (event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1192 "Display the file in the source buffer at the selected breakpoint." |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1193 (interactive "e") |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1194 (mouse-set-point event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1195 (gdb-goto-breakpoint)) |
48292 | 1196 |
1197 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1198 ;; Frames buffer. This displays a perpetually correct bactracktrace |
48292 | 1199 ;; (from the command `where'). |
1200 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1201 ;; Alas, if your stack is deep, it is costly. |
48292 | 1202 ;; |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1203 (gdb-set-buffer-rules 'gdb-stack-buffer |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1204 'gdb-stack-buffer-name |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1205 'gdb-frames-mode) |
48292 | 1206 |
1207 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
1208 gdb-invalidate-frames | |
1209 "server where\n" | |
1210 gdb-info-frames-handler | |
1211 gdb-info-frames-custom) | |
1212 | |
1213 (defun gdb-info-frames-custom () | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1214 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1215 (save-excursion |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1216 (let ((buffer-read-only nil)) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1217 (goto-char (point-min)) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1218 (while (< (point) (point-max)) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1219 (add-text-properties (point-at-bol) (point-at-eol) |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1220 '(mouse-face highlight |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1221 help-echo "mouse-2, RET: Select frame")) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1222 (beginning-of-line) |
52810
f49c1c4d92de
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-79
Miles Bader <miles@gnu.org>
parents:
52698
diff
changeset
|
1223 (when (and (or (looking-at "^#[0-9]*\\s-*\\S-* in \\(\\S-*\\)") |
f49c1c4d92de
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-79
Miles Bader <miles@gnu.org>
parents:
52698
diff
changeset
|
1224 (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)")) |
f49c1c4d92de
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-79
Miles Bader <miles@gnu.org>
parents:
52698
diff
changeset
|
1225 (equal (match-string 1) gdb-current-frame)) |
f49c1c4d92de
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-79
Miles Bader <miles@gnu.org>
parents:
52698
diff
changeset
|
1226 (put-text-property (point-at-bol) (point-at-eol) |
f49c1c4d92de
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-79
Miles Bader <miles@gnu.org>
parents:
52698
diff
changeset
|
1227 'face '(:inverse-video t))) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1228 (forward-line 1)))))) |
48292 | 1229 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1230 (defun gdb-stack-buffer-name () |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1231 (with-current-buffer gud-comint-buffer |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1232 (concat "*stack frames of " (gdb-get-target-string) "*"))) |
48292 | 1233 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1234 (defun gdb-display-stack-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1235 (interactive) |
48292 | 1236 (gdb-display-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1237 (gdb-get-create-buffer 'gdb-stack-buffer))) |
48292 | 1238 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1239 (defun gdb-frame-stack-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1240 (interactive) |
48292 | 1241 (switch-to-buffer-other-frame |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1242 (gdb-get-create-buffer 'gdb-stack-buffer))) |
48292 | 1243 |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1244 (defvar gdb-frames-mode-map |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1245 (let ((map (make-sparse-keymap))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1246 (suppress-keymap map) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1247 (define-key map "\r" 'gdb-frames-select) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1248 (define-key map [mouse-2] 'gdb-frames-mouse-select) |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1249 map)) |
48292 | 1250 |
1251 (defun gdb-frames-mode () | |
1252 "Major mode for gdb frames. | |
1253 | |
1254 \\{gdb-frames-mode-map}" | |
1255 (setq major-mode 'gdb-frames-mode) | |
1256 (setq mode-name "Frames") | |
1257 (setq buffer-read-only t) | |
1258 (use-local-map gdb-frames-mode-map) | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1259 (font-lock-mode -1) |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1260 (gdb-invalidate-frames)) |
48292 | 1261 |
1262 (defun gdb-get-frame-number () | |
1263 (save-excursion | |
1264 (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t)) | |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1265 (n (or (and pos (match-string-no-properties 1)) "0"))) |
48292 | 1266 n))) |
1267 | |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1268 (defun gdb-frames-select () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1269 "Make the frame on the current line become the current frame and display the |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1270 source in the source buffer." |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1271 (interactive) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1272 (gdb-enqueue-input |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1273 (list (concat "server frame " (gdb-get-frame-number) "\n") 'ignore)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1274 (gud-display-frame)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1275 |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1276 (defun gdb-frames-mouse-select (event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1277 "Make the selected frame become the current frame and display the source in |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1278 the source buffer." |
48292 | 1279 (interactive "e") |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1280 (mouse-set-point event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1281 (gdb-frames-select)) |
48292 | 1282 |
1283 ;; | |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1284 ;; Threads buffer. This displays a selectable thread list. |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1285 ;; |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1286 (gdb-set-buffer-rules 'gdb-threads-buffer |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1287 'gdb-threads-buffer-name |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1288 'gdb-threads-mode) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1289 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1290 (def-gdb-auto-updated-buffer gdb-threads-buffer |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1291 gdb-invalidate-threads |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
1292 "server info threads\n" |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1293 gdb-info-threads-handler |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1294 gdb-info-threads-custom) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1295 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1296 (defun gdb-info-threads-custom () |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1297 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1298 (let ((buffer-read-only nil)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1299 (goto-char (point-min)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1300 (while (< (point) (point-max)) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1301 (add-text-properties (point-at-bol) (point-at-eol) |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1302 '(mouse-face highlight |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1303 help-echo "mouse-2, RET: select thread")) |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1304 (forward-line 1))))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1305 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1306 (defun gdb-threads-buffer-name () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1307 (with-current-buffer gud-comint-buffer |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1308 (concat "*threads of " (gdb-get-target-string) "*"))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1309 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1310 (defun gdb-display-threads-buffer () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1311 (interactive) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1312 (gdb-display-buffer |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1313 (gdb-get-create-buffer 'gdb-threads-buffer))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1314 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1315 (defun gdb-frame-threads-buffer () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1316 (interactive) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1317 (switch-to-buffer-other-frame |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1318 (gdb-get-create-buffer 'gdb-threads-buffer))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1319 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1320 (defvar gdb-threads-mode-map |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1321 (let ((map (make-sparse-keymap))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1322 (suppress-keymap map) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1323 (define-key map "\r" 'gdb-threads-select) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1324 (define-key map [mouse-2] 'gdb-threads-mouse-select) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1325 map)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1326 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1327 (defun gdb-threads-mode () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1328 "Major mode for gdb frames. |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1329 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1330 \\{gdb-frames-mode-map}" |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1331 (setq major-mode 'gdb-threads-mode) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1332 (setq mode-name "Threads") |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1333 (setq buffer-read-only t) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1334 (use-local-map gdb-threads-mode-map) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1335 (gdb-invalidate-threads)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1336 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1337 (defun gdb-get-thread-number () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1338 (save-excursion |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1339 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1340 (match-string-no-properties 1))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1341 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1342 (defun gdb-threads-select () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1343 "Make the thread on the current line become the current thread and display the |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1344 source in the source buffer." |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1345 (interactive) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1346 (gdb-enqueue-input |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1347 (list (concat "thread " (gdb-get-thread-number) "\n") 'ignore)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1348 (gud-display-frame)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1349 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1350 (defun gdb-threads-mouse-select (event) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1351 "Make the selected frame become the current frame and display the source in |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1352 the source buffer." |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1353 (interactive "e") |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1354 (mouse-set-point event) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1355 (gdb-threads-select)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1356 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1357 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1358 ;; Registers buffer. |
48292 | 1359 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1360 (gdb-set-buffer-rules 'gdb-registers-buffer |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1361 'gdb-registers-buffer-name |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1362 'gdb-registers-mode) |
48292 | 1363 |
1364 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
1365 gdb-invalidate-registers | |
1366 "server info registers\n" | |
1367 gdb-info-registers-handler | |
1368 gdb-info-registers-custom) | |
1369 | |
1370 (defun gdb-info-registers-custom ()) | |
1371 | |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1372 (defvar gdb-registers-mode-map |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1373 (let ((map (make-sparse-keymap))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1374 (suppress-keymap map) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1375 map)) |
48292 | 1376 |
1377 (defun gdb-registers-mode () | |
1378 "Major mode for gdb registers. | |
1379 | |
1380 \\{gdb-registers-mode-map}" | |
1381 (setq major-mode 'gdb-registers-mode) | |
1382 (setq mode-name "Registers") | |
1383 (setq buffer-read-only t) | |
1384 (use-local-map gdb-registers-mode-map) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1385 (gdb-invalidate-registers)) |
48292 | 1386 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1387 (defun gdb-registers-buffer-name () |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1388 (with-current-buffer gud-comint-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1389 (concat "*registers of " (gdb-get-target-string) "*"))) |
48292 | 1390 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1391 (defun gdb-display-registers-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1392 (interactive) |
48292 | 1393 (gdb-display-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1394 (gdb-get-create-buffer 'gdb-registers-buffer))) |
48292 | 1395 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1396 (defun gdb-frame-registers-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1397 (interactive) |
48292 | 1398 (switch-to-buffer-other-frame |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1399 (gdb-get-create-buffer 'gdb-registers-buffer))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1400 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1401 ;; |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1402 ;; Locals buffer. |
48292 | 1403 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1404 (gdb-set-buffer-rules 'gdb-locals-buffer |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1405 'gdb-locals-buffer-name |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1406 'gdb-locals-mode) |
48292 | 1407 |
1408 (def-gdb-auto-updated-buffer gdb-locals-buffer | |
1409 gdb-invalidate-locals | |
1410 "server info locals\n" | |
1411 gdb-info-locals-handler | |
1412 gdb-info-locals-custom) | |
1413 | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1414 ;; Abbreviate for arrays and structures. |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1415 ;; These can be expanded using gud-display. |
48292 | 1416 (defun gdb-info-locals-handler nil |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1417 (gdb-set-pending-triggers (delq 'gdb-invalidate-locals |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1418 (gdb-get-pending-triggers))) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1419 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1420 (with-current-buffer buf |
48292 | 1421 (goto-char (point-min)) |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1422 (while (re-search-forward "^ .*\n" nil t) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1423 (replace-match "" nil nil)) |
48292 | 1424 (goto-char (point-min)) |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1425 (while (re-search-forward "{[-0-9, {}\]*\n" nil t) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1426 (replace-match "(array);\n" nil nil)) |
48292 | 1427 (goto-char (point-min)) |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1428 (while (re-search-forward "{.*=.*\n" nil t) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1429 (replace-match "(structure);\n" nil nil)))) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1430 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1431 (and buf (with-current-buffer buf |
48292 | 1432 (let ((p (point)) |
1433 (buffer-read-only nil)) | |
1434 (delete-region (point-min) (point-max)) | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1435 (insert-buffer-substring (gdb-get-create-buffer |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1436 'gdb-partial-output-buffer)) |
48292 | 1437 (goto-char p))))) |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
1438 (run-hooks 'gdb-info-locals-hook)) |
48292 | 1439 |
1440 (defun gdb-info-locals-custom () | |
1441 nil) | |
1442 | |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1443 (defvar gdb-locals-mode-map |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1444 (let ((map (make-sparse-keymap))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1445 (suppress-keymap map) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1446 map)) |
48292 | 1447 |
1448 (defun gdb-locals-mode () | |
1449 "Major mode for gdb locals. | |
1450 | |
1451 \\{gdb-locals-mode-map}" | |
1452 (setq major-mode 'gdb-locals-mode) | |
1453 (setq mode-name "Locals") | |
1454 (setq buffer-read-only t) | |
1455 (use-local-map gdb-locals-mode-map) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1456 (gdb-invalidate-locals)) |
48292 | 1457 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1458 (defun gdb-locals-buffer-name () |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1459 (with-current-buffer gud-comint-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1460 (concat "*locals of " (gdb-get-target-string) "*"))) |
48292 | 1461 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1462 (defun gdb-display-locals-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1463 (interactive) |
48292 | 1464 (gdb-display-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1465 (gdb-get-create-buffer 'gdb-locals-buffer))) |
48292 | 1466 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1467 (defun gdb-frame-locals-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1468 (interactive) |
48292 | 1469 (switch-to-buffer-other-frame |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1470 (gdb-get-create-buffer 'gdb-locals-buffer))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1471 |
48292 | 1472 |
1473 ;;;; Window management | |
1474 | |
1475 ;;; The way we abuse the dedicated-p flag is pretty gross, but seems | |
1476 ;;; to do the right thing. Seeing as there is no way for Lisp code to | |
1477 ;;; get at the use_time field of a window, I'm not sure there exists a | |
1478 ;;; more elegant solution without writing C code. | |
1479 | |
1480 (defun gdb-display-buffer (buf &optional size) | |
1481 (let ((must-split nil) | |
1482 (answer nil)) | |
1483 (unwind-protect | |
1484 (progn | |
1485 (walk-windows | |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1486 #'(lambda (win) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1487 (if (or (eq gud-comint-buffer (window-buffer win)) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1488 (eq gdb-source-window win)) |
48292 | 1489 (set-window-dedicated-p win t)))) |
1490 (setq answer (get-buffer-window buf)) | |
1491 (if (not answer) | |
1492 (let ((window (get-lru-window))) | |
1493 (if window | |
1494 (progn | |
1495 (set-window-buffer window buf) | |
1496 (setq answer window)) | |
1497 (setq must-split t))))) | |
1498 (walk-windows | |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1499 #'(lambda (win) |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1500 (if (or (eq gud-comint-buffer (window-buffer win)) |
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1501 (eq gdb-source-window win)) |
48292 | 1502 (set-window-dedicated-p win nil))))) |
1503 (if must-split | |
1504 (let* ((largest (get-largest-window)) | |
1505 (cur-size (window-height largest)) | |
1506 (new-size (and size (< size cur-size) (- cur-size size)))) | |
1507 (setq answer (split-window largest new-size)) | |
1508 (set-window-buffer answer buf))) | |
1509 answer)) | |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
1510 |
48292 | 1511 (defun gdb-display-source-buffer (buffer) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1512 (if (eq gdb-selected-view 'source) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1513 (progn |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1514 (if (window-live-p gdb-source-window) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1515 (set-window-buffer gdb-source-window buffer) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1516 (gdb-display-buffer buffer) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1517 (setq gdb-source-window (get-buffer-window buffer))) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1518 gdb-source-window) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1519 (if (window-live-p gdb-source-window) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1520 (set-window-buffer gdb-source-window |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1521 (gdb-get-buffer 'gdb-assembler-buffer)) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1522 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer))) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1523 (gdb-display-buffer buf) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1524 (setq gdb-source-window (get-buffer-window buf)))) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1525 nil)) |
48292 | 1526 |
1527 | |
1528 ;;; Shared keymap initialization: | |
1529 | |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
1530 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1531 (define-key gud-menu-map [frames] |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1532 `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba))) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1533 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1534 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1535 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1536 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1537 (define-key menu [breakpoints] '("Breakpoints" . gdb-frame-breakpoints-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1538 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
1539 ; (define-key menu [assembler] '("Machine" . gdb-frame-assembler-buffer)) |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1540 ) |
48292 | 1541 |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1542 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
1543 (define-key gud-menu-map [displays] |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1544 `(menu-item "GDB-Windows" ,menu :visible (eq gud-minor-mode 'gdba))) |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1545 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1546 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1547 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1548 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1549 (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer)) |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1550 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
1551 ; (define-key menu [assembler] '("Machine" . gdb-display-assembler-buffer)) |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1552 ) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1553 |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1554 (let ((menu (make-sparse-keymap "View"))) |
52066
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1555 (define-key gud-menu-map [view] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1556 `(menu-item "View" ,menu :visible (eq gud-minor-mode 'gdba))) |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1557 ; (define-key menu [both] '(menu-item "Both" gdb-view-both |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1558 ; :help "Display both source and assembler" |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1559 ; :button (:radio . (eq gdb-selected-view 'both)))) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
1560 (define-key menu [assembler] '(menu-item "Machine" gdb-view-assembler |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1561 :help "Display assembler only" |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1562 :button (:radio . (eq gdb-selected-view 'assembler)))) |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
1563 (define-key menu [source] '(menu-item "Source" gdb-view-source-function |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1564 :help "Display source only" |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1565 :button (:radio . (eq gdb-selected-view 'source))))) |
48292 | 1566 |
52066
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1567 (let ((menu (make-sparse-keymap "GDB-UI"))) |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1568 (define-key gud-menu-map [ui] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1569 `(menu-item "GDB-UI" ,menu :visible (eq gud-minor-mode 'gdba))) |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1570 (define-key menu [gdb-restore-windows] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1571 '("Restore window layout" . gdb-restore-windows)) |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1572 (define-key menu [gdb-many-windows] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1573 (menu-bar-make-toggle gdb-many-windows gdb-many-windows |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1574 "Display other windows" "Many Windows %s" |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1575 "Display locals, stack and breakpoint information"))) |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1576 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1577 (defun gdb-frame-gdb-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1578 (interactive) |
48292 | 1579 (switch-to-buffer-other-frame |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1580 (gdb-get-create-buffer 'gdba))) |
48292 | 1581 |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1582 (defun gdb-display-gdb-buffer () |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1583 (interactive) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1584 (gdb-display-buffer |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1585 (gdb-get-create-buffer 'gdba))) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1586 |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1587 (defvar gdb-main-file nil "Source file from which program execution begins.") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1588 |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
1589 (defun gdb-view-source-function () |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1590 (interactive) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1591 (if gdb-view-source |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1592 (if gud-last-last-frame |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1593 (set-window-buffer gdb-source-window |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1594 (gud-find-file (car gud-last-last-frame))) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1595 (set-window-buffer gdb-source-window (gud-find-file gdb-main-file)))) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1596 (setq gdb-selected-view 'source)) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1597 |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1598 (defun gdb-view-assembler() |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1599 (interactive) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1600 (set-window-buffer gdb-source-window |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1601 (gdb-get-create-buffer 'gdb-assembler-buffer)) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1602 (setq gdb-selected-view 'assembler)) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1603 |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1604 ;(defun gdb-view-both() |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1605 ;(interactive) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1606 ;(setq gdb-selected-view 'both)) |
48292 | 1607 |
1608 ;; layout for all the windows | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1609 (defun gdb-setup-windows () |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1610 (gdb-display-locals-buffer) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1611 (gdb-display-stack-buffer) |
48292 | 1612 (delete-other-windows) |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1613 (gdb-display-breakpoints-buffer) |
48292 | 1614 (delete-other-windows) |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
1615 (switch-to-buffer gud-comint-buffer) |
48292 | 1616 (split-window nil ( / ( * (window-height) 3) 4)) |
1617 (split-window nil ( / (window-height) 3)) | |
1618 (split-window-horizontally) | |
1619 (other-window 1) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1620 (switch-to-buffer (gdb-locals-buffer-name)) |
48292 | 1621 (other-window 1) |
52066
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1622 (if (and gdb-view-source |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1623 (eq gdb-selected-view 'source)) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1624 (switch-to-buffer |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1625 (if gud-last-last-frame |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1626 (gud-find-file (car gud-last-last-frame)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1627 (gud-find-file gdb-main-file))) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1628 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))) |
48292 | 1629 (setq gdb-source-window (get-buffer-window (current-buffer))) |
1630 (split-window-horizontally) | |
1631 (other-window 1) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1632 (switch-to-buffer (gdb-inferior-io-name)) |
48292 | 1633 (other-window 1) |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1634 (switch-to-buffer (gdb-stack-buffer-name)) |
48292 | 1635 (split-window-horizontally) |
1636 (other-window 1) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1637 (switch-to-buffer (gdb-breakpoints-buffer-name)) |
48292 | 1638 (other-window 1)) |
1639 | |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1640 (defcustom gdb-many-windows nil |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1641 "Nil means that gdb starts with just two windows : the GUD and |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1642 the source buffer." |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1643 :type 'boolean |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1644 :group 'gud) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1645 |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1646 (defun gdb-many-windows (arg) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1647 "Toggle the number of windows in the basic arrangement." |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1648 (interactive "P") |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1649 (setq gdb-many-windows |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1650 (if (null arg) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1651 (not gdb-many-windows) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1652 (> (prefix-numeric-value arg) 0))) |
48600
88be03de9df4
(gdb-many-windows): Define as a minor mode.
Nick Roberts <nickrob@snap.net.nz>
parents:
48570
diff
changeset
|
1653 (gdb-restore-windows)) |
88be03de9df4
(gdb-many-windows): Define as a minor mode.
Nick Roberts <nickrob@snap.net.nz>
parents:
48570
diff
changeset
|
1654 |
48292 | 1655 (defun gdb-restore-windows () |
1656 "Restore the basic arrangement of windows used by gdba. | |
48498
8fdedd7dca85
General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents:
48300
diff
changeset
|
1657 This arrangement depends on the value of `gdb-many-windows'." |
48292 | 1658 (interactive) |
1659 (if gdb-many-windows | |
1660 (progn | |
1661 (switch-to-buffer gud-comint-buffer) | |
1662 (delete-other-windows) | |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1663 (gdb-setup-windows)) |
48292 | 1664 (switch-to-buffer gud-comint-buffer) |
1665 (delete-other-windows) | |
1666 (split-window) | |
1667 (other-window 1) | |
52066
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1668 (if (and gdb-view-source |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1669 (eq gdb-selected-view 'source)) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1670 (switch-to-buffer |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1671 (if gud-last-last-frame |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1672 (gud-find-file (car gud-last-last-frame)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1673 (gud-find-file gdb-main-file))) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1674 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1675 (setq gdb-source-window (get-buffer-window (current-buffer))) |
48292 | 1676 (other-window 1))) |
1677 | |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1678 (defun gdb-reset () |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1679 "Exit a debugging session cleanly by killing the gdb buffers and resetting |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1680 the source buffers." |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1681 (dolist (buffer (buffer-list)) |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1682 (if (not (eq buffer gud-comint-buffer)) |
49249 | 1683 (with-current-buffer buffer |
52698
367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents:
52443
diff
changeset
|
1684 (if (memq gud-minor-mode '(gdba pdb)) |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1685 (if (string-match "^\*.+*$" (buffer-name)) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1686 (kill-buffer nil) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1687 (if (display-images-p) |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1688 (remove-images (point-min) (point-max)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1689 (gdb-remove-strings (point-min) (point-max))) |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1690 (setq left-margin-width 0) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1691 (setq gud-minor-mode nil) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1692 (kill-local-variable 'tool-bar-map) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1693 (setq gud-running nil) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1694 (if (get-buffer-window (current-buffer)) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1695 (set-window-margins (get-buffer-window |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1696 (current-buffer)) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1697 left-margin-width |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1698 right-margin-width)))))))) |
48292 | 1699 |
1700 (defun gdb-source-info () | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
1701 "Find the source file where the program starts and displays it with related |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
1702 buffers." |
48292 | 1703 (goto-char (point-min)) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1704 (if (search-forward "directory is " nil t) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1705 (progn |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1706 (if (looking-at "\\S-*:\\(\\S-*\\)") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1707 (setq gdb-cdir (match-string 1)) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1708 (looking-at "\\S-*") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1709 (setq gdb-cdir (match-string 0))) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1710 (search-forward "Located in ") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1711 (looking-at "\\S-*") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1712 (setq gdb-main-file (match-string 0))) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1713 (setq gdb-view-source nil)) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1714 (delete-other-windows) |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
1715 (switch-to-buffer gud-comint-buffer) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1716 (if gdb-many-windows |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1717 (gdb-setup-windows) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1718 (gdb-display-breakpoints-buffer) |
48292 | 1719 (delete-other-windows) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1720 (split-window) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1721 (other-window 1) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1722 (if gdb-view-source |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
1723 (switch-to-buffer |
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
1724 (if gud-last-last-frame |
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
1725 (gud-find-file (car gud-last-last-frame)) |
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
1726 (gud-find-file gdb-main-file))) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1727 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1728 (setq gdb-source-window (get-buffer-window (current-buffer))) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1729 (other-window 1))) |
48292 | 1730 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
1731 ;;from put-image |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1732 (defun gdb-put-string (putstring pos) |
48292 | 1733 "Put string PUTSTRING in front of POS in the current buffer. |
1734 PUTSTRING is displayed by putting an overlay into the current buffer with a | |
1735 `before-string' STRING that has a `display' property whose value is | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1736 PUTSTRING." |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1737 (let ((gdb-string "x") |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1738 (buffer (current-buffer))) |
48292 | 1739 (let ((overlay (make-overlay pos pos buffer)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1740 (prop (list (list 'margin 'left-margin) putstring))) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1741 (put-text-property 0 (length gdb-string) 'display prop gdb-string) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1742 (overlay-put overlay 'put-break t) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1743 (overlay-put overlay 'before-string gdb-string)))) |
48292 | 1744 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
1745 ;;from remove-images |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1746 (defun gdb-remove-strings (start end &optional buffer) |
48292 | 1747 "Remove strings between START and END in BUFFER. |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1748 Remove only strings that were put in BUFFER with calls to `put-string'. |
48292 | 1749 BUFFER nil or omitted means use the current buffer." |
1750 (unless buffer | |
1751 (setq buffer (current-buffer))) | |
1752 (let ((overlays (overlays-in start end))) | |
1753 (while overlays | |
1754 (let ((overlay (car overlays))) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1755 (when (overlay-get overlay 'put-break) |
48292 | 1756 (delete-overlay overlay))) |
1757 (setq overlays (cdr overlays))))) | |
1758 | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1759 (defun gdb-put-arrow (putstring pos) |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1760 "Put arrow string PUTSTRING in the left margin in front of POS |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1761 in the current buffer. PUTSTRING is displayed by putting an |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1762 overlay into the current buffer with a `before-string' |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1763 \"gdb-arrow\" that has a `display' property whose value is |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1764 PUTSTRING. POS may be an integer or marker." |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1765 (let ((gdb-string "gdb-arrow") |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1766 (buffer (current-buffer))) |
48292 | 1767 (let ((overlay (make-overlay pos pos buffer)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1768 (prop (list (list 'margin 'left-margin) putstring))) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1769 (put-text-property 0 (length gdb-string) 'display prop gdb-string) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1770 (overlay-put overlay 'put-arrow t) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1771 (overlay-put overlay 'before-string gdb-string)))) |
48292 | 1772 |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1773 (defun gdb-remove-arrow (&optional buffer) |
48292 | 1774 "Remove arrow in BUFFER. |
1775 Remove only images that were put in BUFFER with calls to `put-arrow'. | |
1776 BUFFER nil or omitted means use the current buffer." | |
1777 (unless buffer | |
1778 (setq buffer (current-buffer))) | |
1779 (let ((overlays (overlays-in (point-min) (point-max)))) | |
1780 (while overlays | |
1781 (let ((overlay (car overlays))) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1782 (when (overlay-get overlay 'put-arrow) |
48292 | 1783 (delete-overlay overlay))) |
1784 (setq overlays (cdr overlays))))) | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1785 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1786 ;; |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1787 ;; Assembler buffer. |
48292 | 1788 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1789 (gdb-set-buffer-rules 'gdb-assembler-buffer |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1790 'gdb-assembler-buffer-name |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1791 'gdb-assembler-mode) |
48292 | 1792 |
1793 (def-gdb-auto-updated-buffer gdb-assembler-buffer | |
1794 gdb-invalidate-assembler | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1795 (concat "server disassemble " gdb-current-address "\n") |
48292 | 1796 gdb-assembler-handler |
1797 gdb-assembler-custom) | |
1798 | |
1799 (defun gdb-assembler-custom () | |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1800 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1801 (gdb-arrow-position 1) (address) (flag)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1802 (with-current-buffer buffer |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1803 (if (not (equal gdb-current-address "main")) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1804 (progn |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1805 (gdb-remove-arrow) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1806 (goto-char (point-min)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1807 (if (re-search-forward gdb-current-address nil t) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1808 (progn |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1809 (setq gdb-arrow-position (point)) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1810 (gdb-put-arrow "=>" (point)))))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1811 ;; remove all breakpoint-icons in assembler buffer before updating. |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1812 (if (display-images-p) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1813 (remove-images (point-min) (point-max)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1814 (gdb-remove-strings (point-min) (point-max)))) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1815 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
48292 | 1816 (goto-char (point-min)) |
1817 (while (< (point) (- (point-max) 1)) | |
1818 (forward-line 1) | |
1819 (if (looking-at "[^\t].*breakpoint") | |
1820 (progn | |
1821 (looking-at | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1822 "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x\\(\\S-*\\)") |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1823 (setq flag (char-after (match-beginning 1))) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1824 (setq address (match-string 2)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1825 ;; remove leading 0s from output of info break. |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1826 (if (string-match "^0+\\(.*\\)" address) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1827 (setq address (match-string 1 address))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1828 (with-current-buffer buffer |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1829 (goto-char (point-min)) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1830 (if (re-search-forward address nil t) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1831 (let ((start (progn (beginning-of-line) (- (point) 1))) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1832 (end (progn (end-of-line) (+ (point) 1)))) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1833 (if (display-images-p) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1834 (progn |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1835 (remove-images start end) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1836 (if (eq ?y flag) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1837 (put-image breakpoint-enabled-icon |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1838 (+ start 1) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1839 "breakpoint icon enabled" |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1840 'left-margin) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1841 (put-image breakpoint-disabled-icon |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1842 (+ start 1) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1843 "breakpoint icon disabled" |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1844 'left-margin))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1845 (gdb-remove-strings start end) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1846 (if (eq ?y flag) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1847 (gdb-put-string "B" (+ start 1)) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1848 (gdb-put-string "b" (+ start 1))))))))))) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1849 (if (not (equal gdb-current-address "main")) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1850 (set-window-point (get-buffer-window buffer) gdb-arrow-position)))) |
48292 | 1851 |
48661
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1852 (defvar gdb-assembler-mode-map |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1853 (let ((map (make-sparse-keymap))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1854 (suppress-keymap map) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1855 map)) |
48292 | 1856 |
1857 (defun gdb-assembler-mode () | |
1858 "Major mode for viewing code assembler. | |
1859 | |
1860 \\{gdb-assembler-mode-map}" | |
1861 (setq major-mode 'gdb-assembler-mode) | |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
1862 (setq mode-name "Machine") |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1863 (setq left-margin-width 2) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1864 (setq fringes-outside-margins t) |
48292 | 1865 (setq buffer-read-only t) |
1866 (use-local-map gdb-assembler-mode-map) | |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1867 (gdb-invalidate-assembler)) |
48292 | 1868 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1869 (defun gdb-assembler-buffer-name () |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1870 (with-current-buffer gud-comint-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1871 (concat "*Machine Code " (gdb-get-target-string) "*"))) |
48292 | 1872 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1873 (defun gdb-display-assembler-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1874 (interactive) |
48292 | 1875 (gdb-display-buffer |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1876 (gdb-get-create-buffer 'gdb-assembler-buffer))) |
48292 | 1877 |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1878 (defun gdb-frame-assembler-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1879 (interactive) |
48292 | 1880 (switch-to-buffer-other-frame |
48921
3aa5ba679145
Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents:
48884
diff
changeset
|
1881 (gdb-get-create-buffer 'gdb-assembler-buffer))) |
48292 | 1882 |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1883 ;; modified because if gdb-current-address has changed value a new command |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
1884 ;; must be enqueued to update the buffer with the new output |
48515
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
1885 (defun gdb-invalidate-assembler (&optional ignored) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1886 (if (gdb-get-buffer 'gdb-assembler-buffer) |
48292 | 1887 (progn |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1888 (unless (string-equal gdb-current-frame gdb-previous-frame) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1889 (if (or (not (member 'gdb-invalidate-assembler |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1890 (gdb-get-pending-triggers))) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1891 (not (string-equal gdb-current-address |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1892 gdb-previous-address))) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1893 (progn |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1894 ;; take previous disassemble command off the queue |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1895 (with-current-buffer gud-comint-buffer |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
1896 (let ((queue (gdb-get-input-queue)) (item)) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1897 (dolist (item queue) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1898 (if (equal (cdr item) '(gdb-assembler-handler)) |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
1899 (gdb-set-input-queue |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
1900 (delete item (gdb-get-input-queue))))))) |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
1901 (gdb-enqueue-input |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1902 (list (concat "server disassemble " gdb-current-address "\n") |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1903 'gdb-assembler-handler)) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1904 (gdb-set-pending-triggers |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1905 (cons 'gdb-invalidate-assembler |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1906 (gdb-get-pending-triggers))) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1907 (setq gdb-previous-address gdb-current-address) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1908 (setq gdb-previous-frame gdb-current-frame))))))) |
48292 | 1909 |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1910 (defun gdb-get-current-frame () |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1911 (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers))) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1912 (progn |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
1913 (gdb-enqueue-input |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1914 (list (concat "server info frame\n") 'gdb-frame-handler)) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1915 (gdb-set-pending-triggers |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1916 (cons 'gdb-get-current-frame |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1917 (gdb-get-pending-triggers)))))) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1918 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1919 (defun gdb-frame-handler () |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1920 (gdb-set-pending-triggers |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1921 (delq 'gdb-get-current-frame (gdb-get-pending-triggers))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1922 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1923 (goto-char (point-min)) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1924 (forward-line) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1925 (if (looking-at ".*= 0x\\(\\S-*\\) in \\(\\S-*\\)") |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1926 (progn |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1927 (setq gdb-current-frame (match-string 2)) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1928 (let ((address (match-string 1))) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1929 ;; remove leading 0s from output of info frame command. |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1930 (if (string-match "^0+\\(.*\\)" address) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1931 (setq gdb-current-address |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1932 (concat "0x" (match-string 1 address))) |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1933 (setq gdb-current-address (concat "0x" address)))) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
1934 (if (or (if (not (looking-at ".*(\\S-*:[0-9]*)")) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1935 (progn (setq gdb-view-source nil) t)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1936 (eq gdb-selected-view 'assembler)) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1937 (progn |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1938 (set-window-buffer |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1939 gdb-source-window |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
1940 (gdb-get-create-buffer 'gdb-assembler-buffer)) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1941 ;;update with new frame for machine code if necessary |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
1942 (gdb-invalidate-assembler)))))) |
53249
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
1943 (forward-line) |
97802d013c5c
(gdba, gdb-assembler-mode): Call the mode "Machine" as
Nick Roberts <nickrob@snap.net.nz>
parents:
53193
diff
changeset
|
1944 (if (looking-at " source language \\(\\S-*\\)\.") |
52905
f27266006051
(gdb-current-language): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
52868
diff
changeset
|
1945 (setq gdb-current-language (match-string 1)))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1946 |
48292 | 1947 (provide 'gdb-ui) |
1948 | |
52401 | 1949 ;;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
48292 | 1950 ;;; gdb-ui.el ends here |