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