Mercurial > emacs
annotate lisp/gdb-ui.el @ 52632:6b379676c592
*** empty log message ***
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 26 Sep 2003 17:25:13 +0000 |
parents | 31a30e670e11 |
children | 367c1b29dbee |
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 | |
7 ;; Copyright (C) 2002 Free Software Foundation, Inc. | |
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 | |
38 ;; This file is based on gdba.el from GDB 5.0 written by Tom Lord and Jim | |
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 | |
42 ;; info manual. | |
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
|
43 ;; |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
44 ;; Known Bugs: |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
45 ;; Does not auto-display arrays of structures or structures containing arrays. |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
46 ;; On MS Windows, Gdb 5.1.1 from MinGW 2.0 does not flush the output from the |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
47 ;; inferior. |
48292 | 48 |
49 ;;; Code: | |
50 | |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
51 (require 'gud) |
48292 | 52 |
49249 | 53 (defcustom gdb-window-height 20 |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
54 "Number of lines in a frame for a displayed expression in GDB-UI." |
49249 | 55 :type 'integer |
56 :group 'gud) | |
57 | |
58 (defcustom gdb-window-width 30 | |
59 "Width of a frame for a displayed expression in GDB-UI." | |
60 :type 'integer | |
61 :group 'gud) | |
62 | |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
63 (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
|
64 (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
|
65 (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
|
66 (defvar gdb-current-frame "main") |
48498
8fdedd7dca85
General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents:
48300
diff
changeset
|
67 (defvar gdb-display-in-progress nil) |
8fdedd7dca85
General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents:
48300
diff
changeset
|
68 (defvar gdb-dive nil) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
69 (defvar gdb-view-source t "Non-nil means that source code can be viewed") |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
70 (defvar gdb-selected-view 'source "Code type that user wishes to view") |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
71 (defvar gdb-buffer-type nil) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
72 (defvar gdb-variables '() |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
73 "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
|
74 |
48292 | 75 |
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
|
76 ;;;###autoload |
48292 | 77 (defun gdba (command-line) |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
78 "Run gdb on program FILE in buffer *gud-FILE*. |
48292 | 79 The directory containing FILE becomes the initial working directory |
80 and source-file directory for your debugger. | |
81 | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
82 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
|
83 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
|
84 following layout will appear (keybindings given in relevant buffer) : |
48292 | 85 |
86 --------------------------------------------------------------------- | |
87 GDB Toolbar | |
88 --------------------------------------------------------------------- | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
89 GUD buffer (I/O of GDB) | Locals buffer |
48292 | 90 | |
91 | | |
92 | | |
93 --------------------------------------------------------------------- | |
94 Source buffer | Input/Output (of debuggee) buffer | |
95 | (comint-mode) | |
96 | | |
97 | | |
98 | | |
99 | | |
100 | | |
101 | | |
102 --------------------------------------------------------------------- | |
103 Stack buffer | Breakpoints buffer | |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
104 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
|
105 | RET gdb-goto-breakpoint |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
106 | d gdb-delete-breakpoint |
48292 | 107 --------------------------------------------------------------------- |
108 | |
109 All the buffers share the toolbar and source should always display in the same | |
110 window e.g after typing g on a breakpoint in the breakpoints buffer. Breakpoint | |
111 icons are displayed both by setting a break with gud-break and by typing break | |
112 in the GUD buffer. | |
113 | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
114 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
|
115 screen. |
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
116 |
48292 | 117 Displayed expressions appear in separate frames. Arrays may be displayed |
118 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
|
119 Pointers in structures may be followed in a tree-like fashion. |
48292 | 120 |
121 The following interactive lisp functions help control operation : | |
122 | |
48827
dc51e4b2d5c1
Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48738
diff
changeset
|
123 `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
|
124 `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
|
125 ;; |
48292 | 126 (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
|
127 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
128 ;; 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
|
129 (gdb command-line) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
130 ;; |
48292 | 131 (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
|
132 (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
|
133 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
134 (gud-def gud-break (if (not (string-equal mode-name "Assembler")) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
135 (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
|
136 (save-excursion |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
137 (beginning-of-line) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
138 (forward-char 2) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
139 (gud-call "break *%a" arg))) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
140 "\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
|
141 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
142 (gud-def gud-remove (if (not (string-equal mode-name "Assembler")) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
143 (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
|
144 (save-excursion |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
145 (beginning-of-line) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
146 (forward-char 2) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
147 (gud-call "clear *%a" arg))) |
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
148 "\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
|
149 ;; |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
150 (gud-def gud-until (if (not (string-equal mode-name "Assembler")) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
151 (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
|
152 (save-excursion |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
153 (beginning-of-line) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
154 (forward-char 2) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
155 (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
|
156 "\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
|
157 |
48292 | 158 (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
|
159 ;; |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
160 ;; (re-)initialise |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
161 (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
|
162 (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
|
163 (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
|
164 (setq gdb-current-frame "main") |
48292 | 165 (setq gdb-display-in-progress nil) |
166 (setq gdb-dive nil) | |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
167 (setq gdb-view-source t) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
168 (setq gdb-selected-view 'source) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
169 ;; |
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
|
170 (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
|
171 (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
|
172 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
173 (gdb-clear-inferior-io) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
174 ;; |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
175 (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
|
176 (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
|
177 (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
|
178 ;; 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
|
179 (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
|
180 (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
|
181 (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
|
182 ;; |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
183 (run-hooks 'gdba-mode-hook)) |
48292 | 184 |
185 (defun gud-display () | |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
186 "Auto-display (possibly dereferenced) C expression at point." |
48292 | 187 (interactive) |
188 (save-excursion | |
189 (let ((expr (gud-find-c-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
|
190 (gdb-enqueue-input |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
191 (list (concat "server ptype " expr "\n") |
48292 | 192 `(lambda () (gud-display1 ,expr))))))) |
193 | |
194 (defun gud-display1 (expr) | |
195 (goto-char (point-min)) | |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
196 (if (looking-at "No symbol") |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
197 (progn |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
198 (gdb-set-output-sink 'user) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
199 (gud-call (concat "server ptype " expr))) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
200 (goto-char (- (point-max) 1)) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
201 (if (equal (char-before) (string-to-char "\*")) |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
202 (gud-call (concat "display* " expr)) |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
203 (gud-call (concat "display " expr))))) |
48292 | 204 |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
205 ; this would messy because these bindings don't work with M-x gdb |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
206 ; (define-key global-map "\C-x\C-a\C-a" 'gud-display) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
207 ; (define-key gud-minor-mode-map "\C-c\C-a" 'gud-display) |
48292 | 208 |
209 | |
210 | |
211 ;; ====================================================================== | |
212 ;; | |
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
|
213 ;; In this world, there are gdb variables (of unspecified |
48292 | 214 ;; 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
|
215 ;; 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
|
216 ;; def-gdb-variable |
48292 | 217 |
218 (defmacro def-gdb-var (root-symbol &optional default doc) | |
219 (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
|
220 (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
|
221 (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
|
222 (name (intern (concat "gdb-" root)))) |
7bc8b0b65a02
(gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48639
diff
changeset
|
223 `(progn |
7bc8b0b65a02
(gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48639
diff
changeset
|
224 (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
|
225 (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
|
226 (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
|
227 (defun ,accessor () |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
228 (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
|
229 (defun ,setter (val) |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
230 (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
|
231 (setq ,name val)))))) |
48292 | 232 |
233 (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
|
234 "One of the symbols bound in gdb-buffer-rules") |
48292 | 235 |
236 (def-gdb-var burst "" | |
237 "A string of characters from gdb that have not yet been processed.") | |
238 | |
239 (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
|
240 "A list of gdb command objects.") |
48292 | 241 |
242 (def-gdb-var prompting nil | |
243 "True when gdb is idle with no pending input.") | |
244 | |
245 (def-gdb-var output-sink 'user | |
246 "The disposition of the output of the current gdb command. | |
247 Possible values are these symbols: | |
248 | |
249 user -- gdb output should be copied to the GUD buffer | |
250 for the user to see. | |
251 | |
252 inferior -- gdb output should be copied to the inferior-io buffer | |
253 | |
254 pre-emacs -- output should be ignored util the post-prompt | |
255 annotation is received. Then the output-sink | |
256 becomes:... | |
257 emacs -- output should be collected in the partial-output-buffer | |
258 for subsequent processing by a command. This is the | |
259 disposition of output generated by commands that | |
260 gdb mode sends to gdb on its own behalf. | |
261 post-emacs -- ignore input until the prompt annotation is | |
262 received, then go to USER disposition. | |
263 ") | |
264 | |
265 (def-gdb-var current-item nil | |
266 "The most recent command item sent to gdb.") | |
267 | |
268 (def-gdb-var pending-triggers '() | |
269 "A list of trigger functions that have run later than their output | |
270 handlers.") | |
271 | |
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
|
272 ;; end of gdb variables |
48292 | 273 |
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
|
274 (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
|
275 (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
|
276 gud-target-name)) |
48292 | 277 |
278 | |
279 ;; | |
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
|
280 ;; gdb buffers. |
48292 | 281 ;; |
282 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
283 ;; of that particular buffer. | |
284 ;; | |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
285 ;; The usual gdb interaction buffer is given the type `gdba' and |
48292 | 286 ;; is constructed specially. |
287 ;; | |
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
|
288 ;; 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
|
289 ;; named according to the rules set forth in the gdb-buffer-rules-assoc |
48292 | 290 |
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
|
291 (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
|
292 |
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
|
293 (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
|
294 "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
|
295 The key should be one of the cars in `gdb-buffer-rules-assoc'." |
48292 | 296 (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
|
297 (gdb-look-for-tagged-buffer key (buffer-list)))) |
48292 | 298 |
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
|
299 (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
|
300 "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
|
301 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
|
302 (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
|
303 (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
|
304 (name (funcall (gdb-rules-name-maker rules))) |
48292 | 305 (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
|
306 (with-current-buffer new |
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
307 ;; 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
|
308 ;; 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
|
309 (set (make-local-variable 'gdb-buffer-type) key) |
48292 | 310 (if (cdr (cdr rules)) |
311 (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
|
312 (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
|
313 (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
|
314 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
48292 | 315 new)))) |
316 | |
317 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
318 | |
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
|
319 (defun gdb-look-for-tagged-buffer (key bufs) |
48292 | 320 (let ((retval nil)) |
321 (while (and (not retval) bufs) | |
322 (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
|
323 (if (eq gdb-buffer-type key) |
48292 | 324 (setq retval (car bufs))) |
325 (setq bufs (cdr bufs))) | |
326 retval)) | |
327 | |
328 ;; | |
329 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
330 ;; at least one and possible more functions. The functions have these | |
331 ;; roles in defining a buffer type: | |
332 ;; | |
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
|
333 ;; 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
|
334 ;; |
48292 | 335 ;; The remaining function(s) are optional: |
336 ;; | |
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
|
337 ;; MODE - called in a new buffer with no arguments, should establish |
48292 | 338 ;; the proper mode for the buffer. |
339 ;; | |
340 | |
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
|
341 (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
|
342 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) |
48292 | 343 (if binding |
344 (setcdr binding rules) | |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
345 (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
|
346 gdb-buffer-rules-assoc)))) |
48292 | 347 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
348 ;; 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
|
349 (gdb-set-buffer-rules 'gdba 'error) |
48292 | 350 |
351 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
352 ;; Partial-output buffer : This accumulates output from a command executed on |
48292 | 353 ;; behalf of emacs (rather than the user). |
354 ;; | |
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
|
355 (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
|
356 'gdb-partial-output-name) |
48292 | 357 |
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
|
358 (defun gdb-partial-output-name () |
48292 | 359 (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
|
360 (gdb-get-target-string) |
48292 | 361 "*")) |
362 | |
363 | |
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 (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
|
365 '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
|
366 'gdb-inferior-io-mode) |
48292 | 367 |
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
|
368 (defun gdb-inferior-io-name () |
48292 | 369 (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
|
370 (gdb-get-target-string) |
48292 | 371 "*")) |
372 | |
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
|
373 (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
|
374 (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
|
375 (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
|
376 (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
|
377 (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
|
378 (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
|
379 map)) |
48292 | 380 |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
381 (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
|
382 "Major mode for gdb inferior-io." |
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
383 :syntax-table nil :abbrev-table nil |
48292 | 384 ;; We want to use comint because it has various nifty and familiar |
385 ;; features. We don't need a process, but comint wants one, so create | |
386 ;; a dummy one. | |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
387 (make-comint-in-buffer |
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
388 (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
|
389 (current-buffer) "hexl") |
48292 | 390 (setq comint-input-sender 'gdb-inferior-io-sender)) |
391 | |
392 (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
|
393 ;; 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
|
394 (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
|
395 (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
|
396 (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
|
397 (process-send-string proc "\n"))) |
48292 | 398 |
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
|
399 (defun gdb-inferior-io-interrupt () |
48292 | 400 "Interrupt the program being debugged." |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
401 (interactive) |
48292 | 402 (interrupt-process |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
403 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
48292 | 404 |
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
|
405 (defun gdb-inferior-io-quit () |
48292 | 406 "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
|
407 (interactive) |
48292 | 408 (quit-process |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
409 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
48292 | 410 |
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
|
411 (defun gdb-inferior-io-stop () |
48292 | 412 "Stop the program being debugged." |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
413 (interactive) |
48292 | 414 (stop-process |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
415 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
48292 | 416 |
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
|
417 (defun gdb-inferior-io-eof () |
48292 | 418 "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
|
419 (interactive) |
48292 | 420 (process-send-eof |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
421 (get-buffer-process gud-comint-buffer))) |
48292 | 422 |
423 | |
424 ;; | |
425 ;; gdb communications | |
426 ;; | |
427 | |
428 ;; INPUT: things sent to gdb | |
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 ;; 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
|
431 ;; user-like input) or a list of the form: |
48292 | 432 ;; |
433 ;; (INPUT-STRING HANDLER-FN) | |
434 ;; | |
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
|
435 ;; 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
|
436 ;; 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
|
437 ;; commands autonomously. |
48292 | 438 ;; |
439 ;; These lists are consumed tail first. | |
440 ;; | |
441 | |
442 (defun gdb-send (proc string) | |
443 "A comint send filter for gdb. | |
444 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
|
445 (gdb-enqueue-input (concat string "\n"))) |
48292 | 446 |
447 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
448 ;; is a query, or other non-top-level prompt. |
48292 | 449 |
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
|
450 (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
|
451 (if (gdb-get-prompting) |
48292 | 452 (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
|
453 (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
|
454 (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
|
455 (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
|
456 (cons item (gdb-get-input-queue))))) |
48292 | 457 |
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
|
458 (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
|
459 (let ((queue (gdb-get-input-queue))) |
48292 | 460 (and queue |
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
|
461 (if (not (cdr 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
|
462 (let ((answer (car 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
|
463 (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
|
464 answer) |
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
|
465 (gdb-take-last-elt queue))))) |
48292 | 466 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
467 ;; Don't use this in general. |
48292 | 468 (defun gdb-take-last-elt (l) |
469 (if (cdr (cdr l)) | |
470 (gdb-take-last-elt (cdr l)) | |
471 (let ((answer (car (cdr l)))) | |
472 (setcdr l '()) | |
473 answer))) | |
474 | |
475 | |
476 ;; | |
477 ;; output -- things gdb prints to emacs | |
478 ;; | |
479 ;; GDB output is a stream interrupted by annotations. | |
480 ;; Annotations can be recognized by their beginning | |
481 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
482 ;; | |
483 ;; The tag is a string obeying symbol syntax. | |
484 ;; | |
485 ;; The optional part `<opt>' can be either the empty string | |
486 ;; or a space followed by more data relating to the annotation. | |
487 ;; For example, the SOURCE annotation is followed by a filename, | |
488 ;; line number and various useless goo. This data must not include | |
489 ;; any newlines. | |
490 ;; | |
491 | |
51172
61a988cae9b2
(gdba): Accommodate Fortran programs.
Nick Roberts <nickrob@snap.net.nz>
parents:
51123
diff
changeset
|
492 (defcustom gud-gdba-command-name "gdb -annotate=2 -noasync" |
48682
a74dd42cf01d
(gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48662
diff
changeset
|
493 "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
|
494 :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
|
495 :group 'gud) |
48292 | 496 |
497 (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
|
498 '(("pre-prompt" gdb-pre-prompt) |
48292 | 499 ("prompt" gdb-prompt) |
500 ("commands" gdb-subprompt) | |
501 ("overload-choice" gdb-subprompt) | |
502 ("query" gdb-subprompt) | |
503 ("prompt-for-continue" gdb-subprompt) | |
504 ("post-prompt" gdb-post-prompt) | |
505 ("source" gdb-source) | |
506 ("starting" gdb-starting) | |
507 ("exited" gdb-stopping) | |
508 ("signalled" gdb-stopping) | |
509 ("signal" gdb-stopping) | |
510 ("breakpoint" gdb-stopping) | |
511 ("watchpoint" gdb-stopping) | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
512 ("frame-begin" gdb-frame-begin) |
48292 | 513 ("stopped" gdb-stopped) |
514 ("display-begin" gdb-display-begin) | |
515 ("display-end" gdb-display-end) | |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
516 ; GDB commands info stack, info locals and frame generate an error-begin |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
517 ; annotation at start when there is no stack but this is a quirk/bug in |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
518 ; annotations. |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
519 ; ("error-begin" gdb-error-begin) |
48292 | 520 ("display-number-end" gdb-display-number-end) |
521 ("array-section-begin" gdb-array-section-begin) | |
522 ("array-section-end" gdb-array-section-end) | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
523 ;; ("elt" gdb-elt) |
48292 | 524 ("field-begin" gdb-field-begin) |
525 ("field-end" gdb-field-end) | |
526 ) "An assoc mapping annotation tags to functions which process them.") | |
527 | |
528 (defconst gdb-source-spec-regexp | |
529 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:\\(0x[a-f0-9]*\\)") | |
530 | |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
531 ;; 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
|
532 (defun gdb-source (args) |
48292 | 533 (string-match gdb-source-spec-regexp args) |
534 ;; Extract the frame position from the marker. | |
535 (setq gud-last-frame | |
536 (cons | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
537 (match-string 1 args) |
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
538 (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
|
539 (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
|
540 (setq gdb-view-source t)) |
48292 | 541 |
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
|
542 (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
|
543 (gdb-set-current-item item) |
48292 | 544 (if (stringp item) |
545 (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
|
546 (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
|
547 (process-send-string (get-buffer-process gud-comint-buffer) item)) |
48292 | 548 (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
|
549 (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
|
550 (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
|
551 (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
|
552 (car item))))) |
48292 | 553 |
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
|
554 (defun gdb-pre-prompt (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
555 "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
|
556 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
|
557 (let ((sink (gdb-get-output-sink))) |
48292 | 558 (cond |
559 ((eq sink 'user) t) | |
560 ((eq sink '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
|
561 (gdb-set-output-sink 'post-emacs) |
48292 | 562 (let ((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
|
563 (car (cdr (gdb-get-current-item))))) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
564 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
48292 | 565 (funcall handler)))) |
566 (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
|
567 (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
|
568 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
48292 | 569 |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
570 (defun gdb-prompt (ignored) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
571 "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
|
572 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
|
573 (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
|
574 (cond |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
575 ((eq sink 'user) t) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
576 ((eq sink 'post-emacs) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
577 (gdb-set-output-sink 'user)) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
578 (t |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
579 (gdb-set-output-sink 'user) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
580 (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
|
581 (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
|
582 (if input |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
583 (gdb-send-item input) |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
584 (progn |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
585 (gdb-set-prompting t) |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
586 (gud-display-frame))))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
587 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
588 (defun gdb-subprompt (ignored) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
589 "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
|
590 (gdb-set-prompting t)) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
591 |
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 (defun gdb-starting (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
593 "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
|
594 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
|
595 (let ((sink (gdb-get-output-sink))) |
48292 | 596 (cond |
597 ((eq sink 'user) | |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
598 (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
|
599 (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
|
600 (gdb-set-output-sink 'inferior))) |
48292 | 601 (t (error "Unexpected `starting' annotation"))))) |
602 | |
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
|
603 (defun gdb-stopping (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
604 "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
|
605 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
|
606 (let ((sink (gdb-get-output-sink))) |
48292 | 607 (cond |
608 ((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
|
609 (gdb-set-output-sink 'user)) |
48292 | 610 (t (error "Unexpected stopping annotation"))))) |
611 | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
612 (defun gdb-frame-begin (ignored) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
613 (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
|
614 (cond |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
615 ((eq sink 'inferior) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
616 (gdb-set-output-sink 'user)) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
617 ((eq sink 'user) t) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
618 ((eq sink 'emacs) t) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
619 (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
|
620 |
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
|
621 (defun gdb-stopped (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
622 "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
|
623 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
|
624 (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
|
625 (let ((sink (gdb-get-output-sink))) |
48292 | 626 (cond |
627 ((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
|
628 (gdb-set-output-sink 'user)) |
48292 | 629 ((eq sink 'user) t) |
630 (t (error "Unexpected stopped annotation"))))) | |
631 | |
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
|
632 (defun gdb-post-prompt (ignored) |
48570
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
633 "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
|
634 output from the current command if that happens to be appropriate." |
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
|
635 (if (not (gdb-get-pending-triggers)) |
48292 | 636 (progn |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
637 (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
|
638 (gdb-invalidate-frames) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
639 (gdb-invalidate-breakpoints) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
640 (gdb-invalidate-assembler) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
641 (gdb-invalidate-registers) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
642 (gdb-invalidate-locals) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
643 (gdb-invalidate-display) |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
644 (gdb-invalidate-threads))) |
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
|
645 (let ((sink (gdb-get-output-sink))) |
48292 | 646 (cond |
647 ((eq sink 'user) t) | |
648 ((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
|
649 (gdb-set-output-sink 'emacs)) |
48292 | 650 (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
|
651 (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
|
652 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
48292 | 653 |
654 ;; If we get an error whilst evaluating one of the expressions | |
655 ;; we won't get the display-end annotation. Set the sink back to | |
49249 | 656 ;; user to make sure that the error message is seen. |
657 ;; NOT USED: see annotation-rules for reason. | |
658 ;(defun gdb-error-begin (ignored) | |
659 ; (gdb-set-output-sink 'user)) | |
48292 | 660 |
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
|
661 (defun gdb-display-begin (ignored) |
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
|
662 (gdb-set-output-sink 'emacs) |
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-clear-partial-output) |
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
|
664 (setq gdb-display-in-progress t)) |
48292 | 665 |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
666 (defvar gdb-expression-buffer-name nil) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
667 (defvar gdb-display-number nil) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
668 (defvar gdb-dive-display-number nil) |
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
|
669 |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
670 (defun gdb-display-number-end (ignored) |
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
|
671 (set-buffer (gdb-get-buffer 'gdb-partial-output-buffer)) |
48292 | 672 (setq gdb-display-number (buffer-string)) |
673 (setq gdb-expression-buffer-name | |
674 (concat "*display " gdb-display-number "*")) | |
675 (save-excursion | |
676 (if (progn | |
677 (set-buffer (window-buffer)) | |
678 gdb-dive) | |
679 (progn | |
680 (let ((number gdb-display-number)) | |
681 (switch-to-buffer | |
682 (set-buffer (get-buffer-create gdb-expression-buffer-name))) | |
683 (gdb-expressions-mode) | |
684 (setq gdb-dive-display-number number))) | |
685 (set-buffer (get-buffer-create gdb-expression-buffer-name)) | |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
686 (if (display-graphic-p) |
48292 | 687 (catch 'frame-exists |
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
|
688 (dolist (frame (frame-list)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
689 (if (string-equal (frame-parameter frame 'name) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
690 gdb-expression-buffer-name) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
691 (throw 'frame-exists nil))) |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
692 (gdb-expressions-mode) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
693 (make-frame `((height . ,gdb-window-height) |
49249 | 694 (width . ,gdb-window-width) |
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
|
695 (tool-bar-lines . nil) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
696 (menu-bar-lines . nil) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
697 (minibuffer . nil)))) |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
698 (gdb-expressions-mode) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
699 (gdb-display-buffer (get-buffer gdb-expression-buffer-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
|
700 (set-buffer (gdb-get-buffer 'gdb-partial-output-buffer)) |
48292 | 701 (setq gdb-dive nil)) |
702 | |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
703 (defvar gdb-nesting-level nil) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
704 (defvar gdb-expression nil) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
705 (defvar gdb-point nil) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
706 (defvar gdb-annotation-arg nil) |
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
|
707 |
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
|
708 (defun gdb-delete-line () |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
709 "Delete the current line." |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
710 (delete-region (line-beginning-position) (line-beginning-position 2))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
711 |
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
|
712 (defun gdb-display-end (ignored) |
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
|
713 (set-buffer (gdb-get-buffer 'gdb-partial-output-buffer)) |
48292 | 714 (goto-char (point-min)) |
715 (search-forward ": ") | |
716 (looking-at "\\(.*?\\) =") | |
717 (let ((char "") | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
718 (gdb-temp-value (match-string 1))) |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
719 ;;move * to front of expression if necessary |
48292 | 720 (if (looking-at ".*\\*") |
721 (progn | |
722 (setq char "*") | |
723 (setq gdb-temp-value (substring gdb-temp-value 1 nil)))) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
724 (with-current-buffer gdb-expression-buffer-name |
48292 | 725 (setq gdb-expression gdb-temp-value) |
726 (if (not (string-match "::" gdb-expression)) | |
727 (setq gdb-expression (concat char gdb-current-frame | |
728 "::" gdb-expression)) | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
729 ;;else put * back on if necessary |
48292 | 730 (setq gdb-expression (concat char gdb-expression))) |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
731 (if (not header-line-format) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
732 (setq header-line-format (concat "-- " gdb-expression " %-"))))) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
733 ;; |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
734 ;;-if scalar/string |
48292 | 735 (if (not (re-search-forward "##" nil t)) |
736 (progn | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
737 (with-current-buffer gdb-expression-buffer-name |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
738 (let ((buffer-read-only nil)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
739 (delete-region (point-min) (point-max)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
740 (insert-buffer-substring |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
741 (gdb-get-buffer 'gdb-partial-output-buffer))))) |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
742 ;; display expression name... |
48292 | 743 (goto-char (point-min)) |
744 (let ((start (progn (point))) | |
745 (end (progn (end-of-line) (point)))) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
746 (with-current-buffer gdb-expression-buffer-name |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
747 (let ((buffer-read-only nil)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
748 (delete-region (point-min) (point-max)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
749 (insert-buffer-substring (gdb-get-buffer |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
750 'gdb-partial-output-buffer) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
751 start end) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
752 (insert "\n")))) |
48292 | 753 (goto-char (point-min)) |
754 (re-search-forward "##" nil t) | |
755 (setq gdb-nesting-level 0) | |
756 (if (looking-at "array-section-begin") | |
757 (progn | |
758 (gdb-delete-line) | |
759 (setq gdb-point (point)) | |
760 (gdb-array-format))) | |
761 (if (looking-at "field-begin \\(.\\)") | |
762 (progn | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
763 (setq gdb-annotation-arg (match-string 1)) |
48292 | 764 (gdb-field-format-begin)))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
765 (with-current-buffer gdb-expression-buffer-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
|
766 (if gdb-dive-display-number |
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 (progn |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
768 (let ((buffer-read-only nil)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
769 (goto-char (point-max)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
770 (insert "\n") |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
771 (insert-text-button "[back]" 'type 'gdb-display-back))))) |
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
|
772 (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
|
773 (gdb-set-output-sink 'user) |
48292 | 774 (setq gdb-display-in-progress nil)) |
775 | |
776 (define-button-type 'gdb-display-back | |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
777 'help-echo "mouse-2, RET: go back to previous display buffer" |
48292 | 778 'action (lambda (button) (gdb-display-go-back))) |
779 | |
780 (defun gdb-display-go-back () | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
781 ;; delete display so they don't accumulate and delete buffer |
48292 | 782 (let ((number gdb-display-number)) |
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
|
783 (gdb-enqueue-input |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
784 (list (concat "server delete display " number "\n") 'ignore)) |
48292 | 785 (switch-to-buffer (concat "*display " gdb-dive-display-number "*")) |
786 (kill-buffer (get-buffer (concat "*display " number "*"))))) | |
787 | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
788 ;; prefix annotations with ## and process whole output in one chunk |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
789 ;; in gdb-partial-output-buffer (to allow recursion). |
48292 | 790 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
791 ;; array-section flags are just removed again but after counting. They |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
792 ;; might also be useful for arrays of structures and structures with arrays. |
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
|
793 (defun gdb-array-section-begin (args) |
48292 | 794 (if gdb-display-in-progress |
795 (progn | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
796 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
48292 | 797 (goto-char (point-max)) |
798 (insert (concat "\n##array-section-begin " args "\n")))))) | |
799 | |
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
|
800 (defun gdb-array-section-end (ignored) |
48292 | 801 (if gdb-display-in-progress |
802 (progn | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
803 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
48292 | 804 (goto-char (point-max)) |
805 (insert "\n##array-section-end\n"))))) | |
806 | |
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
|
807 (defun gdb-field-begin (args) |
48292 | 808 (if gdb-display-in-progress |
809 (progn | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
810 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
48292 | 811 (goto-char (point-max)) |
812 (insert (concat "\n##field-begin " args "\n")))))) | |
813 | |
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
|
814 (defun gdb-field-end (ignored) |
48292 | 815 (if gdb-display-in-progress |
816 (progn | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
817 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
48292 | 818 (goto-char (point-max)) |
819 (insert "\n##field-end\n"))))) | |
820 | |
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
|
821 (defun gdb-elt (ignored) |
48292 | 822 (if gdb-display-in-progress |
823 (progn | |
824 (goto-char (point-max)) | |
825 (insert "\n##elt\n")))) | |
826 | |
827 (defun gdb-field-format-begin () | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
828 ;; get rid of ##field-begin |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
829 (gdb-delete-line) |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
830 (gdb-insert-field) |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
831 (setq gdb-nesting-level (+ gdb-nesting-level 1)) |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
832 (while (re-search-forward "##" nil t) |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
833 ;; keep making recursive calls... |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
834 (if (looking-at "field-begin \\(.\\)") |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
835 (progn |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
836 (setq gdb-annotation-arg (match-string 1)) |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
837 (gdb-field-format-begin))) |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
838 ;; until field-end. |
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
839 (if (looking-at "field-end") (gdb-field-format-end)))) |
48292 | 840 |
841 (defun gdb-field-format-end () | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
842 ;; get rid of ##field-end and `,' or `}' |
48292 | 843 (gdb-delete-line) |
844 (gdb-delete-line) | |
845 (setq gdb-nesting-level (- gdb-nesting-level 1))) | |
846 | |
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
|
847 (defvar gdb-dive-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
|
848 (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
|
849 (define-key map [mouse-2] 'gdb-dive) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
850 (define-key map [S-mouse-2] 'gdb-dive-new-frame) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
851 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
|
852 |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
853 (defun gdb-dive (event) |
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 "Dive into structure." |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
855 (interactive "e") |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
856 (setq gdb-dive t) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
857 (gdb-dive-new-frame event)) |
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 |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
859 (defun gdb-dive-new-frame (event) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
860 "Dive into structure and display in a new frame." |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
861 (interactive "e") |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
862 (save-excursion |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
863 (mouse-set-point event) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
864 (let ((point (point)) (gdb-full-expression gdb-expression) |
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 (end (progn (end-of-line) (point))) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
866 (gdb-part-expression "") (gdb-last-field nil) (gdb-display-char 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
|
867 (beginning-of-line) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
868 (if (looking-at "\*") (setq gdb-display-char "*")) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
869 (re-search-forward "\\(\\S-+\\) = " end t) |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
870 (setq gdb-last-field (match-string-no-properties 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
|
871 (goto-char (match-beginning 1)) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
872 (let ((last-column (current-column))) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
873 (while (re-search-backward "\\s-\\(\\S-+\\) = {" nil t) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
874 (goto-char (match-beginning 1)) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
875 (if (and (< (current-column) last-column) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
876 (> (count-lines 1 (point)) 1)) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
877 (progn |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
878 (setq gdb-part-expression |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
879 (concat "." (match-string-no-properties 1) |
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
880 gdb-part-expression)) |
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
|
881 (setq last-column (current-column)))))) |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
882 ;; * not needed for components of a pointer to a structure in gdb |
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
|
883 (if (string-equal "*" (substring gdb-full-expression 0 1)) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
884 (setq gdb-full-expression (substring gdb-full-expression 1 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
|
885 (setq gdb-full-expression |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
886 (concat gdb-full-expression gdb-part-expression "." gdb-last-field)) |
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
|
887 (gdb-enqueue-input |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
888 (list (concat "server display" gdb-display-char |
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
889 " " gdb-full-expression "\n") |
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
890 'ignore))))) |
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
|
891 |
48292 | 892 (defun gdb-insert-field () |
893 (let ((start (progn (point))) | |
894 (end (progn (next-line) (point))) | |
895 (num 0)) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
896 (with-current-buffer gdb-expression-buffer-name |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
897 (let ((buffer-read-only nil)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
898 (if (string-equal gdb-annotation-arg "\*") (insert "\*")) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
899 (while (<= num gdb-nesting-level) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
900 (insert "\t") |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
901 (setq num (+ num 1))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
902 (insert-buffer-substring (gdb-get-buffer |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
903 'gdb-partial-output-buffer) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
904 start end) |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
905 (add-text-properties |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
906 (- (point) (- end start)) (- (point) 1) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
907 `(mouse-face highlight |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
908 local-map ,gdb-dive-map |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
909 help-echo "mouse-2: dive, S-mouse-2: dive in a new frame")))) |
48292 | 910 (delete-region start end))) |
911 | |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
912 (defvar gdb-values nil) |
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
|
913 |
48292 | 914 (defun gdb-array-format () |
915 (while (re-search-forward "##" nil t) | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
916 ;; keep making recursive calls... |
48292 | 917 (if (looking-at "array-section-begin") |
918 (progn | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
919 ;;get rid of ##array-section-begin |
48292 | 920 (gdb-delete-line) |
921 (setq gdb-nesting-level (+ gdb-nesting-level 1)) | |
922 (gdb-array-format))) | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
923 ;;until *matching* array-section-end is found |
48292 | 924 (if (looking-at "array-section-end") |
925 (if (eq gdb-nesting-level 0) | |
926 (progn | |
927 (let ((values (buffer-substring gdb-point (- (point) 2)))) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
928 (with-current-buffer gdb-expression-buffer-name |
48292 | 929 (setq gdb-values |
930 (concat "{" (replace-regexp-in-string "\n" "" values) | |
931 "}")) | |
932 (gdb-array-format1)))) | |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
933 ;;else get rid of ##array-section-end etc |
48292 | 934 (gdb-delete-line) |
935 (setq gdb-nesting-level (- gdb-nesting-level 1)) | |
936 (gdb-array-format))))) | |
937 | |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
938 (defvar gdb-array-start nil) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
939 (defvar gdb-array-stop nil) |
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
|
940 |
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
|
941 (defvar gdb-array-slice-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
|
942 (let ((map (make-sparse-keymap))) |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
943 (define-key map "\r" 'gdb-array-slice) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
944 (define-key map [mouse-2] 'gdb-mouse-array-slice) |
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
|
945 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
|
946 |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
947 (defun gdb-mouse-array-slice (event) |
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
|
948 "Select an array slice to display." |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
949 (interactive "e") |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
950 (mouse-set-point event) |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
951 (gdb-array-slice)) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
952 |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
953 (defun gdb-array-slice () |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
954 (interactive) |
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
|
955 (save-excursion |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
956 (let ((n -1) (stop 0) (start 0) (point (point))) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
957 (beginning-of-line) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
958 (while (search-forward "[" point t) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
959 (setq n (+ n 1))) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
960 (setq start (string-to-int (read-string "Start index: "))) |
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 (aset gdb-array-start n start) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
962 (setq stop (string-to-int (read-string "Stop index: "))) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
963 (aset gdb-array-stop n stop))) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
964 (gdb-array-format1)) |
3216cd45d6d2
Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents:
48498
diff
changeset
|
965 |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
966 (defvar gdb-display-string nil) |
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
967 (defvar gdb-array-size nil) |
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
|
968 |
48292 | 969 (defun gdb-array-format1 () |
970 (setq gdb-display-string "") | |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
971 (let ((buffer-read-only nil)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
972 (delete-region (point-min) (point-max)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
973 (let ((gdb-value-list (split-string gdb-values ", "))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
974 (string-match "\\({+\\)" (car gdb-value-list)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
975 (let* ((depth (- (match-end 1) (match-beginning 1))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
976 (indices (make-vector depth '0)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
977 (index 0) (num 0) (array-start "") |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
978 (array-stop "") (array-slice "") (array-range nil) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
979 (flag t) (indices-string "")) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
980 (dolist (gdb-value gdb-value-list) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
981 (string-match "{*\\([^}]*\\)\\(}*\\)" gdb-value) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
982 (setq num 0) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
983 (while (< num depth) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
984 (setq indices-string |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
985 (concat indices-string |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
986 "[" (int-to-string (aref indices num)) "]")) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
987 (if (not (= (aref gdb-array-start num) -1)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
988 (if (or (< (aref indices num) (aref gdb-array-start num)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
989 (> (aref indices num) (aref gdb-array-stop num))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
990 (setq flag nil)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
991 (aset gdb-array-size num (aref indices num))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
992 (setq num (+ num 1))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
993 (if flag |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
994 (let ((gdb-display-value (match-string 1 gdb-value))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
995 (setq gdb-display-string (concat gdb-display-string " " |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
996 gdb-display-value)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
997 (insert |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
998 (concat indices-string "\t" gdb-display-value "\n")))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
999 (setq indices-string "") |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1000 (setq flag t) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1001 ;; 0<= index < depth, start at right : (- depth 1) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1002 (setq index (- (- depth 1) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1003 (- (match-end 2) (match-beginning 2)))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1004 ;;don't set for very last brackets |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1005 (when (>= index 0) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1006 (aset indices index (+ 1 (aref indices index))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1007 (setq num (+ 1 index)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1008 (while (< num depth) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1009 (aset indices num 0) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1010 (setq num (+ num 1))))) |
48292 | 1011 (setq num 0) |
1012 (while (< num depth) | |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1013 (if (= (aref gdb-array-start num) -1) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1014 (progn |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1015 (aset gdb-array-start num 0) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1016 (aset gdb-array-stop num (aref indices num)))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1017 (setq array-start (int-to-string (aref gdb-array-start num))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1018 (setq array-stop (int-to-string (aref gdb-array-stop num))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1019 (setq array-range (concat "[" array-start |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1020 ":" array-stop "]")) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1021 (add-text-properties |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1022 1 (+ (length array-start) (length array-stop) 2) |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1023 `(mouse-face highlight |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1024 local-map ,gdb-array-slice-map |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1025 help-echo "mouse-2, RET: select slice for this index") array-range) |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1026 (goto-char (point-min)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1027 (setq array-slice (concat array-slice array-range)) |
48292 | 1028 (setq num (+ num 1))) |
1029 (goto-char (point-min)) | |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1030 (insert "Array Size : ") |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1031 (setq num 0) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1032 (while (< num depth) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1033 (insert |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1034 (concat "[" |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1035 (int-to-string (+ (aref gdb-array-size num) 1)) "]")) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1036 (setq num (+ num 1))) |
48292 | 1037 (insert |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1038 (concat "\n Slice : " array-slice "\n\nIndex\tValues\n\n")))))) |
48292 | 1039 |
48884
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
1040 (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
|
1041 "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
|
1042 (let ( |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1043 ;; 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
|
1044 (burst (concat (gdb-get-burst) string)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1045 ;; 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
|
1046 (output "")) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1047 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1048 ;; 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
|
1049 (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
|
1050 (let ((annotation (match-string 1 burst))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1051 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1052 ;; 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
|
1053 ;; 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
|
1054 ;; elsewhere. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1055 (setq output |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1056 (gdb-concat-output |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1057 output |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1058 (substring burst 0 (match-beginning 0)))) |
48292 | 1059 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1060 ;; Take that stuff off the burst. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1061 (setq burst (substring burst (match-end 0))) |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
1062 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1063 ;; 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
|
1064 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1065 (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
|
1066 (annotation-arguments (match-string 2 annotation)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1067 (annotation-rule (assoc annotation-type |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1068 gdb-annotation-rules))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1069 ;; Call the handler for this annotation. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1070 (if annotation-rule |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1071 (funcall (car (cdr annotation-rule)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1072 annotation-arguments) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1073 ;; 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
|
1074 ;; 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
|
1075 ;; us to blow up. |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1076 )))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1077 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1078 ;; 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
|
1079 ;; 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
|
1080 (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
|
1081 burst) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1082 (progn |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1083 ;; 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
|
1084 (setq output |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1085 (gdb-concat-output output |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1086 (substring burst 0 (match-beginning 0)))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1087 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1088 ;; 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
|
1089 (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
|
1090 ;; |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1091 ;; 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
|
1092 (progn |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1093 (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
|
1094 (setq burst ""))) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1095 ;; |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1096 ;; 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
|
1097 (gdb-set-burst burst) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1098 output)) |
48292 | 1099 |
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
|
1100 (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
|
1101 (let ((sink (gdb-get-output-sink ))) |
48292 | 1102 (cond |
1103 ((eq sink 'user) (concat so-far new)) | |
1104 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
1105 ((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
|
1106 (gdb-append-to-partial-output new) |
48292 | 1107 so-far) |
1108 ((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
|
1109 (gdb-append-to-inferior-io new) |
48292 | 1110 so-far) |
1111 (t (error "Bogon output sink %S" sink))))) | |
1112 | |
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
|
1113 (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
|
1114 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
48292 | 1115 (goto-char (point-max)) |
1116 (insert string))) | |
1117 | |
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
|
1118 (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
|
1119 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
48292 | 1120 (delete-region (point-min) (point-max)))) |
1121 | |
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
|
1122 (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
|
1123 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io) |
48292 | 1124 (goto-char (point-max)) |
1125 (insert-before-markers string)) | |
48884
f774c94b3b5e
(gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents:
48827
diff
changeset
|
1126 (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
|
1127 (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io)))) |
48292 | 1128 |
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
|
1129 (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
|
1130 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io) |
48292 | 1131 (delete-region (point-min) (point-max)))) |
1132 | |
1133 | |
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
|
1134 ;; 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
|
1135 ;; 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
|
1136 ;; type. |
48292 | 1137 ;; |
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
|
1138 ;; 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
|
1139 ;; 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
|
1140 ;; behind the user's back. |
48292 | 1141 ;; |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
1142 ;; 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
|
1143 ;; 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
|
1144 ;; |
48292 | 1145 ;; Below is the code for specificly managing buffers of output from one |
1146 ;; command. | |
1147 ;; | |
1148 | |
1149 ;; 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
|
1150 ;; It adds an input for the command we are tracking. It should be the |
48292 | 1151 ;; annotation rule binding of whatever gdb sends to tell us this command |
1152 ;; might have changed it's output. | |
1153 ;; | |
1154 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. | |
1155 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the | |
1156 ;; 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
|
1157 |
4934b8352621
(gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents:
48515
diff
changeset
|
1158 (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
|
1159 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
|
1160 `(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
|
1161 (if (and (,demand-predicate) |
48292 | 1162 (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
|
1163 (gdb-get-pending-triggers)))) |
48292 | 1164 (progn |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
1165 (gdb-enqueue-input |
48292 | 1166 (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
|
1167 (gdb-set-pending-triggers |
48292 | 1168 (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
|
1169 (gdb-get-pending-triggers))))))) |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
1170 |
48292 | 1171 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) |
1172 `(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
|
1173 (gdb-set-pending-triggers |
48292 | 1174 (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
|
1175 (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
|
1176 (let ((buf (gdb-get-buffer ',buf-key))) |
48292 | 1177 (and buf |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1178 (with-current-buffer buf |
48292 | 1179 (let ((p (point)) |
1180 (buffer-read-only nil)) | |
1181 (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
|
1182 (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
|
1183 'gdb-partial-output-buffer)) |
48292 | 1184 (goto-char p))))) |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
1185 ;; put customisation here |
48292 | 1186 (,custom-defun))) |
1187 | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
1188 (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
|
1189 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
|
1190 `(progn |
48292 | 1191 (def-gdb-auto-update-trigger ,trigger-name |
1192 ;; 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
|
1193 (lambda () (gdb-get-buffer ',buffer-key)) |
48292 | 1194 ,gdb-command |
1195 ,output-handler-name) | |
1196 (def-gdb-auto-update-handler ,output-handler-name | |
1197 ,trigger-name ,buffer-key ,custom-defun))) | |
1198 | |
1199 | |
1200 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1201 ;; 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
|
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-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
|
1204 '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
|
1205 'gdb-breakpoints-mode) |
48292 | 1206 |
1207 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
1208 ;; This defines the auto update rule for buffers of type | |
1209 ;; `gdb-breakpoints-buffer'. | |
1210 ;; | |
1211 ;; It defines a function to serve as the annotation handler that | |
1212 ;; handles the `foo-invalidated' message. That function is called: | |
1213 gdb-invalidate-breakpoints | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1214 ;; |
48292 | 1215 ;; To update the buffer, this command is sent to gdb. |
1216 "server info breakpoints\n" | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1217 ;; |
48292 | 1218 ;; This also defines a function to be the handler for the output |
1219 ;; from the command above. That function will copy the output into | |
1220 ;; the appropriately typed buffer. That function will be called: | |
1221 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
|
1222 ;; buffer specific functions |
48292 | 1223 gdb-info-breakpoints-custom) |
1224 | |
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
|
1225 (defvar gdb-cdir nil "Compilation directory.") |
50796
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1226 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1227 (defconst breakpoint-xpm-data "/* XPM */ |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1228 static char *magick[] = { |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1229 /* columns rows colors chars-per-pixel */ |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1230 \"12 12 2 1\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1231 \" c red\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1232 \"+ c None\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1233 /* pixels */ |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1234 \"++++++++++++\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1235 \"+++ +++\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1236 \"++ ++\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1237 \"+ +\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1238 \"+ +\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1239 \"+ +\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1240 \"+ +\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1241 \"+ +\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1242 \"+ +\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1243 \"++ ++\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1244 \"+++ +++\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1245 \"++++++++++++\" |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1246 };" |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1247 "XPM data used for breakpoint icon.") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1248 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1249 (defconst breakpoint-enabled-pbm-data |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1250 "P1 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1251 12 12\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1252 0 0 0 0 0 0 0 0 0 0 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1253 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
|
1254 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
|
1255 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
|
1256 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
|
1257 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
|
1258 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
|
1259 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
|
1260 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
|
1261 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
|
1262 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
|
1263 0 0 0 0 0 0 0 0 0 0 0 0" |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1264 "PBM data used for enabled breakpoint icon.") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1265 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1266 (defconst breakpoint-disabled-pbm-data |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1267 "P1 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1268 12 12\", |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1269 0 0 0 0 0 0 0 0 0 0 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1270 0 0 0 1 0 1 0 1 0 0 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1271 0 0 1 0 1 0 1 0 1 0 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1272 0 1 0 1 0 1 0 1 0 1 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1273 0 0 1 0 1 0 1 0 1 0 1 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1274 0 1 0 1 0 1 0 1 0 1 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1275 0 0 1 0 1 0 1 0 1 0 1 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1276 0 1 0 1 0 1 0 1 0 1 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1277 0 0 1 0 1 0 1 0 1 0 1 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1278 0 0 0 1 0 1 0 1 0 1 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1279 0 0 0 0 1 0 1 0 1 0 0 0 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1280 0 0 0 0 0 0 0 0 0 0 0 0" |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1281 "PBM data used for disabled breakpoint icon.") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1282 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1283 (defvar breakpoint-enabled-icon |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1284 (find-image `((:type xpm :data ,breakpoint-xpm-data) |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1285 (:type pbm :data ,breakpoint-enabled-pbm-data))) |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1286 "Icon for enabled breakpoint in display margin") |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1287 |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1288 (defvar breakpoint-disabled-icon |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1289 (find-image `((:type xpm :data ,breakpoint-xpm-data :conversion disabled) |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1290 (:type pbm :data ,breakpoint-disabled-pbm-data))) |
5f329faeef51
(breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents:
50378
diff
changeset
|
1291 "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
|
1292 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
1293 ;;-put breakpoint icons in relevant margins (even those set in the GUD buffer) |
48292 | 1294 (defun gdb-info-breakpoints-custom () |
1295 (let ((flag)(address)) | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1296 ;; |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1297 ;; 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
|
1298 (dolist (buffer (buffer-list)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1299 (with-current-buffer buffer |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1300 (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
|
1301 (not (string-match "^\*" (buffer-name)))) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1302 (if (display-images-p) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1303 (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
|
1304 (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
|
1305 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
48292 | 1306 (save-excursion |
1307 (goto-char (point-min)) | |
1308 (while (< (point) (- (point-max) 1)) | |
1309 (forward-line 1) | |
1310 (if (looking-at "[^\t].*breakpoint") | |
1311 (progn | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1312 (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
|
1313 (setq flag (char-after (match-beginning 1))) |
48292 | 1314 (beginning-of-line) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1315 (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
|
1316 (progn |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1317 (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
|
1318 (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
|
1319 (file (match-string 1))) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1320 (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
|
1321 '(mouse-face highlight |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1322 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
|
1323 (with-current-buffer |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1324 (find-file-noselect |
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1325 (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
|
1326 (expand-file-name file gdb-cdir))) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1327 (save-current-buffer |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1328 (set (make-local-variable 'gud-minor-mode) 'gdba) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1329 (set (make-local-variable 'tool-bar-map) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1330 gud-tool-bar-map) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1331 (setq left-margin-width 2) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1332 (if (get-buffer-window (current-buffer)) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1333 (set-window-margins (get-buffer-window |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1334 (current-buffer)) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1335 left-margin-width |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1336 right-margin-width))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1337 ;; only want one breakpoint icon at each location |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1338 (save-excursion |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1339 (goto-line (string-to-number line)) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1340 (let ((start (progn (beginning-of-line) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1341 (- (point) 1))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1342 (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
|
1343 (if (display-images-p) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1344 (progn |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1345 (remove-images start end) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1346 (if (eq ?y flag) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1347 (put-image breakpoint-enabled-icon |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1348 (+ start 1) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1349 "breakpoint icon enabled" |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1350 'left-margin) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1351 (put-image breakpoint-disabled-icon |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1352 (+ start 1) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1353 "breakpoint icon disabled" |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1354 'left-margin))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1355 (gdb-remove-strings start end) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1356 (if (eq ?y flag) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1357 (gdb-put-string "B" (+ start 1)) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
1358 (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
|
1359 (end-of-line))))) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1360 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) |
48292 | 1361 |
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
|
1362 (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
|
1363 (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
|
1364 (concat "*breakpoints of " (gdb-get-target-string) "*"))) |
48292 | 1365 |
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
|
1366 (defun gdb-display-breakpoints-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1367 (interactive) |
48292 | 1368 (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
|
1369 (gdb-get-create-buffer 'gdb-breakpoints-buffer))) |
48292 | 1370 |
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
|
1371 (defun gdb-frame-breakpoints-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1372 (interactive) |
48292 | 1373 (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
|
1374 (gdb-get-create-buffer 'gdb-breakpoints-buffer))) |
48292 | 1375 |
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
|
1376 (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
|
1377 (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
|
1378 (menu (make-sparse-keymap "Breakpoints"))) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1379 (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
|
1380 (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
|
1381 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
48292 | 1382 |
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
|
1383 (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
|
1384 (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
|
1385 (define-key map " " 'gdb-toggle-breakpoint) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1386 (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
|
1387 (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
|
1388 (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
|
1389 map)) |
48292 | 1390 |
1391 (defun gdb-breakpoints-mode () | |
1392 "Major mode for gdb breakpoints. | |
1393 | |
1394 \\{gdb-breakpoints-mode-map}" | |
1395 (setq major-mode 'gdb-breakpoints-mode) | |
1396 (setq mode-name "Breakpoints") | |
1397 (use-local-map gdb-breakpoints-mode-map) | |
1398 (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
|
1399 (gdb-invalidate-breakpoints)) |
48292 | 1400 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1401 (defun gdb-toggle-breakpoint () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1402 "Enable/disable the breakpoint at current line." |
48292 | 1403 (interactive) |
1404 (save-excursion | |
1405 (beginning-of-line 1) | |
1406 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) | |
1407 (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
|
1408 (gdb-enqueue-input |
48292 | 1409 (list |
1410 (concat | |
1411 (if (eq ?y (char-after (match-beginning 2))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1412 "server disable " |
48292 | 1413 "server enable ") |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1414 (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
|
1415 'ignore))))) |
48292 | 1416 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1417 (defun gdb-delete-breakpoint () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1418 "Delete the breakpoint at current line." |
48292 | 1419 (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
|
1420 (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
|
1421 (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
|
1422 (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
|
1423 (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
|
1424 (list (concat "server delete " (match-string 1) "\n") 'ignore)))) |
48292 | 1425 |
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
|
1426 (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
|
1427 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1428 (defun gdb-goto-breakpoint () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1429 "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
|
1430 current line." |
48292 | 1431 (interactive) |
1432 (save-excursion | |
1433 (beginning-of-line 1) | |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1434 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) |
48292 | 1435 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1436 (if (match-string 2) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1437 (let ((line (match-string 2)) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1438 (file (match-string 1))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1439 (save-selected-window |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1440 (select-window gdb-source-window) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1441 (switch-to-buffer (find-file-noselect |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1442 (if (file-exists-p file) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1443 file |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1444 (expand-file-name file gdb-cdir)))) |
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1445 (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
|
1446 |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1447 (defun gdb-mouse-goto-breakpoint (event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1448 "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
|
1449 (interactive "e") |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1450 (mouse-set-point event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1451 (gdb-goto-breakpoint)) |
48292 | 1452 |
1453 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1454 ;; Frames buffer. This displays a perpetually correct bactracktrace |
48292 | 1455 ;; (from the command `where'). |
1456 ;; | |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1457 ;; Alas, if your stack is deep, it is costly. |
48292 | 1458 ;; |
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
|
1459 (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
|
1460 '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
|
1461 'gdb-frames-mode) |
48292 | 1462 |
1463 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
1464 gdb-invalidate-frames | |
1465 "server where\n" | |
1466 gdb-info-frames-handler | |
1467 gdb-info-frames-custom) | |
1468 | |
1469 (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
|
1470 (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
|
1471 (save-excursion |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1472 (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
|
1473 (goto-char (point-min)) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1474 (while (< (point) (point-max)) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1475 (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
|
1476 '(mouse-face highlight |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1477 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
|
1478 (beginning-of-line) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1479 (if (or (looking-at "^#[0-9]*\\s-*\\S-* in \\(\\S-*\\)") |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1480 (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)")) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1481 (if (equal (match-string 1) gdb-current-frame) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1482 (put-text-property (point-at-bol) (point-at-eol) |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1483 'face |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1484 `(:background ,(face-attribute 'default :foreground) |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1485 :foreground ,(face-attribute 'default :background))))) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
1486 (forward-line 1)))))) |
48292 | 1487 |
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
|
1488 (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
|
1489 (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
|
1490 (concat "*stack frames of " (gdb-get-target-string) "*"))) |
48292 | 1491 |
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
|
1492 (defun gdb-display-stack-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1493 (interactive) |
48292 | 1494 (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
|
1495 (gdb-get-create-buffer 'gdb-stack-buffer))) |
48292 | 1496 |
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
|
1497 (defun gdb-frame-stack-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1498 (interactive) |
48292 | 1499 (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
|
1500 (gdb-get-create-buffer 'gdb-stack-buffer))) |
48292 | 1501 |
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
|
1502 (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
|
1503 (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
|
1504 (suppress-keymap map) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1505 (define-key map "\r" 'gdb-frames-select) |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1506 (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
|
1507 map)) |
48292 | 1508 |
1509 (defun gdb-frames-mode () | |
1510 "Major mode for gdb frames. | |
1511 | |
1512 \\{gdb-frames-mode-map}" | |
1513 (setq major-mode 'gdb-frames-mode) | |
1514 (setq mode-name "Frames") | |
1515 (setq buffer-read-only t) | |
1516 (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
|
1517 (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
|
1518 (gdb-invalidate-frames)) |
48292 | 1519 |
1520 (defun gdb-get-frame-number () | |
1521 (save-excursion | |
1522 (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
|
1523 (n (or (and pos (match-string-no-properties 1)) "0"))) |
48292 | 1524 n))) |
1525 | |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1526 (defun gdb-frames-select () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1527 "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
|
1528 source in the source buffer." |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1529 (interactive) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1530 (gdb-enqueue-input |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1531 (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
|
1532 (gud-display-frame)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1533 |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1534 (defun gdb-frames-mouse-select (event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1535 "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
|
1536 the source buffer." |
48292 | 1537 (interactive "e") |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1538 (mouse-set-point event) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1539 (gdb-frames-select)) |
48292 | 1540 |
1541 ;; | |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1542 ;; 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
|
1543 ;; |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1544 (gdb-set-buffer-rules 'gdb-threads-buffer |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1545 'gdb-threads-buffer-name |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1546 'gdb-threads-mode) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1547 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1548 (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
|
1549 gdb-invalidate-threads |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1550 "info threads\n" |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1551 gdb-info-threads-handler |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1552 gdb-info-threads-custom) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1553 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1554 (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
|
1555 (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
|
1556 (let ((buffer-read-only nil)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1557 (goto-char (point-min)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1558 (while (< (point) (point-max)) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1559 (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
|
1560 '(mouse-face highlight |
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
1561 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
|
1562 (forward-line 1))))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1563 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1564 (defun gdb-threads-buffer-name () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1565 (with-current-buffer gud-comint-buffer |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1566 (concat "*threads of " (gdb-get-target-string) "*"))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1567 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1568 (defun gdb-display-threads-buffer () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1569 (interactive) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1570 (gdb-display-buffer |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1571 (gdb-get-create-buffer 'gdb-threads-buffer))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1572 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1573 (defun gdb-frame-threads-buffer () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1574 (interactive) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1575 (switch-to-buffer-other-frame |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1576 (gdb-get-create-buffer 'gdb-threads-buffer))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1577 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1578 (defvar gdb-threads-mode-map |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1579 (let ((map (make-sparse-keymap))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1580 (suppress-keymap map) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1581 (define-key map "\r" 'gdb-threads-select) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1582 (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
|
1583 map)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1584 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1585 (defun gdb-threads-mode () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1586 "Major mode for gdb frames. |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1587 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1588 \\{gdb-frames-mode-map}" |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1589 (setq major-mode 'gdb-threads-mode) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1590 (setq mode-name "Threads") |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1591 (setq buffer-read-only t) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1592 (use-local-map gdb-threads-mode-map) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1593 (gdb-invalidate-threads)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1594 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1595 (defun gdb-get-thread-number () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1596 (save-excursion |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1597 (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
|
1598 (match-string-no-properties 1))) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1599 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1600 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1601 (defun gdb-threads-select () |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1602 "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
|
1603 source in the source buffer." |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1604 (interactive) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1605 (gdb-enqueue-input |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1606 (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
|
1607 (gud-display-frame)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1608 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1609 (defun gdb-threads-mouse-select (event) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1610 "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
|
1611 the source buffer." |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1612 (interactive "e") |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1613 (mouse-set-point event) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1614 (gdb-threads-select)) |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1615 |
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1616 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1617 ;; Registers buffer. |
48292 | 1618 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1619 (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
|
1620 'gdb-registers-buffer-name |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1621 'gdb-registers-mode) |
48292 | 1622 |
1623 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
1624 gdb-invalidate-registers | |
1625 "server info registers\n" | |
1626 gdb-info-registers-handler | |
1627 gdb-info-registers-custom) | |
1628 | |
1629 (defun gdb-info-registers-custom ()) | |
1630 | |
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
|
1631 (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
|
1632 (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
|
1633 (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
|
1634 map)) |
48292 | 1635 |
1636 (defun gdb-registers-mode () | |
1637 "Major mode for gdb registers. | |
1638 | |
1639 \\{gdb-registers-mode-map}" | |
1640 (setq major-mode 'gdb-registers-mode) | |
1641 (setq mode-name "Registers") | |
1642 (setq buffer-read-only t) | |
1643 (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
|
1644 (gdb-invalidate-registers)) |
48292 | 1645 |
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
|
1646 (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
|
1647 (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
|
1648 (concat "*registers of " (gdb-get-target-string) "*"))) |
48292 | 1649 |
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
|
1650 (defun gdb-display-registers-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1651 (interactive) |
48292 | 1652 (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
|
1653 (gdb-get-create-buffer 'gdb-registers-buffer))) |
48292 | 1654 |
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
|
1655 (defun gdb-frame-registers-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1656 (interactive) |
48292 | 1657 (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
|
1658 (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
|
1659 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1660 ;; |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1661 ;; Locals buffer. |
48292 | 1662 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1663 (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
|
1664 'gdb-locals-buffer-name |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1665 'gdb-locals-mode) |
48292 | 1666 |
1667 (def-gdb-auto-updated-buffer gdb-locals-buffer | |
1668 gdb-invalidate-locals | |
1669 "server info locals\n" | |
1670 gdb-info-locals-handler | |
1671 gdb-info-locals-custom) | |
1672 | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1673 ;; 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
|
1674 ;; These can be expanded using gud-display. |
48292 | 1675 (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
|
1676 (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
|
1677 (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
|
1678 (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
|
1679 (with-current-buffer buf |
48292 | 1680 (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
|
1681 (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
|
1682 (replace-match "" nil nil)) |
48292 | 1683 (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
|
1684 (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
|
1685 (replace-match "(array);\n" nil nil)) |
48292 | 1686 (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
|
1687 (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
|
1688 (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
|
1689 (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
|
1690 (and buf (with-current-buffer buf |
48292 | 1691 (let ((p (point)) |
1692 (buffer-read-only nil)) | |
1693 (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
|
1694 (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
|
1695 'gdb-partial-output-buffer)) |
48292 | 1696 (goto-char p))))) |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
1697 (run-hooks 'gdb-info-locals-hook)) |
48292 | 1698 |
1699 (defun gdb-info-locals-custom () | |
1700 nil) | |
1701 | |
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
|
1702 (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
|
1703 (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
|
1704 (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
|
1705 map)) |
48292 | 1706 |
1707 (defun gdb-locals-mode () | |
1708 "Major mode for gdb locals. | |
1709 | |
1710 \\{gdb-locals-mode-map}" | |
1711 (setq major-mode 'gdb-locals-mode) | |
1712 (setq mode-name "Locals") | |
1713 (setq buffer-read-only t) | |
1714 (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
|
1715 (gdb-invalidate-locals)) |
48292 | 1716 |
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
|
1717 (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
|
1718 (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
|
1719 (concat "*locals of " (gdb-get-target-string) "*"))) |
48292 | 1720 |
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
|
1721 (defun gdb-display-locals-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1722 (interactive) |
48292 | 1723 (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
|
1724 (gdb-get-create-buffer 'gdb-locals-buffer))) |
48292 | 1725 |
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
|
1726 (defun gdb-frame-locals-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1727 (interactive) |
48292 | 1728 (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
|
1729 (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
|
1730 |
48292 | 1731 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
1732 ;; Display expression buffer. |
48292 | 1733 ;; |
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
|
1734 (gdb-set-buffer-rules 'gdb-display-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
|
1735 'gdb-display-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
|
1736 'gdb-display-mode) |
48292 | 1737 |
1738 (def-gdb-auto-updated-buffer gdb-display-buffer | |
1739 ;; `gdb-display-buffer'. | |
1740 gdb-invalidate-display | |
1741 "server info display\n" | |
1742 gdb-info-display-handler | |
1743 gdb-info-display-custom) | |
1744 | |
1745 (defun gdb-info-display-custom () | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1746 (let ((display-list nil)) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1747 (with-current-buffer (gdb-get-buffer 'gdb-display-buffer) |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1748 (goto-char (point-min)) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1749 (while (< (point) (- (point-max) 1)) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1750 (forward-line 1) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1751 (if (looking-at "\\([0-9]+\\): \\([ny]\\)") |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1752 (setq display-list |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1753 (cons (string-to-int (match-string 1)) display-list))) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1754 (end-of-line))) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1755 (if (not (display-graphic-p)) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1756 (progn |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1757 (dolist (buffer (buffer-list)) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1758 (if (string-match "\\*display \\([0-9]+\\)\\*" (buffer-name buffer)) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1759 (progn |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1760 (let ((number |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1761 (match-string 1 (buffer-name buffer)))) |
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1762 (if (not (memq (string-to-int number) display-list)) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
1763 (kill-buffer |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1764 (get-buffer (concat "*display " number "*"))))))))) |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1765 (gdb-delete-frames display-list)))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1766 |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1767 (defun gdb-delete-frames (display-list) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1768 (dolist (frame (frame-list)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1769 (let ((frame-name (frame-parameter frame 'name))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1770 (if (string-match "\\*display \\([0-9]+\\)\\*" frame-name) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1771 (progn |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1772 (let ((number (match-string 1 frame-name))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1773 (if (not (memq (string-to-int number) display-list)) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1774 (progn (kill-buffer |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1775 (get-buffer (concat "*display " number "*"))) |
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
1776 (delete-frame frame))))))))) |
48292 | 1777 |
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
|
1778 (defvar gdb-display-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
|
1779 (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
|
1780 (menu (make-sparse-keymap "Display"))) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1781 (define-key menu [toggle] '("Toggle" . gdb-toggle-display)) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1782 (define-key menu [delete] '("Delete" . gdb-delete-display)) |
48292 | 1783 |
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
|
1784 (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
|
1785 (define-key map [menu-bar display] (cons "Display" menu)) |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1786 (define-key map " " 'gdb-toggle-display) |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1787 (define-key map "d" 'gdb-delete-display) |
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
|
1788 map)) |
48292 | 1789 |
1790 (defun gdb-display-mode () | |
1791 "Major mode for gdb display. | |
1792 | |
1793 \\{gdb-display-mode-map}" | |
1794 (setq major-mode 'gdb-display-mode) | |
1795 (setq mode-name "Display") | |
1796 (setq buffer-read-only t) | |
1797 (use-local-map gdb-display-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
|
1798 (gdb-invalidate-display)) |
48292 | 1799 |
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
|
1800 (defun gdb-display-buffer-name () |
48685
19bf840bede8
Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48682
diff
changeset
|
1801 (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
|
1802 (concat "*Displayed expressions of " (gdb-get-target-string) "*"))) |
48292 | 1803 |
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
|
1804 (defun gdb-display-display-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1805 (interactive) |
48292 | 1806 (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
|
1807 (gdb-get-create-buffer 'gdb-display-buffer))) |
48292 | 1808 |
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
|
1809 (defun gdb-frame-display-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1810 (interactive) |
48292 | 1811 (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
|
1812 (gdb-get-create-buffer 'gdb-display-buffer))) |
48292 | 1813 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1814 (defun gdb-toggle-display () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1815 "Enable/disable the displayed expression at current line." |
48292 | 1816 (interactive) |
1817 (save-excursion | |
1818 (beginning-of-line 1) | |
1819 (if (not (looking-at "\\([0-9]+\\): \\([ny]\\)")) | |
1820 (error "No expression on this 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
|
1821 (gdb-enqueue-input |
48292 | 1822 (list |
1823 (concat | |
1824 (if (eq ?y (char-after (match-beginning 2))) | |
1825 "server disable display " | |
1826 "server enable display ") | |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1827 (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
|
1828 'ignore))))) |
48292 | 1829 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1830 (defun gdb-delete-display () |
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1831 "Delete the displayed expression at current line." |
48292 | 1832 (interactive) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
1833 (with-current-buffer (gdb-get-buffer 'gdb-display-buffer) |
48292 | 1834 (beginning-of-line 1) |
1835 (if (not (looking-at "\\([0-9]+\\): \\([ny]\\)")) | |
1836 (error "No expression on this line") | |
48641
da382393fb77
Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48640
diff
changeset
|
1837 (let ((number (match-string 1))) |
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
|
1838 (gdb-enqueue-input |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
1839 (list (concat "server delete display " number "\n") 'ignore)))))) |
48292 | 1840 |
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
|
1841 (defvar gdb-expressions-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
|
1842 (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
|
1843 (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
|
1844 (define-key map "v" 'gdb-array-visualise) |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
1845 (define-key map "q" 'gdb-delete-expression) |
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
|
1846 (define-key map [mouse-3] 'gdb-expressions-popup-menu) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
1847 map)) |
48292 | 1848 |
1849 (defvar gdb-expressions-mode-menu | |
1850 '("GDB Expressions Commands" | |
1851 "----" | |
1852 ["Visualise" gdb-array-visualise t] | |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
1853 ["Delete" gdb-delete-expression t]) |
48292 | 1854 "Menu for `gdb-expressions-mode'.") |
1855 | |
1856 (defun gdb-expressions-popup-menu (event) | |
1857 "Explicit Popup menu as this buffer doesn't have a menubar." | |
1858 (interactive "@e") | |
1859 (mouse-set-point event) | |
1860 (popup-menu gdb-expressions-mode-menu)) | |
1861 | |
1862 (defun gdb-expressions-mode () | |
1863 "Major mode for display expressions. | |
1864 | |
1865 \\{gdb-expressions-mode-map}" | |
1866 (setq major-mode 'gdb-expressions-mode) | |
1867 (setq mode-name "Expressions") | |
1868 (use-local-map gdb-expressions-mode-map) | |
1869 (make-local-variable 'gdb-display-number) | |
1870 (make-local-variable 'gdb-values) | |
1871 (make-local-variable 'gdb-expression) | |
1872 (set (make-local-variable 'gdb-display-string) nil) | |
1873 (set (make-local-variable 'gdb-dive-display-number) nil) | |
1874 (set (make-local-variable 'gud-minor-mode) 'gdba) | |
1875 (set (make-local-variable 'gdb-array-start) (make-vector 16 '-1)) | |
1876 (set (make-local-variable 'gdb-array-stop) (make-vector 16 '-1)) | |
1877 (set (make-local-variable 'gdb-array-size) (make-vector 16 '-1)) | |
1878 (setq buffer-read-only t)) | |
1879 | |
1880 | |
1881 ;;;; Window management | |
1882 | |
1883 ;;; The way we abuse the dedicated-p flag is pretty gross, but seems | |
1884 ;;; to do the right thing. Seeing as there is no way for Lisp code to | |
1885 ;;; get at the use_time field of a window, I'm not sure there exists a | |
1886 ;;; more elegant solution without writing C code. | |
1887 | |
1888 (defun gdb-display-buffer (buf &optional size) | |
1889 (let ((must-split nil) | |
1890 (answer nil)) | |
1891 (unwind-protect | |
1892 (progn | |
1893 (walk-windows | |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1894 #'(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
|
1895 (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
|
1896 (eq gdb-source-window win)) |
48292 | 1897 (set-window-dedicated-p win t)))) |
1898 (setq answer (get-buffer-window buf)) | |
1899 (if (not answer) | |
1900 (let ((window (get-lru-window))) | |
1901 (if window | |
1902 (progn | |
1903 (set-window-buffer window buf) | |
1904 (setq answer window)) | |
1905 (setq must-split t))))) | |
1906 (walk-windows | |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1907 #'(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
|
1908 (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
|
1909 (eq gdb-source-window win)) |
48292 | 1910 (set-window-dedicated-p win nil))))) |
1911 (if must-split | |
1912 (let* ((largest (get-largest-window)) | |
1913 (cur-size (window-height largest)) | |
1914 (new-size (and size (< size cur-size) (- cur-size size)))) | |
1915 (setq answer (split-window largest new-size)) | |
1916 (set-window-buffer answer buf))) | |
1917 answer)) | |
48300
69646014abb3
Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents:
48292
diff
changeset
|
1918 |
48292 | 1919 (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
|
1920 (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
|
1921 (progn |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1922 (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
|
1923 (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
|
1924 (gdb-display-buffer buffer) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1925 (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
|
1926 gdb-source-window) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1927 (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
|
1928 (set-window-buffer gdb-source-window |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1929 (gdb-get-buffer 'gdb-assembler-buffer)) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1930 (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
|
1931 (gdb-display-buffer buf) |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
1932 (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
|
1933 nil)) |
48292 | 1934 |
1935 | |
1936 ;;; Shared keymap initialization: | |
1937 | |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
1938 (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
|
1939 (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
|
1940 `(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
|
1941 (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
|
1942 (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
|
1943 (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
|
1944 (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
|
1945 (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
|
1946 (define-key menu [display] '("Display" . gdb-frame-display-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1947 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1948 ; (define-key menu [assembler] '("Assembler" . gdb-frame-assembler-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1949 ) |
48292 | 1950 |
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
|
1951 (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
|
1952 (define-key gud-menu-map [displays] |
48738
81dc78298a54
Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents:
48685
diff
changeset
|
1953 `(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
|
1954 (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
|
1955 (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
|
1956 (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
|
1957 (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
|
1958 (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-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
|
1959 (define-key menu [display] '("Display" . gdb-display-display-buffer)) |
50962
8a38e6c7aa44
(gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
50796
diff
changeset
|
1960 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1961 ; (define-key menu [assembler] '("Assembler" . gdb-display-assembler-buffer)) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1962 ) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1963 |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1964 (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
|
1965 (define-key gud-menu-map [view] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1966 `(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
|
1967 ; (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
|
1968 ; :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
|
1969 ; :button (:radio . (eq gdb-selected-view 'both)))) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1970 (define-key menu [assembler] '(menu-item "Assembler" gdb-view-assembler |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1971 :help "Display assembler only" |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1972 :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
|
1973 (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
|
1974 :help "Display source only" |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1975 :button (:radio . (eq gdb-selected-view 'source))))) |
48292 | 1976 |
52066
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1977 (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
|
1978 (define-key gud-menu-map [ui] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1979 `(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
|
1980 (define-key menu [gdb-restore-windows] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1981 '("Restore window layout" . gdb-restore-windows)) |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1982 (define-key menu [gdb-many-windows] |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1983 (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
|
1984 "Display other windows" "Many Windows %s" |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1985 "Display locals, stack and breakpoint information"))) |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
1986 |
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
|
1987 (defun gdb-frame-gdb-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
1988 (interactive) |
48292 | 1989 (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
|
1990 (gdb-get-create-buffer 'gdba))) |
48292 | 1991 |
51123
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1992 (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
|
1993 (interactive) |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1994 (gdb-display-buffer |
605e818cbe30
(gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51116
diff
changeset
|
1995 (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
|
1996 |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
1997 (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
|
1998 |
51693
04628db4db1a
(gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents:
51617
diff
changeset
|
1999 (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
|
2000 (interactive) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2001 (if gdb-view-source |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2002 (if gud-last-last-frame |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2003 (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
|
2004 (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
|
2005 (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
|
2006 (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
|
2007 |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2008 (defun gdb-view-assembler() |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2009 (interactive) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2010 (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
|
2011 (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
|
2012 (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
|
2013 |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2014 ;(defun gdb-view-both() |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2015 ;(interactive) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2016 ;(setq gdb-selected-view 'both)) |
48292 | 2017 |
2018 ;; 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
|
2019 (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
|
2020 (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
|
2021 (gdb-display-stack-buffer) |
48292 | 2022 (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
|
2023 (gdb-display-breakpoints-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
|
2024 (gdb-display-display-buffer) |
48292 | 2025 (delete-other-windows) |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
2026 (switch-to-buffer gud-comint-buffer) |
48292 | 2027 (split-window nil ( / ( * (window-height) 3) 4)) |
2028 (split-window nil ( / (window-height) 3)) | |
2029 (split-window-horizontally) | |
2030 (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
|
2031 (switch-to-buffer (gdb-locals-buffer-name)) |
48292 | 2032 (other-window 1) |
52066
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
2033 (if (and gdb-view-source |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
2034 (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
|
2035 (switch-to-buffer |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2036 (if gud-last-last-frame |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2037 (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
|
2038 (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
|
2039 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))) |
48292 | 2040 (setq gdb-source-window (get-buffer-window (current-buffer))) |
2041 (split-window-horizontally) | |
2042 (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
|
2043 (switch-to-buffer (gdb-inferior-io-name)) |
48292 | 2044 (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
|
2045 (switch-to-buffer (gdb-stack-buffer-name)) |
48292 | 2046 (split-window-horizontally) |
2047 (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
|
2048 (switch-to-buffer (gdb-breakpoints-buffer-name)) |
48292 | 2049 (other-window 1)) |
2050 | |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2051 (defcustom gdb-many-windows nil |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2052 "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
|
2053 the source buffer." |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2054 :type 'boolean |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2055 :group 'gud) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2056 |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2057 (defun gdb-many-windows (arg) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2058 "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
|
2059 (interactive "P") |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2060 (setq gdb-many-windows |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2061 (if (null arg) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2062 (not gdb-many-windows) |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2063 (> (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
|
2064 (gdb-restore-windows)) |
88be03de9df4
(gdb-many-windows): Define as a minor mode.
Nick Roberts <nickrob@snap.net.nz>
parents:
48570
diff
changeset
|
2065 |
48292 | 2066 (defun gdb-restore-windows () |
2067 "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
|
2068 This arrangement depends on the value of `gdb-many-windows'." |
48292 | 2069 (interactive) |
2070 (if gdb-many-windows | |
2071 (progn | |
2072 (switch-to-buffer gud-comint-buffer) | |
2073 (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
|
2074 (gdb-setup-windows)) |
48292 | 2075 (switch-to-buffer gud-comint-buffer) |
2076 (delete-other-windows) | |
2077 (split-window) | |
2078 (other-window 1) | |
52066
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
2079 (if (and gdb-view-source |
9a40de6a1802
(gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents:
51787
diff
changeset
|
2080 (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
|
2081 (switch-to-buffer |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2082 (if gud-last-last-frame |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2083 (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
|
2084 (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
|
2085 (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
|
2086 (setq gdb-source-window (get-buffer-window (current-buffer))) |
48292 | 2087 (other-window 1))) |
2088 | |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
2089 (defun gdb-reset () |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
2090 "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
|
2091 the source buffers." |
49039
6c5f45b01d2e
Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
49000
diff
changeset
|
2092 (gdb-delete-frames '()) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2093 (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
|
2094 (if (not (eq buffer gud-comint-buffer)) |
49249 | 2095 (with-current-buffer buffer |
49147
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
2096 (if (eq gud-minor-mode 'gdba) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
2097 (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
|
2098 (kill-buffer nil) |
52177
57a5b7571acc
(gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents:
52066
diff
changeset
|
2099 (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
|
2100 (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
|
2101 (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
|
2102 (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
|
2103 (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
|
2104 (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
|
2105 (setq gud-running nil) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
2106 (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
|
2107 (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
|
2108 (current-buffer)) |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
2109 left-margin-width |
8a40184e2f0e
(gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents:
49039
diff
changeset
|
2110 right-margin-width)))))))) |
48292 | 2111 |
2112 (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
|
2113 "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
|
2114 buffers." |
48292 | 2115 (goto-char (point-min)) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2116 (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
|
2117 (progn |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2118 (if (looking-at "\\S-*:\\(\\S-*\\)") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2119 (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
|
2120 (looking-at "\\S-*") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2121 (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
|
2122 (search-forward "Located in ") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2123 (looking-at "\\S-*") |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2124 (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
|
2125 (setq gdb-view-source nil)) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2126 (delete-other-windows) |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
2127 (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
|
2128 (if gdb-many-windows |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2129 (gdb-setup-windows) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2130 (gdb-display-breakpoints-buffer) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2131 (gdb-display-display-buffer) |
48292 | 2132 (delete-other-windows) |
51617
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2133 (split-window) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2134 (other-window 1) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2135 (if gdb-view-source |
51787
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
2136 (switch-to-buffer |
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
2137 (if gud-last-last-frame |
10f90558dc89
(gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents:
51693
diff
changeset
|
2138 (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
|
2139 (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
|
2140 (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
|
2141 (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
|
2142 (other-window 1))) |
48292 | 2143 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
2144 ;;from put-image |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2145 (defun gdb-put-string (putstring pos) |
48292 | 2146 "Put string PUTSTRING in front of POS in the current buffer. |
2147 PUTSTRING is displayed by putting an overlay into the current buffer with a | |
2148 `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
|
2149 PUTSTRING." |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
2150 (let ((gdb-string "x") |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
2151 (buffer (current-buffer))) |
48292 | 2152 (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
|
2153 (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
|
2154 (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
|
2155 (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
|
2156 (overlay-put overlay 'before-string gdb-string)))) |
48292 | 2157 |
48662
d29870d63092
Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48661
diff
changeset
|
2158 ;;from remove-images |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2159 (defun gdb-remove-strings (start end &optional buffer) |
48292 | 2160 "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
|
2161 Remove only strings that were put in BUFFER with calls to `put-string'. |
48292 | 2162 BUFFER nil or omitted means use the current buffer." |
2163 (unless buffer | |
2164 (setq buffer (current-buffer))) | |
2165 (let ((overlays (overlays-in start end))) | |
2166 (while overlays | |
2167 (let ((overlay (car overlays))) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2168 (when (overlay-get overlay 'put-break) |
48292 | 2169 (delete-overlay overlay))) |
2170 (setq overlays (cdr overlays))))) | |
2171 | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2172 (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
|
2173 "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
|
2174 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
|
2175 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
|
2176 \"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
|
2177 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
|
2178 (let ((gdb-string "gdb-arrow") |
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
2179 (buffer (current-buffer))) |
48292 | 2180 (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
|
2181 (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
|
2182 (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
|
2183 (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
|
2184 (overlay-put overlay 'before-string gdb-string)))) |
48292 | 2185 |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2186 (defun gdb-remove-arrow (&optional buffer) |
48292 | 2187 "Remove arrow in BUFFER. |
2188 Remove only images that were put in BUFFER with calls to `put-arrow'. | |
2189 BUFFER nil or omitted means use the current buffer." | |
2190 (unless buffer | |
2191 (setq buffer (current-buffer))) | |
2192 (let ((overlays (overlays-in (point-min) (point-max)))) | |
2193 (while overlays | |
2194 (let ((overlay (car overlays))) | |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2195 (when (overlay-get overlay 'put-arrow) |
48292 | 2196 (delete-overlay overlay))) |
2197 (setq overlays (cdr overlays))))) | |
2198 | |
2199 (defun gdb-array-visualise () | |
2200 "Visualise arrays and slices using graph program from plotutils." | |
48498
8fdedd7dca85
General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents:
48300
diff
changeset
|
2201 (interactive) |
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
|
2202 (when (and (display-graphic-p) gdb-display-string) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2203 (let ((n 0) m) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2204 (catch 'multi-dimensional |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2205 (while (eq (aref gdb-array-start n) (aref gdb-array-stop n)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2206 (setq n (+ n 1))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2207 (setq m (+ n 1)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2208 (while (< m (length gdb-array-start)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2209 (if (not (eq (aref gdb-array-start m) (aref gdb-array-stop m))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2210 (progn |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2211 (x-popup-dialog |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2212 t `(,(concat "Only one dimensional data can be visualised.\n" |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2213 "Use an array slice to reduce the number of\n" |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2214 "dimensions") ("OK" t))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2215 (throw 'multi-dimensional nil)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2216 (setq m (+ m 1)))) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2217 (shell-command (concat "echo" gdb-display-string " | graph -a 1 " |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2218 (int-to-string (aref gdb-array-start n)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2219 " -x " |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2220 (int-to-string (aref gdb-array-start n)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2221 " " |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2222 (int-to-string (aref gdb-array-stop n)) |
b092bff770ec
Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48659
diff
changeset
|
2223 " 1 -T X")))))) |
48292 | 2224 |
49000
f3c5848184cb
(gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents:
48963
diff
changeset
|
2225 (defun gdb-delete-expression () |
48292 | 2226 "Delete displayed expression and its frame." |
2227 (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
|
2228 (gdb-enqueue-input |
48292 | 2229 (list (concat "server delete display " gdb-display-number "\n") |
48963
1bb53161a4b9
(gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents:
48955
diff
changeset
|
2230 'ignore))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2231 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2232 ;; |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2233 ;; Assembler buffer. |
48292 | 2234 ;; |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2235 (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
|
2236 'gdb-assembler-buffer-name |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2237 'gdb-assembler-mode) |
48292 | 2238 |
2239 (def-gdb-auto-updated-buffer gdb-assembler-buffer | |
2240 gdb-invalidate-assembler | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2241 (concat "server disassemble " gdb-current-address "\n") |
48292 | 2242 gdb-assembler-handler |
2243 gdb-assembler-custom) | |
2244 | |
2245 (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
|
2246 (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
|
2247 (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
|
2248 (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
|
2249 (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
|
2250 (progn |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2251 (gdb-remove-arrow) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2252 (goto-char (point-min)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2253 (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
|
2254 (progn |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2255 (setq gdb-arrow-position (point)) |
cef03ad7bf21
(gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents:
51529
diff
changeset
|
2256 (gdb-put-arrow "=>" (point)))))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2257 ;; 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
|
2258 (if (display-images-p) |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2259 (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
|
2260 (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
|
2261 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
48292 | 2262 (goto-char (point-min)) |
2263 (while (< (point) (- (point-max) 1)) | |
2264 (forward-line 1) | |
2265 (if (looking-at "[^\t].*breakpoint") | |
2266 (progn | |
2267 (looking-at | |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2268 "[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
|
2269 (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
|
2270 (setq address (match-string 2)) |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2271 ;; 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
|
2272 (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
|
2273 (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
|
2274 (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
|
2275 (goto-char (point-min)) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2276 (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
|
2277 (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
|
2278 (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
|
2279 (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
|
2280 (progn |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2281 (remove-images start end) |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2282 (if (eq ?y flag) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2283 (put-image breakpoint-enabled-icon |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2284 (+ start 1) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2285 "breakpoint icon enabled" |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2286 'left-margin) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2287 (put-image breakpoint-disabled-icon |
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2288 (+ start 1) |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2289 "breakpoint icon disabled" |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2290 'left-margin))) |
51086
3b5b1167fdf4
(put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents:
51028
diff
changeset
|
2291 (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
|
2292 (if (eq ?y flag) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2293 (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
|
2294 (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
|
2295 (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
|
2296 (set-window-point (get-buffer-window buffer) gdb-arrow-position)))) |
48292 | 2297 |
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
|
2298 (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
|
2299 (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
|
2300 (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
|
2301 map)) |
48292 | 2302 |
2303 (defun gdb-assembler-mode () | |
2304 "Major mode for viewing code assembler. | |
2305 | |
2306 \\{gdb-assembler-mode-map}" | |
2307 (setq major-mode 'gdb-assembler-mode) | |
2308 (setq mode-name "Assembler") | |
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
|
2309 (setq left-margin-width 2) |
51227
a1e2454a02ec
(gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents:
51172
diff
changeset
|
2310 (setq fringes-outside-margins t) |
48292 | 2311 (setq buffer-read-only t) |
2312 (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
|
2313 (gdb-invalidate-assembler)) |
48292 | 2314 |
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
|
2315 (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
|
2316 (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
|
2317 (concat "*Machine Code " (gdb-get-target-string) "*"))) |
48292 | 2318 |
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
|
2319 (defun gdb-display-assembler-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
2320 (interactive) |
48292 | 2321 (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
|
2322 (gdb-get-create-buffer 'gdb-assembler-buffer))) |
48292 | 2323 |
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
|
2324 (defun gdb-frame-assembler-buffer () |
48659
4d69c0f01cc0
(gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48641
diff
changeset
|
2325 (interactive) |
48292 | 2326 (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
|
2327 (gdb-get-create-buffer 'gdb-assembler-buffer))) |
48292 | 2328 |
51028
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2329 ;; 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
|
2330 ;; 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
|
2331 (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
|
2332 (if (gdb-get-buffer 'gdb-assembler-buffer) |
48292 | 2333 (progn |
52328
06d74a21fa32
(gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents:
52177
diff
changeset
|
2334 (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
|
2335 (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
|
2336 (gdb-get-pending-triggers))) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2337 (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
|
2338 gdb-previous-address))) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2339 (progn |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2340 ;; 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
|
2341 (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
|
2342 (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
|
2343 (dolist (item queue) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2344 (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
|
2345 (gdb-set-input-queue |
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
2346 (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
|
2347 (gdb-enqueue-input |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2348 (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
|
2349 'gdb-assembler-handler)) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2350 (gdb-set-pending-triggers |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2351 (cons 'gdb-invalidate-assembler |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2352 (gdb-get-pending-triggers))) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2353 (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
|
2354 (setq gdb-previous-frame gdb-current-frame))))))) |
48292 | 2355 |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2356 (defun gdb-get-current-frame () |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2357 (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
|
2358 (progn |
52443
31a30e670e11
(gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents:
52401
diff
changeset
|
2359 (gdb-enqueue-input |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2360 (list (concat "server info frame\n") 'gdb-frame-handler)) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
2361 (gdb-set-pending-triggers |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2362 (cons 'gdb-get-current-frame |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2363 (gdb-get-pending-triggers)))))) |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2364 |
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2365 (defun gdb-frame-handler () |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49249
diff
changeset
|
2366 (gdb-set-pending-triggers |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2367 (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
|
2368 (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
|
2369 (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
|
2370 (forward-line) |
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2371 (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
|
2372 (progn |
323ddc93f3fe
(gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents:
50962
diff
changeset
|
2373 (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
|
2374 (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
|
2375 ;; 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
|
2376 (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
|
2377 (setq gdb-current-address |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2378 (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
|
2379 (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
|
2380 (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
|
2381 (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
|
2382 (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
|
2383 (progn |
51116
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2384 (set-window-buffer |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2385 gdb-source-window |
cac5cb5d83ec
(gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
51086
diff
changeset
|
2386 (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
|
2387 ;;update with new frame for machine code if necessary |
51529
39126c23006f
(gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents:
51227
diff
changeset
|
2388 (gdb-invalidate-assembler))))))) |
48955
1abfa35a3a5a
(gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents:
48921
diff
changeset
|
2389 |
48292 | 2390 (provide 'gdb-ui) |
2391 | |
52401 | 2392 ;;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
48292 | 2393 ;;; gdb-ui.el ends here |