Mercurial > emacs
annotate lisp/progmodes/gdb-ui.el @ 63181:8eb5e32e0392
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 10 Jun 2005 01:00:55 +0000 |
parents | bd3ecd5ebdff |
children | 7d3302b1aa9b 01137c1fdbe9 |
rev | line source |
---|---|
54538 | 1 ;;; gdb-ui.el --- User Interface for running GDB |
2 | |
54993
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
3 ;; Author: Nick Roberts <nickrob@gnu.org> |
54538 | 4 ;; Maintainer: FSF |
5 ;; Keywords: unix, tools | |
6 | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
7 ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
54538 | 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 | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
28 ;; This mode acts as a graphical user interface to GDB. You can interact with |
54538 | 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. | |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
31 ;; It separates the input/output of your program from that of GDB, if |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
32 ;; required, and watches expressions in the speedbar. It also uses features of |
56258
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
33 ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar |
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
34 ;; (see the GDB Graphical Interface section in the Emacs info manual). |
54538 | 35 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
36 ;; By default, M-x gdb will start the debugger. However, if you have customised |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
37 ;; gud-gdb-command-name, then start it with M-x gdba. |
54538 | 38 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
39 ;; This file has evolved from gdba.el that was included with GDB 5.0 and |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
40 ;; written by Tom Lord and Jim Kingdon. It uses GDB's annotation interface. |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
41 ;; You don't need to know about annotations to use this mode as a debugger, |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
42 ;; but if you are interested developing the mode itself, then see the |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
43 ;; Annotations section in the GDB info manual. |
55850
63ca25eb73a1
(gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents:
55764
diff
changeset
|
44 ;; |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
45 ;; GDB developers plan to make the annotation interface obsolete. A new |
55850
63ca25eb73a1
(gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents:
55764
diff
changeset
|
46 ;; interface called GDB/MI (machine interface) has been designed to replace |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
47 ;; it. Some GDB/MI commands are used in this file through the CLI command |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
48 ;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included with |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
49 ;; GDB (6.2 onwards) that uses GDB/MI as the primary interface to GDB. It is |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
50 ;; still under development and is part of a process to migrate Emacs from |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
51 ;; annotations to GDB/MI. |
54538 | 52 ;; |
53 ;; Known Bugs: | |
54 ;; | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
55 ;; TODO: |
59808 | 56 ;; 1) Use MI command -data-read-memory for memory window. |
57 ;; 2) Highlight changed register values (use MI commands | |
58 ;; -data-list-register-values and -data-list-changed-registers instead | |
59 ;; of 'info registers'. | |
60 ;; 3) Use tree-widget.el instead of the speedbar for watch-expressions? | |
61 ;; 4) Mark breakpoint locations on scroll-bar of source buffer? | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
62 ;; 5) After release of 22.1 use '-var-list-children --all-values' |
59808 | 63 ;; and '-stack-list-locals 2' which need GDB 6.1 onwards. |
54538 | 64 |
65 ;;; Code: | |
66 | |
67 (require 'gud) | |
68 | |
62716 | 69 (defvar gdb-frame-address "main" "Initialisation for Assembler buffer.") |
70 (defvar gdb-previous-frame-address nil) | |
59808 | 71 (defvar gdb-memory-address "main") |
54538 | 72 (defvar gdb-previous-frame nil) |
62716 | 73 (defvar gdb-selected-frame nil) |
74 (defvar gdb-frame-number nil) | |
54538 | 75 (defvar gdb-current-language nil) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
76 (defvar gdb-var-list nil "List of variables in watch window.") |
54538 | 77 (defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed.") |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
78 (defvar gdb-main-file nil "Source file from which program execution begins.") |
54538 | 79 (defvar gdb-buffer-type nil) |
80 (defvar gdb-overlay-arrow-position nil) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
81 (defvar gdb-server-prefix nil) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
82 (defvar gdb-flush-pending-output nil) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
83 (defvar gdb-location-alist nil |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
84 "Alist of breakpoint numbers and full filenames.") |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
85 (defvar gdb-find-file-unhook nil) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
86 (defvar gdb-active-process nil "GUD tooltips display variable values when t, \ |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
87 and #define directives otherwise.") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
88 (defvar gdb-macro-info nil |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
89 "Non-nil if GDB knows that the inferior includes preprocessor macro info.") |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
90 |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
91 (defvar gdb-buffer-type nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
92 "One of the symbols bound in `gdb-buffer-rules'.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
93 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
94 (defvar gdb-input-queue () |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
95 "A list of gdb command objects.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
96 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
97 (defvar gdb-prompting nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
98 "True when gdb is idle with no pending input.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
99 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
100 (defvar gdb-output-sink 'user |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
101 "The disposition of the output of the current gdb command. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
102 Possible values are these symbols: |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
103 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
104 `user' -- gdb output should be copied to the GUD buffer |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
105 for the user to see. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
106 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
107 `inferior' -- gdb output should be copied to the inferior-io buffer |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
108 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
109 `pre-emacs' -- output should be ignored util the post-prompt |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
110 annotation is received. Then the output-sink |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
111 becomes:... |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
112 `emacs' -- output should be collected in the partial-output-buffer |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
113 for subsequent processing by a command. This is the |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
114 disposition of output generated by commands that |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
115 gdb mode sends to gdb on its own behalf. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
116 `post-emacs' -- ignore output until the prompt annotation is |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
117 received, then go to USER disposition. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
118 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
119 gdba (gdb-ui.el) uses all five values, gdbmi (gdb-mi.el) only two |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
120 \(`user' and `emacs').") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
121 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
122 (defvar gdb-current-item nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
123 "The most recent command item sent to gdb.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
124 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
125 (defvar gdb-pending-triggers '() |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
126 "A list of trigger functions that have run later than their output |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
127 handlers.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
128 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
129 ;; end of gdb variables |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
130 |
54538 | 131 ;;;###autoload |
132 (defun gdba (command-line) | |
133 "Run gdb on program FILE in buffer *gud-FILE*. | |
134 The directory containing FILE becomes the initial working directory | |
135 and source-file directory for your debugger. | |
136 | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
137 If `gdb-many-windows' is nil (the default value) then gdb just |
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
138 pops up the GUD buffer unless `gdb-show-main' is t. In this case |
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
139 it starts with two windows: one displaying the GUD buffer and the |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
140 other with the source file with the main routine of the inferior. |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
141 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
142 If `gdb-many-windows' is t, regardless of the value of |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
143 `gdb-show-main', the layout below will appear unless |
54760
c6ccb7a82f9f
(gdb-source-window): Remove variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
54729
diff
changeset
|
144 `gdb-use-inferior-io-buffer' is nil when the source buffer |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
145 occupies the full width of the frame. Keybindings are given in |
54760
c6ccb7a82f9f
(gdb-source-window): Remove variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
54729
diff
changeset
|
146 relevant buffer. |
54538 | 147 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
148 Watch expressions appear in the speedbar/slowbar. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
149 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
150 The following commands help control operation : |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
151 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
152 `gdb-many-windows' - Toggle the number of windows gdb uses. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
153 `gdb-restore-windows' - To restore the window layout. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
154 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
155 See Info node `(emacs)GDB Graphical Interface' for a more |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
156 detailed description of this mode. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
157 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
158 |
54538 | 159 --------------------------------------------------------------------- |
160 GDB Toolbar | |
161 --------------------------------------------------------------------- | |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
162 GUD buffer (I/O of GDB) | Locals buffer |
54538 | 163 | |
164 | | |
165 | | |
166 --------------------------------------------------------------------- | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
167 Source buffer | Input/Output (of inferior) buffer |
54538 | 168 | (comint-mode) |
169 | | |
170 | | |
171 | | |
172 | | |
173 | | |
174 | | |
175 --------------------------------------------------------------------- | |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
176 Stack buffer | Breakpoints buffer |
54538 | 177 RET gdb-frames-select | SPC gdb-toggle-breakpoint |
178 | RET gdb-goto-breakpoint | |
179 | d gdb-delete-breakpoint | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
180 ---------------------------------------------------------------------" |
54538 | 181 ;; |
182 (interactive (list (gud-query-cmdline 'gdba))) | |
183 ;; | |
184 ;; Let's start with a basic gud-gdb buffer and then modify it a bit. | |
185 (gdb command-line) | |
186 (gdb-ann3)) | |
187 | |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
188 (defvar gdb-debug-log nil) |
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
189 |
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
190 (defcustom gdb-enable-debug-log nil |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
191 "Non-nil means record the process input and output in `gdb-debug-log'." |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
192 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
193 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
194 :version "22.1") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
195 |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
196 (defcustom gdb-use-inferior-io-buffer nil |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
197 "Non-nil means display output from the inferior in a separate buffer." |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
198 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
199 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
200 :version "22.1") |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
201 |
62115
515e18600ed2
(gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
62065
diff
changeset
|
202 (defcustom gdb-cpp-define-alist-program "gcc -E -dM -" |
515e18600ed2
(gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
62065
diff
changeset
|
203 "Shell command for generating a list of defined macros in a source file. |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
204 This list is used to display the #define directive associated |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
205 with an identifier as a tooltip. It works in a debug session with |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
206 GDB, when gud-tooltip-mode is t. |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
207 |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
208 Set `gdb-cpp-define-alist-flags' for any include paths or |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
209 predefined macros." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
210 :type 'string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
211 :group 'gud |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
212 :version "22.1") |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
213 |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
214 (defcustom gdb-cpp-define-alist-flags "" |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
215 "Preprocessor flags for `gdb-cpp-define-alist-program'." |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
216 :type 'string |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
217 :group 'gud |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
218 :version "22.1") |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
219 |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
220 (defcustom gdb-show-main nil |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
221 "Non-nil means display source file containing the main routine at startup. |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
222 Also display the main routine in the disassembly buffer if present." |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
223 :type 'boolean |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
224 :group 'gud |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
225 :version "22.1") |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
226 |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
227 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
228 |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
229 (defun gdb-create-define-alist () |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
230 "Create an alist of #define directives for GUD tooltips." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
231 (let* ((file (buffer-file-name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
232 (output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
233 (with-output-to-string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
234 (with-current-buffer standard-output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
235 (call-process shell-file-name |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
236 (if (file-exists-p file) file nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
237 (list t nil) nil "-c" |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
238 (concat gdb-cpp-define-alist-program " " |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
239 gdb-cpp-define-alist-flags))))) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
240 (define-list (split-string output "\n" t)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
241 (name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
242 (setq gdb-define-alist nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
243 (dolist (define define-list) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
244 (setq name (nth 1 (split-string define "[( ]"))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
245 (push (cons name define) gdb-define-alist)))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
246 |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
247 (defun gdb-tooltip-print () |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
248 (tooltip-show |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
249 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
250 (let ((string (buffer-string))) |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
251 ;; remove newline for gud-tooltip-echo-area |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
252 (substring string 0 (- (length string) 1)))) |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
253 gud-tooltip-echo-area)) |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
254 |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
255 ;; If expr is a macro for a function don't print because of possible dangerous |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
256 ;; side-effects. Also printing a function within a tooltip generates an |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
257 ;; unexpected starting annotation (phase error). |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
258 (defun gdb-tooltip-print-1 (expr) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
259 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
260 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
261 (if (search-forward "expands to: " nil t) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
262 (unless (looking-at "\\S+.*(.*).*") |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
263 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
264 (list (concat gdb-server-prefix "print " expr "\n") |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
265 'gdb-tooltip-print)))))) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
266 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
267 (defun gdb-set-gud-minor-mode (buffer) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
268 "Set gud-minor-mode from find-file if appropriate." |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
269 (goto-char (point-min)) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
270 (unless (search-forward "No source file named " nil t) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
271 (condition-case nil |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
272 (gdb-enqueue-input |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
273 (list (concat gdb-server-prefix "info source\n") |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
274 `(lambda () (gdb-set-gud-minor-mode-1 ,buffer)))) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
275 (error (setq gdb-find-file-unhook t))))) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
276 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
277 (defun gdb-set-gud-minor-mode-1 (buffer) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
278 (goto-char (point-min)) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
279 (when (and (search-forward "Located in " nil t) |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
280 (looking-at "\\S-+") |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
281 (string-equal (buffer-file-name buffer) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
282 (match-string 0))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
283 (with-current-buffer buffer |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
284 (set (make-local-variable 'gud-minor-mode) 'gdba) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
285 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
286 (when gud-tooltip-mode |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
287 (make-local-variable 'gdb-define-alist) |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
288 (gdb-create-define-alist) |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
289 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
290 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
291 (defun gdb-set-gud-minor-mode-existing-buffers () |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
292 (dolist (buffer (buffer-list)) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
293 (let ((file (buffer-file-name buffer))) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
294 (if file |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
295 (progn |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
296 (gdb-enqueue-input |
60124
106946a8423d
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
60073
diff
changeset
|
297 (list (concat gdb-server-prefix "list " |
106946a8423d
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
60073
diff
changeset
|
298 (file-name-nondirectory file) ":1\n") |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
299 `(lambda () (gdb-set-gud-minor-mode ,buffer))))))))) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
300 |
54538 | 301 (defun gdb-ann3 () |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
302 (setq gdb-debug-log nil) |
54538 | 303 (set (make-local-variable 'gud-minor-mode) 'gdba) |
304 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) | |
305 ;; | |
62716 | 306 (gud-def gud-break (if (not (string-match "Machine" mode-name)) |
54538 | 307 (gud-call "break %f:%l" arg) |
308 (save-excursion | |
309 (beginning-of-line) | |
310 (forward-char 2) | |
311 (gud-call "break *%a" arg))) | |
312 "\C-b" "Set breakpoint at current line or address.") | |
313 ;; | |
62716 | 314 (gud-def gud-remove (if (not (string-match "Machine" mode-name)) |
54538 | 315 (gud-call "clear %f:%l" arg) |
316 (save-excursion | |
317 (beginning-of-line) | |
318 (forward-char 2) | |
319 (gud-call "clear *%a" arg))) | |
320 "\C-d" "Remove breakpoint at current line or address.") | |
321 ;; | |
62716 | 322 (gud-def gud-until (if (not (string-match "Machine" mode-name)) |
54538 | 323 (gud-call "until %f:%l" arg) |
324 (save-excursion | |
325 (beginning-of-line) | |
326 (forward-char 2) | |
327 (gud-call "until *%a" arg))) | |
328 "\C-u" "Continue to current line or address.") | |
329 | |
330 (define-key gud-minor-mode-map [left-margin mouse-1] | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
331 'gdb-mouse-set-clear-breakpoint) |
54538 | 332 (define-key gud-minor-mode-map [left-fringe mouse-1] |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
333 'gdb-mouse-set-clear-breakpoint) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
334 (define-key gud-minor-mode-map [left-margin mouse-3] |
54538 | 335 'gdb-mouse-toggle-breakpoint) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
336 ; Currently only works in margin. |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
337 ; (define-key gud-minor-mode-map [left-fringe mouse-3] |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
338 ; 'gdb-mouse-toggle-breakpoint) |
54538 | 339 |
340 (setq comint-input-sender 'gdb-send) | |
341 ;; | |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
342 ;; (re-)initialize |
62716 | 343 (setq gdb-frame-address (if gdb-show-main "main" nil)) |
344 (setq gdb-previous-frame-address nil | |
345 gdb-memory-address "main" | |
346 gdb-previous-frame nil | |
347 gdb-selected-frame nil | |
348 gdb-current-language nil | |
349 gdb-frame-number nil | |
350 gdb-var-list nil | |
351 gdb-var-changed nil | |
352 gdb-first-prompt nil | |
353 gdb-prompting nil | |
354 gdb-input-queue nil | |
355 gdb-current-item nil | |
356 gdb-pending-triggers nil | |
357 gdb-output-sink 'user | |
358 gdb-server-prefix "server " | |
359 gdb-flush-pending-output nil | |
360 gdb-location-alist nil | |
361 gdb-find-file-unhook nil | |
362 gdb-macro-info nil) | |
54538 | 363 ;; |
364 (setq gdb-buffer-type 'gdba) | |
365 ;; | |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
366 (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io)) |
54538 | 367 ;; |
368 (if (eq window-system 'w32) | |
369 (gdb-enqueue-input (list "set new-console off\n" 'ignore))) | |
370 (gdb-enqueue-input (list "set height 0\n" 'ignore)) | |
59998
c2d7ae01e91d
(gdb-ann3): Re-instate GDB command "set
Nick Roberts <nickrob@snap.net.nz>
parents:
59996
diff
changeset
|
371 (gdb-enqueue-input (list "set width 0\n" 'ignore)) |
54538 | 372 ;; find source file and compilation directory here |
373 (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program | |
374 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran program | |
375 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)) | |
376 ;; | |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
377 (gdb-set-gud-minor-mode-existing-buffers) |
54538 | 378 (run-hooks 'gdba-mode-hook)) |
379 | |
380 (defcustom gdb-use-colon-colon-notation nil | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
381 "If non-nil use FUN::VAR format to display variables in the speedbar." |
54538 | 382 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
383 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
384 :version "22.1") |
54538 | 385 |
386 (defun gud-watch () | |
387 "Watch expression at point." | |
388 (interactive) | |
389 (require 'tooltip) | |
390 (let ((expr (tooltip-identifier-from-point (point)))) | |
391 (if (and (string-equal gdb-current-language "c") | |
62716 | 392 gdb-use-colon-colon-notation gdb-selected-frame) |
393 (setq expr (concat gdb-selected-frame "::" expr))) | |
54538 | 394 (catch 'already-watched |
395 (dolist (var gdb-var-list) | |
396 (if (string-equal expr (car var)) (throw 'already-watched nil))) | |
397 (set-text-properties 0 (length expr) nil expr) | |
398 (gdb-enqueue-input | |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
399 (list |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
400 (if (eq gud-minor-mode 'gdba) |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
401 (concat "server interpreter mi \"-var-create - * " expr "\"\n") |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
402 (concat"-var-create - * " expr "\n")) |
54538 | 403 `(lambda () (gdb-var-create-handler ,expr)))))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
404 (select-window (get-buffer-window gud-comint-buffer 0))) |
54538 | 405 |
406 (defconst gdb-var-create-regexp | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
407 "name=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"") |
54538 | 408 |
409 (defun gdb-var-create-handler (expr) | |
410 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) | |
411 (goto-char (point-min)) | |
412 (if (re-search-forward gdb-var-create-regexp nil t) | |
413 (let ((var (list expr | |
414 (match-string 1) | |
415 (match-string 2) | |
416 (match-string 3) | |
417 nil nil))) | |
418 (push var gdb-var-list) | |
419 (speedbar 1) | |
420 (if (equal (nth 2 var) "0") | |
421 (gdb-enqueue-input | |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
422 (list |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
423 (if (with-current-buffer |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
424 gud-comint-buffer (eq gud-minor-mode 'gdba)) |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
425 (concat "server interpreter mi \"-var-evaluate-expression " |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
426 (nth 1 var) "\"\n") |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
427 (concat "-var-evaluate-expression " (nth 1 var) "\n")) |
54538 | 428 `(lambda () (gdb-var-evaluate-expression-handler |
429 ,(nth 1 var) nil)))) | |
430 (setq gdb-var-changed t))) | |
431 (if (re-search-forward "Undefined command" nil t) | |
60541
fbf903562871
(gdb-var-create-handler, gdb-get-location):
Nick Roberts <nickrob@snap.net.nz>
parents:
60477
diff
changeset
|
432 (message-box "Watching expressions requires gdb 6.0 onwards") |
54538 | 433 (message "No symbol %s in current context." expr))))) |
434 | |
435 (defun gdb-var-evaluate-expression-handler (varnum changed) | |
436 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) | |
437 (goto-char (point-min)) | |
438 (re-search-forward ".*value=\"\\(.*?\\)\"" nil t) | |
439 (catch 'var-found | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
440 (let ((num 0)) |
54538 | 441 (dolist (var gdb-var-list) |
442 (if (string-equal varnum (cadr var)) | |
443 (progn | |
444 (if changed (setcar (nthcdr 5 var) t)) | |
445 (setcar (nthcdr 4 var) (match-string 1)) | |
446 (setcar (nthcdr num gdb-var-list) var) | |
447 (throw 'var-found nil))) | |
448 (setq num (+ num 1)))))) | |
449 (setq gdb-var-changed t)) | |
450 | |
451 (defun gdb-var-list-children (varnum) | |
452 (gdb-enqueue-input | |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
453 (list (concat "server interpreter mi \"-var-list-children " varnum "\"\n") |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
454 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
54538 | 455 |
456 (defconst gdb-var-list-children-regexp | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
457 "name=\"\\(.*?\\)\",exp=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\"") |
54538 | 458 |
459 (defun gdb-var-list-children-handler (varnum) | |
460 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) | |
461 (goto-char (point-min)) | |
462 (let ((var-list nil)) | |
463 (catch 'child-already-watched | |
464 (dolist (var gdb-var-list) | |
465 (if (string-equal varnum (cadr var)) | |
466 (progn | |
467 (push var var-list) | |
468 (while (re-search-forward gdb-var-list-children-regexp nil t) | |
469 (let ((varchild (list (match-string 2) | |
470 (match-string 1) | |
471 (match-string 3) | |
472 nil nil nil))) | |
473 (if (looking-at ",type=\"\\(.*?\\)\"") | |
474 (setcar (nthcdr 3 varchild) (match-string 1))) | |
475 (dolist (var1 gdb-var-list) | |
476 (if (string-equal (cadr var1) (cadr varchild)) | |
477 (throw 'child-already-watched nil))) | |
478 (push varchild var-list) | |
479 (if (equal (nth 2 varchild) "0") | |
480 (gdb-enqueue-input | |
481 (list | |
482 (concat | |
483 "server interpreter mi \"-var-evaluate-expression " | |
484 (nth 1 varchild) "\"\n") | |
485 `(lambda () (gdb-var-evaluate-expression-handler | |
486 ,(nth 1 varchild) nil)))))))) | |
487 (push var var-list))) | |
488 (setq gdb-var-list (nreverse var-list)))))) | |
489 | |
490 (defun gdb-var-update () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
491 (if (not (member 'gdb-var-update gdb-pending-triggers)) |
54538 | 492 (progn |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
493 (gdb-enqueue-input |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
494 (list |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
495 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
496 "server interpreter mi \"-var-update *\"\n" |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
497 "-var-update *\n") |
54538 | 498 'gdb-var-update-handler)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
499 (push 'gdb-var-update gdb-pending-triggers)))) |
54538 | 500 |
501 (defconst gdb-var-update-regexp "name=\"\\(.*?\\)\"") | |
502 | |
503 (defun gdb-var-update-handler () | |
504 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) | |
505 (goto-char (point-min)) | |
506 (while (re-search-forward gdb-var-update-regexp nil t) | |
507 (let ((varnum (match-string 1))) | |
508 (gdb-enqueue-input | |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
509 (list |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
510 (if (with-current-buffer gud-comint-buffer |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
511 (eq gud-minor-mode 'gdba)) |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
512 (concat "server interpreter mi \"-var-evaluate-expression " |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
513 varnum "\"\n") |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
514 (concat "-var-evaluate-expression " varnum "\n")) |
54538 | 515 `(lambda () (gdb-var-evaluate-expression-handler |
516 ,varnum t))))))) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
517 (setq gdb-pending-triggers |
60153
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
518 (delq 'gdb-var-update gdb-pending-triggers)) |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
519 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
520 ;; dummy command to update speedbar at right time |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
521 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn)) |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
522 ;; keep gdb-pending-triggers non-nil till end |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
523 (push 'gdb-speedbar-timer gdb-pending-triggers))) |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
524 |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
525 (defun gdb-speedbar-timer-fn () |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
526 (setq gdb-pending-triggers |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
527 (delq 'gdb-speedbar-timer gdb-pending-triggers)) |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
528 (with-current-buffer gud-comint-buffer |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
529 (speedbar-timer-fn))) |
54538 | 530 |
531 (defun gdb-var-delete () | |
532 "Delete watched expression from the speedbar." | |
533 (interactive) | |
534 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | |
535 (let ((text (speedbar-line-text))) | |
536 (string-match "\\(\\S-+\\)" text) | |
537 (let* ((expr (match-string 1 text)) | |
538 (var (assoc expr gdb-var-list)) | |
539 (varnum (cadr var))) | |
540 (unless (string-match "\\." varnum) | |
541 (gdb-enqueue-input | |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
542 (list |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
543 (if (with-current-buffer gud-comint-buffer |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
544 (eq gud-minor-mode 'gdba)) |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
545 (concat "server interpreter mi \"-var-delete " varnum "\"\n") |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
546 (concat "-var-delete " varnum "\n")) |
54538 | 547 'ignore)) |
548 (setq gdb-var-list (delq var gdb-var-list)) | |
549 (dolist (varchild gdb-var-list) | |
550 (if (string-match (concat (nth 1 var) "\\.") (nth 1 varchild)) | |
551 (setq gdb-var-list (delq varchild gdb-var-list)))) | |
552 (setq gdb-var-changed t)))))) | |
553 | |
554 (defun gdb-edit-value (text token indent) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
555 "Assign a value to a variable displayed in the speedbar." |
54538 | 556 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
557 (varnum (cadr var)) (value)) | |
558 (setq value (read-string "New value: ")) | |
559 (gdb-enqueue-input | |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
560 (list |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
561 (if (with-current-buffer gud-comint-buffer |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
562 (eq gud-minor-mode 'gdba)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
563 (concat "server interpreter mi \"-var-assign " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
564 varnum " " value "\"\n") |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
565 (concat "-var-assign " varnum " " value "\n")) |
54538 | 566 'ignore)))) |
567 | |
568 (defcustom gdb-show-changed-values t | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
569 "If non-nil highlight values that have recently changed in the speedbar. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
570 The highlighting is done with `font-lock-warning-face'." |
54538 | 571 :type 'boolean |
58049
fd0093bd412a
(gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
57982
diff
changeset
|
572 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
573 :version "22.1") |
54538 | 574 |
575 (defun gdb-speedbar-expand-node (text token indent) | |
576 "Expand the node the user clicked on. | |
577 TEXT is the text of the button we clicked on, a + or - item. | |
578 TOKEN is data related to this node. | |
579 INDENT is the current indentation depth." | |
580 (cond ((string-match "+" text) ;expand this node | |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
581 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
582 (gdb-var-list-children token) |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
583 (gdbmi-var-list-children token))) |
54538 | 584 ((string-match "-" text) ;contract this node |
585 (dolist (var gdb-var-list) | |
586 (if (string-match (concat token "\\.") (nth 1 var)) | |
587 (setq gdb-var-list (delq var gdb-var-list)))) | |
588 (setq gdb-var-changed t)))) | |
589 | |
590 (defun gdb-get-target-string () | |
591 (with-current-buffer gud-comint-buffer | |
592 gud-target-name)) | |
593 | |
594 | |
595 ;; | |
596 ;; gdb buffers. | |
597 ;; | |
598 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
599 ;; of that particular buffer. | |
600 ;; | |
601 ;; The usual gdb interaction buffer is given the type `gdba' and | |
602 ;; is constructed specially. | |
603 ;; | |
604 ;; Others are constructed by gdb-get-create-buffer and | |
605 ;; named according to the rules set forth in the gdb-buffer-rules-assoc | |
606 | |
607 (defvar gdb-buffer-rules-assoc '()) | |
608 | |
609 (defun gdb-get-buffer (key) | |
610 "Return the gdb buffer tagged with type KEY. | |
611 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
612 (save-excursion | |
613 (gdb-look-for-tagged-buffer key (buffer-list)))) | |
614 | |
615 (defun gdb-get-create-buffer (key) | |
616 "Create a new gdb buffer of the type specified by KEY. | |
617 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
618 (or (gdb-get-buffer key) | |
619 (let* ((rules (assoc key gdb-buffer-rules-assoc)) | |
620 (name (funcall (gdb-rules-name-maker rules))) | |
621 (new (get-buffer-create name))) | |
622 (with-current-buffer new | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
623 (let ((trigger)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
624 (if (cdr (cdr rules)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
625 (setq trigger (funcall (car (cdr (cdr rules)))))) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
626 (set (make-local-variable 'gdb-buffer-type) key) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
627 (set (make-local-variable 'gud-minor-mode) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
628 (with-current-buffer gud-comint-buffer gud-minor-mode)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
629 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
630 (if trigger (funcall trigger))) |
54538 | 631 new)))) |
632 | |
633 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
634 | |
635 (defun gdb-look-for-tagged-buffer (key bufs) | |
636 (let ((retval nil)) | |
637 (while (and (not retval) bufs) | |
638 (set-buffer (car bufs)) | |
639 (if (eq gdb-buffer-type key) | |
640 (setq retval (car bufs))) | |
641 (setq bufs (cdr bufs))) | |
642 retval)) | |
643 | |
644 ;; | |
645 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
646 ;; at least one and possible more functions. The functions have these | |
647 ;; roles in defining a buffer type: | |
648 ;; | |
649 ;; NAME - Return a name for this buffer type. | |
650 ;; | |
651 ;; The remaining function(s) are optional: | |
652 ;; | |
653 ;; MODE - called in a new buffer with no arguments, should establish | |
654 ;; the proper mode for the buffer. | |
655 ;; | |
656 | |
657 (defun gdb-set-buffer-rules (buffer-type &rest rules) | |
658 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) | |
659 (if binding | |
660 (setcdr binding rules) | |
661 (push (cons buffer-type rules) | |
662 gdb-buffer-rules-assoc)))) | |
663 | |
664 ;; GUD buffers are an exception to the rules | |
665 (gdb-set-buffer-rules 'gdba 'error) | |
666 | |
667 ;; | |
668 ;; Partial-output buffer : This accumulates output from a command executed on | |
669 ;; behalf of emacs (rather than the user). | |
670 ;; | |
671 (gdb-set-buffer-rules 'gdb-partial-output-buffer | |
672 'gdb-partial-output-name) | |
673 | |
674 (defun gdb-partial-output-name () | |
675 (concat "*partial-output-" | |
676 (gdb-get-target-string) | |
677 "*")) | |
678 | |
679 | |
680 (gdb-set-buffer-rules 'gdb-inferior-io | |
681 'gdb-inferior-io-name | |
682 'gdb-inferior-io-mode) | |
683 | |
684 (defun gdb-inferior-io-name () | |
685 (concat "*input/output of " | |
686 (gdb-get-target-string) | |
687 "*")) | |
688 | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
689 (defun gdb-display-inferior-io-buffer () |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
690 "Display IO of inferior in a separate window." |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
691 (interactive) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
692 (if gdb-use-inferior-io-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
693 (gdb-display-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
694 (gdb-get-create-buffer 'gdb-inferior-io)))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
695 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
696 (defun gdb-frame-inferior-io-buffer () |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
697 "Display IO of inferior in a new frame." |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
698 (interactive) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
699 (if gdb-use-inferior-io-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
700 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
701 (special-display-frame-alist gdb-frame-parameters)) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
702 (display-buffer (gdb-get-create-buffer 'gdb-inferior-io))))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
703 |
54538 | 704 (defvar gdb-inferior-io-mode-map |
705 (let ((map (make-sparse-keymap))) | |
706 (define-key map "\C-c\C-c" 'gdb-inferior-io-interrupt) | |
707 (define-key map "\C-c\C-z" 'gdb-inferior-io-stop) | |
708 (define-key map "\C-c\C-\\" 'gdb-inferior-io-quit) | |
709 (define-key map "\C-c\C-d" 'gdb-inferior-io-eof) | |
62659
2a8fbbf1f0f4
(gdb-inferior-io-mode-map): Bind gdb-inferior-io-eof to C-d.
Nick Roberts <nickrob@snap.net.nz>
parents:
62614
diff
changeset
|
710 (define-key map "\C-d" 'gdb-inferior-io-eof) |
54538 | 711 map)) |
712 | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
713 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
54538 | 714 "Major mode for gdb inferior-io." |
715 :syntax-table nil :abbrev-table nil | |
716 ;; We want to use comint because it has various nifty and familiar | |
717 ;; features. We don't need a process, but comint wants one, so create | |
718 ;; a dummy one. | |
719 (make-comint-in-buffer | |
720 (substring (buffer-name) 1 (- (length (buffer-name)) 1)) | |
721 (current-buffer) "hexl") | |
722 (setq comint-input-sender 'gdb-inferior-io-sender)) | |
723 | |
724 (defun gdb-inferior-io-sender (proc string) | |
725 ;; PROC is the pseudo-process created to satisfy comint. | |
726 (with-current-buffer (process-buffer proc) | |
727 (setq proc (get-buffer-process gud-comint-buffer)) | |
728 (process-send-string proc string) | |
729 (process-send-string proc "\n"))) | |
730 | |
731 (defun gdb-inferior-io-interrupt () | |
732 "Interrupt the program being debugged." | |
733 (interactive) | |
734 (interrupt-process | |
735 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
736 | |
737 (defun gdb-inferior-io-quit () | |
738 "Send quit signal to the program being debugged." | |
739 (interactive) | |
740 (quit-process | |
741 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
742 | |
743 (defun gdb-inferior-io-stop () | |
744 "Stop the program being debugged." | |
745 (interactive) | |
746 (stop-process | |
747 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
748 | |
749 (defun gdb-inferior-io-eof () | |
750 "Send end-of-file to the program being debugged." | |
751 (interactive) | |
752 (process-send-eof | |
753 (get-buffer-process gud-comint-buffer))) | |
754 | |
755 | |
756 ;; | |
757 ;; gdb communications | |
758 ;; | |
759 | |
760 ;; INPUT: things sent to gdb | |
761 ;; | |
762 ;; The queues are lists. Each element is either a string (indicating user or | |
763 ;; user-like input) or a list of the form: | |
764 ;; | |
765 ;; (INPUT-STRING HANDLER-FN) | |
766 ;; | |
767 ;; The handler function will be called from the partial-output buffer when the | |
768 ;; command completes. This is the way to write commands which invoke gdb | |
769 ;; commands autonomously. | |
770 ;; | |
771 ;; These lists are consumed tail first. | |
772 ;; | |
773 | |
774 (defun gdb-send (proc string) | |
775 "A comint send filter for gdb. | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
776 This filter may simply queue input for a later time." |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
777 (let ((item (concat string "\n"))) |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
778 (if gud-running |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
779 (progn |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
780 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log)) |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
781 (process-send-string proc item)) |
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
782 (gdb-enqueue-input item)))) |
54538 | 783 |
784 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
785 ;; is a query, or other non-top-level prompt. | |
786 | |
787 (defun gdb-enqueue-input (item) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
788 (if gdb-prompting |
54538 | 789 (progn |
790 (gdb-send-item item) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
791 (setq gdb-prompting nil)) |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
792 (push item gdb-input-queue))) |
54538 | 793 |
794 (defun gdb-dequeue-input () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
795 (let ((queue gdb-input-queue)) |
54538 | 796 (and queue |
797 (let ((last (car (last queue)))) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
798 (unless (nbutlast queue) (setq gdb-input-queue '())) |
54538 | 799 last)))) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
800 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
801 (defun gdb-send-item (item) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
802 (setq gdb-flush-pending-output nil) |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
803 (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
804 (setq gdb-current-item item) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
805 (with-current-buffer gud-comint-buffer |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
806 (if (eq gud-minor-mode 'gdba) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
807 (if (stringp item) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
808 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
809 (setq gdb-output-sink 'user) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
810 (process-send-string (get-buffer-process gud-comint-buffer) item)) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
811 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
812 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
813 (setq gdb-output-sink 'pre-emacs) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
814 (process-send-string (get-buffer-process gud-comint-buffer) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
815 (car item)))) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
816 ;; case: eq gud-minor-mode 'gdbmi |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
817 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
818 (setq gdb-output-sink 'emacs) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
819 (process-send-string (get-buffer-process gud-comint-buffer) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
820 (car item))))) |
54538 | 821 |
822 ;; | |
823 ;; output -- things gdb prints to emacs | |
824 ;; | |
825 ;; GDB output is a stream interrupted by annotations. | |
826 ;; Annotations can be recognized by their beginning | |
827 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
828 ;; | |
829 ;; The tag is a string obeying symbol syntax. | |
830 ;; | |
831 ;; The optional part `<opt>' can be either the empty string | |
832 ;; or a space followed by more data relating to the annotation. | |
833 ;; For example, the SOURCE annotation is followed by a filename, | |
834 ;; line number and various useless goo. This data must not include | |
835 ;; any newlines. | |
836 ;; | |
837 | |
838 (defcustom gud-gdba-command-name "gdb -annotate=3" | |
839 "Default command to execute an executable under the GDB-UI debugger." | |
840 :type 'string | |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
841 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
842 :version "22.1") |
54538 | 843 |
844 (defvar gdb-annotation-rules | |
845 '(("pre-prompt" gdb-pre-prompt) | |
846 ("prompt" gdb-prompt) | |
847 ("commands" gdb-subprompt) | |
848 ("overload-choice" gdb-subprompt) | |
849 ("query" gdb-subprompt) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
850 ;; Need this prompt for GDB 6.1 |
55507
e266c6d6bd7a
(gdb-annotation-rules): Add nquery annotation
Nick Roberts <nickrob@snap.net.nz>
parents:
55400
diff
changeset
|
851 ("nquery" gdb-subprompt) |
54538 | 852 ("prompt-for-continue" gdb-subprompt) |
853 ("post-prompt" gdb-post-prompt) | |
854 ("source" gdb-source) | |
855 ("starting" gdb-starting) | |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
856 ("exited" gdb-exited) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
857 ("signalled" gdb-exited) |
54538 | 858 ("signal" gdb-stopping) |
859 ("breakpoint" gdb-stopping) | |
860 ("watchpoint" gdb-stopping) | |
861 ("frame-begin" gdb-frame-begin) | |
862 ("stopped" gdb-stopped) | |
863 ) "An assoc mapping annotation tags to functions which process them.") | |
864 | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
865 (defun gdb-resync() |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
866 (setq gdb-flush-pending-output t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
867 (setq gud-running nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
868 (setq gdb-output-sink 'user) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
869 (setq gdb-input-queue nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
870 (setq gdb-pending-triggers nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
871 (setq gdb-prompting t)) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
872 |
54538 | 873 (defconst gdb-source-spec-regexp |
62716 | 874 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)") |
54538 | 875 |
876 ;; Do not use this except as an annotation handler. | |
877 (defun gdb-source (args) | |
878 (string-match gdb-source-spec-regexp args) | |
879 ;; Extract the frame position from the marker. | |
880 (setq gud-last-frame | |
881 (cons | |
882 (match-string 1 args) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
883 (string-to-number (match-string 2 args)))) |
62716 | 884 (setq gdb-frame-address (match-string 3 args)) |
54962
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
885 ;; cover for auto-display output which comes *before* |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
886 ;; stopped annotation |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
887 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) |
54538 | 888 |
889 (defun gdb-pre-prompt (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
890 "An annotation handler for `pre-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
891 This terminates the collection of output from a previous command if that |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
892 happens to be in effect." |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
893 (let ((sink gdb-output-sink)) |
54538 | 894 (cond |
895 ((eq sink 'user) t) | |
896 ((eq sink 'emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
897 (setq gdb-output-sink 'post-emacs)) |
54538 | 898 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
899 (gdb-resync) |
54538 | 900 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
901 | |
902 (defun gdb-prompt (ignored) | |
903 "An annotation handler for `prompt'. | |
904 This sends the next command (if any) to gdb." | |
905 (when gdb-first-prompt (gdb-ann3)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
906 (let ((sink gdb-output-sink)) |
54538 | 907 (cond |
908 ((eq sink 'user) t) | |
909 ((eq sink 'post-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
910 (setq gdb-output-sink 'user) |
54538 | 911 (let ((handler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
912 (car (cdr gdb-current-item)))) |
54538 | 913 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
914 (funcall handler)))) | |
915 (t | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
916 (gdb-resync) |
54538 | 917 (error "Phase error in gdb-prompt (got %s)" sink)))) |
918 (let ((input (gdb-dequeue-input))) | |
919 (if input | |
920 (gdb-send-item input) | |
921 (progn | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
922 (setq gdb-prompting t) |
54538 | 923 (gud-display-frame))))) |
924 | |
925 (defun gdb-subprompt (ignored) | |
926 "An annotation handler for non-top-level prompts." | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
927 (setq gdb-prompting t)) |
54538 | 928 |
929 (defun gdb-starting (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
930 "An annotation handler for `starting'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
931 This says that I/O for the subprocess is now the program being debugged, |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
932 not GDB." |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
933 (setq gdb-active-process t) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
934 (let ((sink gdb-output-sink)) |
54538 | 935 (cond |
936 ((eq sink 'user) | |
937 (progn | |
938 (setq gud-running t) | |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
939 (if gdb-use-inferior-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
940 (setq gdb-output-sink 'inferior)))) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
941 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
942 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
943 (error "Unexpected `starting' annotation"))))) |
54538 | 944 |
945 (defun gdb-stopping (ignored) | |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
946 "An annotation handler for `breakpoint' and other annotations. |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
947 They say that I/O for the subprocess is now GDB, not the program |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
948 being debugged." |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
949 (if gdb-use-inferior-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
950 (let ((sink gdb-output-sink)) |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
951 (cond |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
952 ((eq sink 'inferior) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
953 (setq gdb-output-sink 'user)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
954 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
955 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
956 (error "Unexpected stopping annotation")))))) |
54538 | 957 |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
958 (defun gdb-exited (ignored) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
959 "An annotation handler for `exited' and `signalled'. |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
960 They say that I/O for the subprocess is now GDB, not the program |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
961 being debugged and that the program is no longer running. This |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
962 function is used to change the focus of GUD tooltips to #define |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
963 directives." |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
964 (setq gdb-active-process nil) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
965 (gdb-stopping ignored)) |
62659
2a8fbbf1f0f4
(gdb-inferior-io-mode-map): Bind gdb-inferior-io-eof to C-d.
Nick Roberts <nickrob@snap.net.nz>
parents:
62614
diff
changeset
|
966 |
54538 | 967 (defun gdb-frame-begin (ignored) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
968 (let ((sink gdb-output-sink)) |
54538 | 969 (cond |
970 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
971 (setq gdb-output-sink 'user)) |
54538 | 972 ((eq sink 'user) t) |
973 ((eq sink 'emacs) t) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
974 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
975 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
976 (error "Unexpected frame-begin annotation (%S)" sink))))) |
54538 | 977 |
978 (defun gdb-stopped (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
979 "An annotation handler for `stopped'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
980 It is just like `gdb-stopping', except that if we already set the output |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
981 sink to `user' in `gdb-stopping', that is fine." |
54538 | 982 (setq gud-running nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
983 (let ((sink gdb-output-sink)) |
54538 | 984 (cond |
985 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
986 (setq gdb-output-sink 'user)) |
54538 | 987 ((eq sink 'user) t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
988 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
989 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
990 (error "Unexpected stopped annotation"))))) |
54538 | 991 |
992 (defun gdb-post-prompt (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
993 "An annotation handler for `post-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
994 This begins the collection of output from the current command if that |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
995 happens to be appropriate." |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
996 (unless gdb-pending-triggers |
62716 | 997 (gdb-get-selected-frame) |
54538 | 998 (gdb-invalidate-frames) |
999 (gdb-invalidate-breakpoints) | |
62716 | 1000 ;; Do this through gdb-get-selected-frame -> gdb-frame-handler |
1001 ;; so gdb-frame-address is updated. | |
1002 ;; (gdb-invalidate-assembler) | |
54538 | 1003 (gdb-invalidate-registers) |
59808 | 1004 (gdb-invalidate-memory) |
54538 | 1005 (gdb-invalidate-locals) |
1006 (gdb-invalidate-threads) | |
54617
9049edac1117
(gdb-post-prompt): Fix test.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54616
diff
changeset
|
1007 (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3. |
9049edac1117
(gdb-post-prompt): Fix test.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54616
diff
changeset
|
1008 ;; FIXME: with GDB-6 on Darwin, this might very well work. |
60153
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
1009 ;; only needed/used with speedbar/watch expressions |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
1010 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
1011 (setq gdb-var-changed t) ; force update |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
1012 (dolist (var gdb-var-list) |
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
1013 (setcar (nthcdr 5 var) nil)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
1014 (gdb-var-update)))) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1015 (let ((sink gdb-output-sink)) |
54538 | 1016 (cond |
1017 ((eq sink 'user) t) | |
1018 ((eq sink 'pre-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1019 (setq gdb-output-sink 'emacs)) |
54538 | 1020 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1021 (gdb-resync) |
54538 | 1022 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
1023 | |
1024 (defun gud-gdba-marker-filter (string) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1025 "A gud marker filter for gdb. Handle a burst of output from GDB." |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1026 (if gdb-flush-pending-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1027 nil |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1028 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1029 ;; Recall the left over gud-marker-acc from last time |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1030 (setq gud-marker-acc (concat gud-marker-acc string)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1031 ;; Start accumulating output for the GUD buffer |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1032 (let ((output "")) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1033 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1034 ;; Process all the complete markers in this chunk. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1035 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1036 (let ((annotation (match-string 1 gud-marker-acc))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1037 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1038 ;; Stuff prior to the match is just ordinary output. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1039 ;; It is either concatenated to OUTPUT or directed |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1040 ;; elsewhere. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1041 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1042 (gdb-concat-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1043 output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1044 (substring gud-marker-acc 0 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1045 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1046 ;; Take that stuff off the gud-marker-acc. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1047 (setq gud-marker-acc (substring gud-marker-acc (match-end 0))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1048 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1049 ;; Parse the tag from the annotation, and maybe its arguments. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1050 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1051 (let* ((annotation-type (match-string 1 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1052 (annotation-arguments (match-string 2 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1053 (annotation-rule (assoc annotation-type |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1054 gdb-annotation-rules))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1055 ;; Call the handler for this annotation. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1056 (if annotation-rule |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1057 (funcall (car (cdr annotation-rule)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1058 annotation-arguments) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1059 ;; Else the annotation is not recognized. Ignore it silently, |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1060 ;; so that GDB can add new annotations without causing |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1061 ;; us to blow up. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1062 )))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1063 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1064 ;; Does the remaining text end in a partial line? |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1065 ;; If it does, then keep part of the gud-marker-acc until we get more. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1066 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'" |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1067 gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1068 (progn |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1069 ;; Everything before the potential marker start can be output. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1070 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1071 (gdb-concat-output output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1072 (substring gud-marker-acc 0 |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1073 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1074 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1075 ;; Everything after, we save, to combine with later input. |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1076 (setq gud-marker-acc (substring gud-marker-acc |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1077 (match-beginning 0)))) |
54538 | 1078 ;; |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1079 ;; In case we know the gud-marker-acc contains no partial annotations: |
54538 | 1080 (progn |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1081 (setq output (gdb-concat-output output gud-marker-acc)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1082 (setq gud-marker-acc ""))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1083 output))) |
54538 | 1084 |
1085 (defun gdb-concat-output (so-far new) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1086 (let ((sink gdb-output-sink)) |
54538 | 1087 (cond |
1088 ((eq sink 'user) (concat so-far new)) | |
1089 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
1090 ((eq sink 'emacs) | |
1091 (gdb-append-to-partial-output new) | |
1092 so-far) | |
1093 ((eq sink 'inferior) | |
1094 (gdb-append-to-inferior-io new) | |
1095 so-far) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1096 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1097 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1098 (error "Bogon output sink %S" sink))))) |
54538 | 1099 |
1100 (defun gdb-append-to-partial-output (string) | |
1101 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) | |
1102 (goto-char (point-max)) | |
1103 (insert string))) | |
1104 | |
1105 (defun gdb-clear-partial-output () | |
1106 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) | |
1107 (erase-buffer))) | |
1108 | |
1109 (defun gdb-append-to-inferior-io (string) | |
1110 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io) | |
1111 (goto-char (point-max)) | |
1112 (insert-before-markers string)) | |
1113 (if (not (string-equal string "")) | |
1114 (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io)))) | |
1115 | |
1116 (defun gdb-clear-inferior-io () | |
1117 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io) | |
1118 (erase-buffer))) | |
1119 | |
1120 | |
1121 ;; One trick is to have a command who's output is always available in a buffer | |
1122 ;; of it's own, and is always up to date. We build several buffers of this | |
1123 ;; type. | |
1124 ;; | |
1125 ;; There are two aspects to this: gdb has to tell us when the output for that | |
1126 ;; command might have changed, and we have to be able to run the command | |
1127 ;; behind the user's back. | |
1128 ;; | |
1129 ;; The output phasing associated with the variable gdb-output-sink | |
1130 ;; help us to run commands behind the user's back. | |
1131 ;; | |
1132 ;; Below is the code for specificly managing buffers of output from one | |
1133 ;; command. | |
1134 ;; | |
1135 | |
1136 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | |
1137 ;; It adds an input for the command we are tracking. It should be the | |
1138 ;; annotation rule binding of whatever gdb sends to tell us this command | |
1139 ;; might have changed it's output. | |
1140 ;; | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1141 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
54538 | 1142 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
1143 ;; input in the input queue (see comment about ``gdb communications'' above). | |
1144 | |
1145 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command | |
1146 output-handler) | |
1147 `(defun ,name (&optional ignored) | |
1148 (if (and (,demand-predicate) | |
1149 (not (member ',name | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1150 gdb-pending-triggers))) |
54538 | 1151 (progn |
1152 (gdb-enqueue-input | |
1153 (list ,gdb-command ',output-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1154 (push ',name gdb-pending-triggers))))) |
54538 | 1155 |
1156 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) | |
1157 `(defun ,name () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1158 (setq gdb-pending-triggers |
54538 | 1159 (delq ',trigger |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1160 gdb-pending-triggers)) |
54538 | 1161 (let ((buf (gdb-get-buffer ',buf-key))) |
1162 (and buf | |
1163 (with-current-buffer buf | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1164 (let ((p (window-point (get-buffer-window buf 0))) |
54538 | 1165 (buffer-read-only nil)) |
1166 (erase-buffer) | |
1167 (insert-buffer-substring (gdb-get-create-buffer | |
1168 'gdb-partial-output-buffer)) | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1169 (set-window-point (get-buffer-window buf 0) p))))) |
54538 | 1170 ;; put customisation here |
1171 (,custom-defun))) | |
1172 | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1173 (defmacro def-gdb-auto-updated-buffer (buffer-key |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1174 trigger-name gdb-command |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1175 output-handler-name custom-defun) |
54538 | 1176 `(progn |
1177 (def-gdb-auto-update-trigger ,trigger-name | |
1178 ;; The demand predicate: | |
1179 (lambda () (gdb-get-buffer ',buffer-key)) | |
1180 ,gdb-command | |
1181 ,output-handler-name) | |
1182 (def-gdb-auto-update-handler ,output-handler-name | |
1183 ,trigger-name ,buffer-key ,custom-defun))) | |
1184 | |
1185 | |
1186 ;; | |
1187 ;; Breakpoint buffer : This displays the output of `info breakpoints'. | |
1188 ;; | |
1189 (gdb-set-buffer-rules 'gdb-breakpoints-buffer | |
1190 'gdb-breakpoints-buffer-name | |
1191 'gdb-breakpoints-mode) | |
1192 | |
1193 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
1194 ;; This defines the auto update rule for buffers of type | |
1195 ;; `gdb-breakpoints-buffer'. | |
1196 ;; | |
1197 ;; It defines a function to serve as the annotation handler that | |
1198 ;; handles the `foo-invalidated' message. That function is called: | |
1199 gdb-invalidate-breakpoints | |
1200 ;; | |
1201 ;; To update the buffer, this command is sent to gdb. | |
1202 "server info breakpoints\n" | |
1203 ;; | |
1204 ;; This also defines a function to be the handler for the output | |
1205 ;; from the command above. That function will copy the output into | |
1206 ;; the appropriately typed buffer. That function will be called: | |
1207 gdb-info-breakpoints-handler | |
1208 ;; buffer specific functions | |
1209 gdb-info-breakpoints-custom) | |
1210 | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1211 (defconst breakpoint-xpm-data |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1212 "/* XPM */ |
54538 | 1213 static char *magick[] = { |
1214 /* columns rows colors chars-per-pixel */ | |
1215 \"10 10 2 1\", | |
1216 \" c red\", | |
1217 \"+ c None\", | |
1218 /* pixels */ | |
1219 \"+++ +++\", | |
1220 \"++ ++\", | |
1221 \"+ +\", | |
1222 \" \", | |
1223 \" \", | |
1224 \" \", | |
1225 \" \", | |
1226 \"+ +\", | |
1227 \"++ ++\", | |
1228 \"+++ +++\", | |
1229 };" | |
1230 "XPM data used for breakpoint icon.") | |
1231 | |
1232 (defconst breakpoint-enabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1233 "P1 |
54538 | 1234 10 10\", |
1235 0 0 0 0 1 1 1 1 0 0 0 0 | |
1236 0 0 0 1 1 1 1 1 1 0 0 0 | |
1237 0 0 1 1 1 1 1 1 1 1 0 0 | |
1238 0 1 1 1 1 1 1 1 1 1 1 0 | |
1239 0 1 1 1 1 1 1 1 1 1 1 0 | |
1240 0 1 1 1 1 1 1 1 1 1 1 0 | |
1241 0 1 1 1 1 1 1 1 1 1 1 0 | |
1242 0 0 1 1 1 1 1 1 1 1 0 0 | |
1243 0 0 0 1 1 1 1 1 1 0 0 0 | |
1244 0 0 0 0 1 1 1 1 0 0 0 0" | |
1245 "PBM data used for enabled breakpoint icon.") | |
1246 | |
1247 (defconst breakpoint-disabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1248 "P1 |
54538 | 1249 10 10\", |
1250 0 0 1 0 1 0 1 0 0 0 | |
1251 0 1 0 1 0 1 0 1 0 0 | |
1252 1 0 1 0 1 0 1 0 1 0 | |
1253 0 1 0 1 0 1 0 1 0 1 | |
1254 1 0 1 0 1 0 1 0 1 0 | |
1255 0 1 0 1 0 1 0 1 0 1 | |
1256 1 0 1 0 1 0 1 0 1 0 | |
1257 0 1 0 1 0 1 0 1 0 1 | |
1258 0 0 1 0 1 0 1 0 1 0 | |
1259 0 0 0 1 0 1 0 1 0 0" | |
1260 "PBM data used for disabled breakpoint icon.") | |
1261 | |
1262 (defvar breakpoint-enabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1263 "Icon for enabled breakpoint in display margin.") |
54538 | 1264 |
1265 (defvar breakpoint-disabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1266 "Icon for disabled breakpoint in display margin.") |
54538 | 1267 |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
1268 ;; Bitmap for breakpoint in fringe |
57982
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1269 (and (display-images-p) |
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1270 (define-fringe-bitmap 'breakpoint |
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1271 "\x3c\x7e\xff\xff\xff\xff\x7e\x3c")) |
54538 | 1272 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1273 (defface breakpoint-enabled |
60869
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1274 '((t |
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1275 :foreground "red" |
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1276 :weight bold)) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1277 "Face for enabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1278 :group 'gud) |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1279 ;; compatibility alias for old name |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1280 (put 'breakpoint-enabled-bitmap-face 'face-alias 'breakpoint-enabled) |
54538 | 1281 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1282 (defface breakpoint-disabled |
60810
6eef5fcb0572
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-199
Miles Bader <miles@gnu.org>
parents:
60760
diff
changeset
|
1283 ;; We use different values of grey for different background types, |
6eef5fcb0572
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-199
Miles Bader <miles@gnu.org>
parents:
60760
diff
changeset
|
1284 ;; so that on low-color displays it will end up as something visible |
60839
7a4f7626e4dc
(breakpoint-enabled, breakpoint-disabled):
Kim F. Storm <storm@cua.dk>
parents:
60810
diff
changeset
|
1285 ;; if it has to be approximated. |
60869
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1286 '((((background dark)) :foreground "grey60") |
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1287 (((background light)) :foreground "grey40")) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1288 "Face for disabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1289 :group 'gud) |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1290 ;; compatibility alias for old name |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1291 (put 'breakpoint-disabled-bitmap-face 'face-alias 'breakpoint-disabled) |
54538 | 1292 |
1293 ;;-put breakpoint icons in relevant margins (even those set in the GUD buffer) | |
1294 (defun gdb-info-breakpoints-custom () | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1295 (let ((flag) (bptno)) |
54538 | 1296 ;; remove all breakpoint-icons in source buffers but not assembler buffer |
1297 (dolist (buffer (buffer-list)) | |
1298 (with-current-buffer buffer | |
1299 (if (and (eq gud-minor-mode 'gdba) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1300 (not (string-match "\\`\\*.+\\*\\'" (buffer-name)))) |
54538 | 1301 (gdb-remove-breakpoint-icons (point-min) (point-max))))) |
1302 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) | |
1303 (save-excursion | |
1304 (goto-char (point-min)) | |
1305 (while (< (point) (- (point-max) 1)) | |
1306 (forward-line 1) | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1307 (if (looking-at "[^\t].*?breakpoint") |
54538 | 1308 (progn |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1309 (looking-at "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1310 (setq bptno (match-string 1)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1311 (setq flag (char-after (match-beginning 2))) |
54538 | 1312 (beginning-of-line) |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1313 (if (re-search-forward " in .* at\\s-+" nil t) |
54538 | 1314 (progn |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1315 (looking-at "\\(\\S-+\\):\\([0-9]+\\)") |
54538 | 1316 (let ((line (match-string 2)) (buffer-read-only nil) |
1317 (file (match-string 1))) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
1318 (add-text-properties (line-beginning-position) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
1319 (line-end-position) |
54538 | 1320 '(mouse-face highlight |
1321 help-echo "mouse-2, RET: visit breakpoint")) | |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1322 (unless (file-exists-p file) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1323 (setq file (cdr (assoc bptno gdb-location-alist)))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1324 (if (and file |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1325 (not (string-equal file "File not found"))) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1326 (with-current-buffer (find-file-noselect file) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1327 (set (make-local-variable 'gud-minor-mode) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1328 'gdba) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1329 (set (make-local-variable 'tool-bar-map) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1330 gud-tool-bar-map) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1331 ;; only want one breakpoint icon at each |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1332 ;; location |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1333 (save-excursion |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1334 (goto-line (string-to-number line)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1335 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1336 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1337 (list |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1338 (concat "list " |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1339 (match-string-no-properties 1) ":1\n") |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1340 'ignore)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1341 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1342 (list "info source\n" |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1343 `(lambda () (gdb-get-location |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1344 ,bptno ,line ,flag)))))))))) |
54962
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1345 (end-of-line))))) |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1346 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) |
54538 | 1347 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1348 (defun gdb-mouse-set-clear-breakpoint (event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1349 "Set/clear breakpoint in left fringe/margin with mouse click." |
54538 | 1350 (interactive "e") |
1351 (mouse-minibuffer-check event) | |
1352 (let ((posn (event-end event))) | |
1353 (if (numberp (posn-point posn)) | |
1354 (with-selected-window (posn-window posn) | |
1355 (save-excursion | |
1356 (goto-char (posn-point posn)) | |
1357 (if (or (posn-object posn) | |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
1358 (eq (car (fringe-bitmaps-at-pos (posn-point posn))) |
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
1359 'breakpoint)) |
54538 | 1360 (gud-remove nil) |
1361 (gud-break nil))))))) | |
1362 | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1363 (defun gdb-mouse-toggle-breakpoint (event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1364 "Enable/disable breakpoint in left fringe/margin with mouse click." |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1365 (interactive "e") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1366 (mouse-minibuffer-check event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1367 (let ((posn (event-end event))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1368 (if (numberp (posn-point posn)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1369 (with-selected-window (posn-window posn) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1370 (save-excursion |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1371 (goto-char (posn-point posn)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1372 (if |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1373 ; (or |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1374 (posn-object posn) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1375 ; (eq (car (fringe-bitmaps-at-pos (posn-point posn))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1376 ; 'breakpoint)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1377 (gdb-enqueue-input |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1378 (list |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1379 (let ((bptno (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1380 0 'gdb-bptno (car (posn-string posn))))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1381 (concat |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1382 (if (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1383 0 'gdb-enabled (car (posn-string posn))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1384 "disable " |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1385 "enable ") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1386 bptno "\n")) 'ignore)))))))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1387 |
54538 | 1388 (defun gdb-breakpoints-buffer-name () |
1389 (with-current-buffer gud-comint-buffer | |
1390 (concat "*breakpoints of " (gdb-get-target-string) "*"))) | |
1391 | |
1392 (defun gdb-display-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1393 "Display status of user-settable breakpoints." |
54538 | 1394 (interactive) |
1395 (gdb-display-buffer | |
1396 (gdb-get-create-buffer 'gdb-breakpoints-buffer))) | |
1397 | |
54993
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
1398 (defconst gdb-frame-parameters |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1399 '((height . 14) (width . 80) |
54993
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
1400 (unsplittable . t) |
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
1401 (tool-bar-lines . nil) |
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
1402 (menu-bar-lines . nil) |
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
1403 (minibuffer . nil))) |
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
1404 |
54538 | 1405 (defun gdb-frame-breakpoints-buffer () |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1406 "Display status of user-settable breakpoints in a new frame." |
54538 | 1407 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1408 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1409 (special-display-frame-alist gdb-frame-parameters)) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1410 (display-buffer (gdb-get-create-buffer 'gdb-breakpoints-buffer)))) |
54538 | 1411 |
1412 (defvar gdb-breakpoints-mode-map | |
1413 (let ((map (make-sparse-keymap)) | |
1414 (menu (make-sparse-keymap "Breakpoints"))) | |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1415 (define-key menu [quit] '("Quit" . kill-this-buffer)) |
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1416 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
54538 | 1417 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1418 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
54538 | 1419 (suppress-keymap map) |
1420 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) | |
1421 (define-key map " " 'gdb-toggle-breakpoint) | |
1422 (define-key map "d" 'gdb-delete-breakpoint) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
1423 (define-key map "q" 'kill-this-buffer) |
54538 | 1424 (define-key map "\r" 'gdb-goto-breakpoint) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1425 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1426 (define-key map [follow-link] 'mouse-face) |
54538 | 1427 map)) |
1428 | |
1429 (defun gdb-breakpoints-mode () | |
1430 "Major mode for gdb breakpoints. | |
1431 | |
1432 \\{gdb-breakpoints-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1433 (kill-all-local-variables) |
54538 | 1434 (setq major-mode 'gdb-breakpoints-mode) |
1435 (setq mode-name "Breakpoints") | |
1436 (use-local-map gdb-breakpoints-mode-map) | |
1437 (setq buffer-read-only t) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1438 (run-mode-hooks 'gdb-breakpoints-mode-hook) |
55762
e31413b06034
(gdb-breakpoints-mode, gdb-frames-mode)
Nick Roberts <nickrob@snap.net.nz>
parents:
55749
diff
changeset
|
1439 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1440 'gdb-invalidate-breakpoints |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1441 'gdbmi-invalidate-breakpoints)) |
54538 | 1442 |
1443 (defun gdb-toggle-breakpoint () | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1444 "Enable/disable breakpoint at current line." |
54538 | 1445 (interactive) |
1446 (save-excursion | |
1447 (beginning-of-line 1) | |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1448 (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
1449 (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)\\s-+") |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1450 (looking-at |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
1451 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)\\s-+\\S-+\\s-+\\S-+:[0-9]+")) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1452 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1453 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1454 (concat gdb-server-prefix |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1455 (if (eq ?y (char-after (match-beginning 2))) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1456 "disable " |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1457 "enable ") |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1458 (match-string 1) "\n") 'ignore)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1459 (error "Not recognized as break/watchpoint line")))) |
54538 | 1460 |
1461 (defun gdb-delete-breakpoint () | |
1462 "Delete the breakpoint at current line." | |
1463 (interactive) | |
1464 (beginning-of-line 1) | |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1465 (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1466 (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)") |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1467 (looking-at |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1468 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\s-+\\S-+\\s-+\\S-+:[0-9]+")) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1469 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1470 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1471 (concat gdb-server-prefix "delete " (match-string 1) "\n") 'ignore)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1472 (error "Not recognized as break/watchpoint line"))) |
54538 | 1473 |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1474 (defun gdb-goto-breakpoint (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1475 "Display the breakpoint location specified at current line." |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1476 (interactive (list last-input-event)) |
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1477 (if event (mouse-set-point event)) |
54538 | 1478 (save-excursion |
1479 (beginning-of-line 1) | |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1480 (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1481 (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1482 (looking-at |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1483 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+.\\s-+\\S-+\\s-+\ |
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1484 \\(\\S-+\\):\\([0-9]+\\)")) |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1485 (let ((bptno (match-string 1)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1486 (file (match-string 2)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1487 (line (match-string 3))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1488 (save-selected-window |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1489 (let* ((buf (find-file-noselect |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1490 (if (file-exists-p file) file |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1491 (cdr (assoc bptno gdb-location-alist))))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
1492 (window (display-buffer buf))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1493 (with-current-buffer buf |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1494 (goto-line (string-to-number line)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1495 (set-window-point window (point)))))) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1496 (error "Not recognized as break/watchpoint line")))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1497 |
54538 | 1498 |
1499 ;; Frames buffer. This displays a perpetually correct bactracktrace | |
1500 ;; (from the command `where'). | |
1501 ;; | |
1502 ;; Alas, if your stack is deep, it is costly. | |
1503 ;; | |
1504 (gdb-set-buffer-rules 'gdb-stack-buffer | |
1505 'gdb-stack-buffer-name | |
1506 'gdb-frames-mode) | |
1507 | |
1508 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
1509 gdb-invalidate-frames | |
1510 "server where\n" | |
1511 gdb-info-frames-handler | |
1512 gdb-info-frames-custom) | |
1513 | |
1514 (defun gdb-info-frames-custom () | |
1515 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) | |
1516 (save-excursion | |
1517 (let ((buffer-read-only nil)) | |
1518 (goto-char (point-min)) | |
1519 (while (< (point) (point-max)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
1520 (add-text-properties (line-beginning-position) (line-end-position) |
54538 | 1521 '(mouse-face highlight |
1522 help-echo "mouse-2, RET: Select frame")) | |
1523 (beginning-of-line) | |
58049
fd0093bd412a
(gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
57982
diff
changeset
|
1524 (when (and (looking-at "^#\\([0-9]+\\)") |
62716 | 1525 (equal (match-string 1) gdb-frame-number)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
1526 (put-text-property (line-beginning-position) (line-end-position) |
54538 | 1527 'face '(:inverse-video t))) |
1528 (forward-line 1)))))) | |
1529 | |
1530 (defun gdb-stack-buffer-name () | |
1531 (with-current-buffer gud-comint-buffer | |
1532 (concat "*stack frames of " (gdb-get-target-string) "*"))) | |
1533 | |
1534 (defun gdb-display-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1535 "Display backtrace of current stack." |
54538 | 1536 (interactive) |
1537 (gdb-display-buffer | |
1538 (gdb-get-create-buffer 'gdb-stack-buffer))) | |
1539 | |
1540 (defun gdb-frame-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1541 "Display backtrace of current stack in a new frame." |
54538 | 1542 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1543 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1544 (special-display-frame-alist gdb-frame-parameters)) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1545 (display-buffer (gdb-get-create-buffer 'gdb-stack-buffer)))) |
54538 | 1546 |
1547 (defvar gdb-frames-mode-map | |
1548 (let ((map (make-sparse-keymap))) | |
1549 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
1550 (define-key map "q" 'kill-this-buffer) |
54538 | 1551 (define-key map "\r" 'gdb-frames-select) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1552 (define-key map [mouse-2] 'gdb-frames-select) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1553 (define-key map [follow-link] 'mouse-face) |
54538 | 1554 map)) |
1555 | |
1556 (defun gdb-frames-mode () | |
1557 "Major mode for gdb frames. | |
1558 | |
1559 \\{gdb-frames-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1560 (kill-all-local-variables) |
54538 | 1561 (setq major-mode 'gdb-frames-mode) |
1562 (setq mode-name "Frames") | |
1563 (setq buffer-read-only t) | |
1564 (use-local-map gdb-frames-mode-map) | |
1565 (font-lock-mode -1) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1566 (run-mode-hooks 'gdb-frames-mode-hook) |
55762
e31413b06034
(gdb-breakpoints-mode, gdb-frames-mode)
Nick Roberts <nickrob@snap.net.nz>
parents:
55749
diff
changeset
|
1567 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1568 'gdb-invalidate-frames |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1569 'gdbmi-invalidate-frames)) |
54538 | 1570 |
1571 (defun gdb-get-frame-number () | |
1572 (save-excursion | |
55850
63ca25eb73a1
(gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents:
55764
diff
changeset
|
1573 (let* ((pos (re-search-backward "^#*\\([0-9]*\\)" nil t)) |
54538 | 1574 (n (or (and pos (match-string-no-properties 1)) "0"))) |
1575 n))) | |
1576 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1577 (defun gdb-frames-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1578 "Select the frame and display the relevant source." |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1579 (interactive (list last-input-event)) |
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1580 (if event (mouse-set-point event)) |
54538 | 1581 (gdb-enqueue-input |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1582 (list (concat gdb-server-prefix "frame " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1583 (gdb-get-frame-number) "\n") 'ignore)) |
54538 | 1584 (gud-display-frame)) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1585 |
54538 | 1586 |
1587 ;; Threads buffer. This displays a selectable thread list. | |
1588 ;; | |
1589 (gdb-set-buffer-rules 'gdb-threads-buffer | |
1590 'gdb-threads-buffer-name | |
1591 'gdb-threads-mode) | |
1592 | |
1593 (def-gdb-auto-updated-buffer gdb-threads-buffer | |
1594 gdb-invalidate-threads | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1595 (concat gdb-server-prefix "info threads\n") |
54538 | 1596 gdb-info-threads-handler |
1597 gdb-info-threads-custom) | |
1598 | |
1599 (defun gdb-info-threads-custom () | |
1600 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | |
1601 (let ((buffer-read-only nil)) | |
1602 (goto-char (point-min)) | |
1603 (while (< (point) (point-max)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
1604 (add-text-properties (line-beginning-position) (line-end-position) |
54538 | 1605 '(mouse-face highlight |
1606 help-echo "mouse-2, RET: select thread")) | |
1607 (forward-line 1))))) | |
1608 | |
1609 (defun gdb-threads-buffer-name () | |
1610 (with-current-buffer gud-comint-buffer | |
1611 (concat "*threads of " (gdb-get-target-string) "*"))) | |
1612 | |
1613 (defun gdb-display-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1614 "Display IDs of currently known threads." |
54538 | 1615 (interactive) |
1616 (gdb-display-buffer | |
1617 (gdb-get-create-buffer 'gdb-threads-buffer))) | |
1618 | |
1619 (defun gdb-frame-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1620 "Display IDs of currently known threads in a new frame." |
54538 | 1621 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1622 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1623 (special-display-frame-alist gdb-frame-parameters)) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1624 (display-buffer (gdb-get-create-buffer 'gdb-threads-buffer)))) |
54538 | 1625 |
1626 (defvar gdb-threads-mode-map | |
1627 (let ((map (make-sparse-keymap))) | |
1628 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
1629 (define-key map "q" 'kill-this-buffer) |
54538 | 1630 (define-key map "\r" 'gdb-threads-select) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1631 (define-key map [mouse-2] 'gdb-threads-select) |
54538 | 1632 map)) |
1633 | |
1634 (defun gdb-threads-mode () | |
1635 "Major mode for gdb frames. | |
1636 | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1637 \\{gdb-threads-mode-map}" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1638 (kill-all-local-variables) |
54538 | 1639 (setq major-mode 'gdb-threads-mode) |
1640 (setq mode-name "Threads") | |
1641 (setq buffer-read-only t) | |
1642 (use-local-map gdb-threads-mode-map) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1643 (run-mode-hooks 'gdb-threads-mode-hook) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1644 'gdb-invalidate-threads) |
54538 | 1645 |
1646 (defun gdb-get-thread-number () | |
1647 (save-excursion | |
1648 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) | |
1649 (match-string-no-properties 1))) | |
1650 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1651 (defun gdb-threads-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1652 "Select the thread and display the relevant source." |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1653 (interactive (list last-input-event)) |
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1654 (if event (mouse-set-point event)) |
54538 | 1655 (gdb-enqueue-input |
1656 (list (concat "thread " (gdb-get-thread-number) "\n") 'ignore)) | |
1657 (gud-display-frame)) | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1658 |
54538 | 1659 |
1660 ;; Registers buffer. | |
1661 ;; | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1662 (defcustom gdb-all-registers nil |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1663 "Non-nil means include floating-point registers." |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1664 :type 'boolean |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1665 :group 'gud |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1666 :version "22.1") |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1667 |
54538 | 1668 (gdb-set-buffer-rules 'gdb-registers-buffer |
1669 'gdb-registers-buffer-name | |
1670 'gdb-registers-mode) | |
1671 | |
1672 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
1673 gdb-invalidate-registers | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1674 (concat |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1675 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n") |
54538 | 1676 gdb-info-registers-handler |
1677 gdb-info-registers-custom) | |
1678 | |
1679 (defun gdb-info-registers-custom ()) | |
1680 | |
1681 (defvar gdb-registers-mode-map | |
1682 (let ((map (make-sparse-keymap))) | |
1683 (suppress-keymap map) | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1684 (define-key map " " 'toggle-gdb-all-registers) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
1685 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
1686 map)) |
54538 | 1687 |
1688 (defun gdb-registers-mode () | |
1689 "Major mode for gdb registers. | |
1690 | |
1691 \\{gdb-registers-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1692 (kill-all-local-variables) |
54538 | 1693 (setq major-mode 'gdb-registers-mode) |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1694 (setq mode-name "Registers:") |
54538 | 1695 (setq buffer-read-only t) |
1696 (use-local-map gdb-registers-mode-map) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1697 (run-mode-hooks 'gdb-registers-mode-hook) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1698 'gdb-invalidate-registers) |
54538 | 1699 |
1700 (defun gdb-registers-buffer-name () | |
1701 (with-current-buffer gud-comint-buffer | |
1702 (concat "*registers of " (gdb-get-target-string) "*"))) | |
1703 | |
1704 (defun gdb-display-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1705 "Display integer register contents." |
54538 | 1706 (interactive) |
1707 (gdb-display-buffer | |
1708 (gdb-get-create-buffer 'gdb-registers-buffer))) | |
1709 | |
1710 (defun gdb-frame-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1711 "Display integer register contents in a new frame." |
54538 | 1712 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1713 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1714 (special-display-frame-alist gdb-frame-parameters)) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1715 (display-buffer (gdb-get-create-buffer 'gdb-registers-buffer)))) |
59808 | 1716 |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1717 (defun toggle-gdb-all-registers () |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1718 "Toggle the display of floating-point registers." |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1719 (interactive) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1720 (if gdb-all-registers |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1721 (progn |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1722 (setq gdb-all-registers nil) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1723 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1724 (setq mode-name "Registers:"))) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1725 (setq gdb-all-registers t) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1726 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1727 (setq mode-name "Registers:All"))) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1728 (gdb-invalidate-registers)) |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1729 |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
1730 |
59808 | 1731 ;; Memory buffer. |
1732 ;; | |
1733 (defcustom gdb-memory-repeat-count 32 | |
1734 "Number of data items in memory window." | |
1735 :type 'integer | |
1736 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1737 :version "22.1") |
59808 | 1738 |
1739 (defcustom gdb-memory-format "x" | |
1740 "Display format of data items in memory window." | |
1741 :type '(choice (const :tag "Hexadecimal" "x") | |
1742 (const :tag "Signed decimal" "d") | |
1743 (const :tag "Unsigned decimal" "u") | |
1744 (const :tag "Octal" "o") | |
1745 (const :tag "Binary" "t")) | |
1746 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1747 :version "22.1") |
59808 | 1748 |
1749 (defcustom gdb-memory-unit "w" | |
1750 "Unit size of data items in memory window." | |
1751 :type '(choice (const :tag "Byte" "b") | |
1752 (const :tag "Halfword" "h") | |
1753 (const :tag "Word" "w") | |
1754 (const :tag "Giant word" "g")) | |
1755 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1756 :version "22.1") |
59808 | 1757 |
1758 (gdb-set-buffer-rules 'gdb-memory-buffer | |
1759 'gdb-memory-buffer-name | |
1760 'gdb-memory-mode) | |
1761 | |
1762 (def-gdb-auto-updated-buffer gdb-memory-buffer | |
1763 gdb-invalidate-memory | |
1764 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count) | |
1765 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n") | |
1766 gdb-read-memory-handler | |
1767 gdb-read-memory-custom) | |
1768 | |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1769 (defun gdb-read-memory-custom () |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1770 (save-excursion |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1771 (goto-char (point-min)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1772 (if (looking-at "0x[[:xdigit:]]+") |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1773 (setq gdb-memory-address (match-string 0))))) |
59808 | 1774 |
1775 (defvar gdb-memory-mode-map | |
1776 (let ((map (make-sparse-keymap))) | |
1777 (suppress-keymap map) | |
1778 (define-key map "q" 'kill-this-buffer) | |
1779 map)) | |
1780 | |
1781 (defun gdb-memory-set-address (event) | |
1782 "Set the start memory address." | |
1783 (interactive "e") | |
1784 (save-selected-window | |
1785 (select-window (posn-window (event-start event))) | |
1786 (let ((arg (read-from-minibuffer "Memory address: "))) | |
1787 (setq gdb-memory-address arg)) | |
1788 (gdb-invalidate-memory))) | |
1789 | |
1790 (defun gdb-memory-set-repeat-count (event) | |
1791 "Set the number of data items in memory window." | |
1792 (interactive "e") | |
1793 (save-selected-window | |
1794 (select-window (posn-window (event-start event))) | |
1795 (let* ((arg (read-from-minibuffer "Repeat count: ")) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
1796 (count (string-to-number arg))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1797 (if (<= count 0) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1798 (error "Positive numbers only") |
59808 | 1799 (customize-set-variable 'gdb-memory-repeat-count count) |
1800 (gdb-invalidate-memory))))) | |
1801 | |
1802 (defun gdb-memory-format-binary () | |
1803 "Set the display format to binary." | |
1804 (interactive) | |
1805 (customize-set-variable 'gdb-memory-format "t") | |
1806 (gdb-invalidate-memory)) | |
1807 | |
1808 (defun gdb-memory-format-octal () | |
1809 "Set the display format to octal." | |
1810 (interactive) | |
1811 (customize-set-variable 'gdb-memory-format "o") | |
1812 (gdb-invalidate-memory)) | |
1813 | |
1814 (defun gdb-memory-format-unsigned () | |
1815 "Set the display format to unsigned decimal." | |
1816 (interactive) | |
1817 (customize-set-variable 'gdb-memory-format "u") | |
1818 (gdb-invalidate-memory)) | |
1819 | |
1820 (defun gdb-memory-format-signed () | |
1821 "Set the display format to decimal." | |
1822 (interactive) | |
1823 (customize-set-variable 'gdb-memory-format "d") | |
1824 (gdb-invalidate-memory)) | |
1825 | |
1826 (defun gdb-memory-format-hexadecimal () | |
1827 "Set the display format to hexadecimal." | |
1828 (interactive) | |
1829 (customize-set-variable 'gdb-memory-format "x") | |
1830 (gdb-invalidate-memory)) | |
1831 | |
1832 (defvar gdb-memory-format-keymap | |
1833 (let ((map (make-sparse-keymap))) | |
1834 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) | |
1835 map) | |
1836 "Keymap to select format in the header line.") | |
1837 | |
1838 (defvar gdb-memory-format-menu (make-sparse-keymap "Format") | |
1839 "Menu of display formats in the header line.") | |
1840 | |
1841 (define-key gdb-memory-format-menu [binary] | |
1842 '(menu-item "Binary" gdb-memory-format-binary | |
1843 :button (:radio . (equal gdb-memory-format "t")))) | |
1844 (define-key gdb-memory-format-menu [octal] | |
1845 '(menu-item "Octal" gdb-memory-format-octal | |
1846 :button (:radio . (equal gdb-memory-format "o")))) | |
1847 (define-key gdb-memory-format-menu [unsigned] | |
1848 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned | |
1849 :button (:radio . (equal gdb-memory-format "u")))) | |
1850 (define-key gdb-memory-format-menu [signed] | |
1851 '(menu-item "Signed Decimal" gdb-memory-format-signed | |
1852 :button (:radio . (equal gdb-memory-format "d")))) | |
1853 (define-key gdb-memory-format-menu [hexadecimal] | |
1854 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal | |
1855 :button (:radio . (equal gdb-memory-format "x")))) | |
1856 | |
1857 (defun gdb-memory-format-menu (event) | |
1858 (interactive "@e") | |
1859 (x-popup-menu event gdb-memory-format-menu)) | |
1860 | |
1861 (defun gdb-memory-format-menu-1 (event) | |
1862 (interactive "e") | |
1863 (save-selected-window | |
1864 (select-window (posn-window (event-start event))) | |
1865 (let* ((selection (gdb-memory-format-menu event)) | |
1866 (binding (and selection (lookup-key gdb-memory-format-menu | |
1867 (vector (car selection)))))) | |
1868 (if binding (call-interactively binding))))) | |
1869 | |
1870 (defun gdb-memory-unit-giant () | |
1871 "Set the unit size to giant words (eight bytes)." | |
1872 (interactive) | |
1873 (customize-set-variable 'gdb-memory-unit "g") | |
1874 (gdb-invalidate-memory)) | |
1875 | |
1876 (defun gdb-memory-unit-word () | |
1877 "Set the unit size to words (four bytes)." | |
1878 (interactive) | |
1879 (customize-set-variable 'gdb-memory-unit "w") | |
1880 (gdb-invalidate-memory)) | |
1881 | |
1882 (defun gdb-memory-unit-halfword () | |
1883 "Set the unit size to halfwords (two bytes)." | |
1884 (interactive) | |
1885 (customize-set-variable 'gdb-memory-unit "h") | |
1886 (gdb-invalidate-memory)) | |
1887 | |
1888 (defun gdb-memory-unit-byte () | |
1889 "Set the unit size to bytes." | |
1890 (interactive) | |
1891 (customize-set-variable 'gdb-memory-unit "b") | |
1892 (gdb-invalidate-memory)) | |
1893 | |
1894 (defvar gdb-memory-unit-keymap | |
1895 (let ((map (make-sparse-keymap))) | |
1896 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) | |
1897 map) | |
1898 "Keymap to select units in the header line.") | |
1899 | |
1900 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit") | |
1901 "Menu of units in the header line.") | |
1902 | |
1903 (define-key gdb-memory-unit-menu [giantwords] | |
1904 '(menu-item "Giant words" gdb-memory-unit-giant | |
1905 :button (:radio . (equal gdb-memory-unit "g")))) | |
1906 (define-key gdb-memory-unit-menu [words] | |
1907 '(menu-item "Words" gdb-memory-unit-word | |
1908 :button (:radio . (equal gdb-memory-unit "w")))) | |
1909 (define-key gdb-memory-unit-menu [halfwords] | |
1910 '(menu-item "Halfwords" gdb-memory-unit-halfword | |
1911 :button (:radio . (equal gdb-memory-unit "h")))) | |
1912 (define-key gdb-memory-unit-menu [bytes] | |
1913 '(menu-item "Bytes" gdb-memory-unit-byte | |
1914 :button (:radio . (equal gdb-memory-unit "b")))) | |
1915 | |
1916 (defun gdb-memory-unit-menu (event) | |
1917 (interactive "@e") | |
1918 (x-popup-menu event gdb-memory-unit-menu)) | |
1919 | |
1920 (defun gdb-memory-unit-menu-1 (event) | |
1921 (interactive "e") | |
1922 (save-selected-window | |
1923 (select-window (posn-window (event-start event))) | |
1924 (let* ((selection (gdb-memory-unit-menu event)) | |
1925 (binding (and selection (lookup-key gdb-memory-unit-menu | |
1926 (vector (car selection)))))) | |
1927 (if binding (call-interactively binding))))) | |
1928 | |
1929 ;;from make-mode-line-mouse-map | |
1930 (defun gdb-make-header-line-mouse-map (mouse function) "\ | |
1931 Return a keymap with single entry for mouse key MOUSE on the header line. | |
1932 MOUSE is defined to run function FUNCTION with no args in the buffer | |
1933 corresponding to the mode line clicked." | |
1934 (let ((map (make-sparse-keymap))) | |
1935 (define-key map (vector 'header-line mouse) function) | |
1936 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) | |
1937 map)) | |
1938 | |
1939 (defun gdb-memory-mode () | |
1940 "Major mode for examining memory. | |
1941 | |
1942 \\{gdb-memory-mode-map}" | |
1943 (kill-all-local-variables) | |
1944 (setq major-mode 'gdb-memory-mode) | |
1945 (setq mode-name "Memory") | |
1946 (setq buffer-read-only t) | |
1947 (use-local-map gdb-memory-mode-map) | |
1948 (setq header-line-format | |
1949 '(:eval | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1950 (concat |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1951 "Read address[" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1952 (propertize |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1953 "-" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1954 'face font-lock-warning-face |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1955 'help-echo "mouse-1: Decrement address" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1956 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1957 'local-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1958 (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1959 'mouse-1 |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1960 #'(lambda () (interactive) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1961 (let ((gdb-memory-address |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1962 ;; let GDB do the arithmetic |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1963 (concat |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1964 gdb-memory-address " - " |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1965 (number-to-string |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1966 (* gdb-memory-repeat-count |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1967 (cond ((string= gdb-memory-unit "b") 1) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1968 ((string= gdb-memory-unit "h") 2) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1969 ((string= gdb-memory-unit "w") 4) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1970 ((string= gdb-memory-unit "g") 8))))))) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1971 (gdb-invalidate-memory))))) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1972 "|" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1973 (propertize "+" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1974 'face font-lock-warning-face |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1975 'help-echo "mouse-1: Increment address" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1976 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1977 'local-map (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1978 'mouse-1 |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1979 #'(lambda () (interactive) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1980 (let ((gdb-memory-address nil)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1981 (gdb-invalidate-memory))))) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
1982 "]: " |
59808 | 1983 (propertize gdb-memory-address |
1984 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1985 'help-echo "mouse-1: Set memory address" |
62716 | 1986 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1987 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1988 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1989 #'gdb-memory-set-address)) |
59808 | 1990 " Repeat Count: " |
1991 (propertize (number-to-string gdb-memory-repeat-count) | |
1992 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1993 'help-echo "mouse-1: Set repeat count" |
62716 | 1994 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1995 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1996 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1997 #'gdb-memory-set-repeat-count)) |
59808 | 1998 " Display Format: " |
1999 (propertize gdb-memory-format | |
2000 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2001 'help-echo "mouse-3: Select display format" |
62716 | 2002 'mouse-face 'mode-line-highlight |
59808 | 2003 'local-map gdb-memory-format-keymap) |
2004 " Unit Size: " | |
2005 (propertize gdb-memory-unit | |
2006 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2007 'help-echo "mouse-3: Select unit size" |
62716 | 2008 'mouse-face 'mode-line-highlight |
59808 | 2009 'local-map gdb-memory-unit-keymap)))) |
2010 (run-mode-hooks 'gdb-memory-mode-hook) | |
2011 'gdb-invalidate-memory) | |
2012 | |
2013 (defun gdb-memory-buffer-name () | |
2014 (with-current-buffer gud-comint-buffer | |
2015 (concat "*memory of " (gdb-get-target-string) "*"))) | |
2016 | |
2017 (defun gdb-display-memory-buffer () | |
2018 "Display memory contents." | |
2019 (interactive) | |
2020 (gdb-display-buffer | |
2021 (gdb-get-create-buffer 'gdb-memory-buffer))) | |
2022 | |
2023 (defun gdb-frame-memory-buffer () | |
2024 "Display memory contents in a new frame." | |
2025 (interactive) | |
2026 (let ((special-display-regexps (append special-display-regexps '(".*"))) | |
2027 (special-display-frame-alist gdb-frame-parameters)) | |
2028 (display-buffer (gdb-get-create-buffer 'gdb-memory-buffer)))) | |
54538 | 2029 |
59808 | 2030 |
54538 | 2031 ;; Locals buffer. |
2032 ;; | |
2033 (gdb-set-buffer-rules 'gdb-locals-buffer | |
2034 'gdb-locals-buffer-name | |
2035 'gdb-locals-mode) | |
2036 | |
2037 (def-gdb-auto-updated-buffer gdb-locals-buffer | |
2038 gdb-invalidate-locals | |
2039 "server info locals\n" | |
2040 gdb-info-locals-handler | |
2041 gdb-info-locals-custom) | |
2042 | |
2043 ;; Abbreviate for arrays and structures. | |
2044 ;; These can be expanded using gud-display. | |
2045 (defun gdb-info-locals-handler nil | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2046 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2047 gdb-pending-triggers)) |
54538 | 2048 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer))) |
2049 (with-current-buffer buf | |
2050 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2051 (while (re-search-forward "^[ }].*\n" nil t) |
54538 | 2052 (replace-match "" nil nil)) |
2053 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2054 (while (re-search-forward "{\\(.*=.*\n\\|\n\\)" nil t) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2055 (replace-match "(structure);\n" nil nil)) |
54538 | 2056 (goto-char (point-min)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2057 (while (re-search-forward "\\s-*{.*\n" nil t) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2058 (replace-match " (array);\n" nil nil)))) |
54538 | 2059 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
2060 (and buf (with-current-buffer buf | |
63033
bd3ecd5ebdff
(gdb-info-locals-handler): Use window point to preserve point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62936
diff
changeset
|
2061 (let ((p (window-point (get-buffer-window buf 0))) |
54538 | 2062 (buffer-read-only nil)) |
63033
bd3ecd5ebdff
(gdb-info-locals-handler): Use window point to preserve point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62936
diff
changeset
|
2063 (erase-buffer) |
54538 | 2064 (insert-buffer-substring (gdb-get-create-buffer |
2065 'gdb-partial-output-buffer)) | |
63033
bd3ecd5ebdff
(gdb-info-locals-handler): Use window point to preserve point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62936
diff
changeset
|
2066 (set-window-point (get-buffer-window buf 0) p))))) |
54538 | 2067 (run-hooks 'gdb-info-locals-hook)) |
2068 | |
2069 (defun gdb-info-locals-custom () | |
2070 nil) | |
2071 | |
2072 (defvar gdb-locals-mode-map | |
2073 (let ((map (make-sparse-keymap))) | |
2074 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2075 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2076 map)) |
54538 | 2077 |
2078 (defun gdb-locals-mode () | |
2079 "Major mode for gdb locals. | |
2080 | |
2081 \\{gdb-locals-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2082 (kill-all-local-variables) |
54538 | 2083 (setq major-mode 'gdb-locals-mode) |
62716 | 2084 (setq mode-name (concat "Locals:" gdb-selected-frame)) |
54538 | 2085 (setq buffer-read-only t) |
2086 (use-local-map gdb-locals-mode-map) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2087 (run-mode-hooks 'gdb-locals-mode-hook) |
55762
e31413b06034
(gdb-breakpoints-mode, gdb-frames-mode)
Nick Roberts <nickrob@snap.net.nz>
parents:
55749
diff
changeset
|
2088 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2089 'gdb-invalidate-locals |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2090 'gdbmi-invalidate-locals)) |
54538 | 2091 |
2092 (defun gdb-locals-buffer-name () | |
2093 (with-current-buffer gud-comint-buffer | |
2094 (concat "*locals of " (gdb-get-target-string) "*"))) | |
2095 | |
2096 (defun gdb-display-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2097 "Display local variables of current stack and their values." |
54538 | 2098 (interactive) |
2099 (gdb-display-buffer | |
2100 (gdb-get-create-buffer 'gdb-locals-buffer))) | |
2101 | |
2102 (defun gdb-frame-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2103 "Display local variables of current stack and their values in a new frame." |
54538 | 2104 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2105 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2106 (special-display-frame-alist gdb-frame-parameters)) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2107 (display-buffer (gdb-get-create-buffer 'gdb-locals-buffer)))) |
54538 | 2108 |
2109 | |
2110 ;;;; Window management | |
2111 (defun gdb-display-buffer (buf &optional size) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2112 (let ((answer (get-buffer-window buf 0)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2113 (must-split nil)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2114 (if answer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2115 (display-buffer buf nil 0) ;Raise the frame if necessary. |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2116 ;; The buffer is not yet displayed. |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2117 (pop-to-buffer gud-comint-buffer) ;Select the right frame. |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2118 (let ((window (get-lru-window))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2119 (if (and window |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2120 (not (eq window (get-buffer-window gud-comint-buffer)))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2121 (progn |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2122 (set-window-buffer window buf) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2123 (setq answer window)) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2124 (setq must-split t))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2125 (if must-split |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2126 (let* ((largest (get-largest-window)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2127 (cur-size (window-height largest)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2128 (new-size (and size (< size cur-size) (- cur-size size)))) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2129 (setq answer (split-window largest new-size)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2130 (set-window-buffer answer buf) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2131 (set-window-dedicated-p answer t))) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2132 answer))) |
54538 | 2133 |
2134 | |
2135 ;;; Shared keymap initialization: | |
2136 | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2137 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2138 (define-key gud-menu-map [displays] |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2139 `(menu-item "GDB-Windows" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2140 :visible (memq gud-minor-mode '(gdbmi gdba)))) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2141 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2142 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2143 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
62716 | 2144 (define-key menu [disassembly] |
2145 '("Disassembly" . gdb-display-assembler-buffer)) | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2146 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2147 (define-key menu [inferior] |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2148 '(menu-item "Inferior IO" gdb-display-inferior-io-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2149 :enable gdb-use-inferior-io-buffer)) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2150 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2151 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2152 (define-key menu [breakpoints] |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2153 '("Breakpoints" . gdb-display-breakpoints-buffer))) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2154 |
54538 | 2155 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
2156 (define-key gud-menu-map [frames] | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2157 `(menu-item "GDB-Frames" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2158 :visible (memq gud-minor-mode '(gdbmi gdba)))) |
54538 | 2159 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
2160 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
59808 | 2161 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) |
62716 | 2162 (define-key menu [disassembly] '("Disassembiy" . gdb-frame-assembler-buffer)) |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
2163 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2164 (define-key menu [inferior] |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2165 '(menu-item "Inferior IO" gdb-frame-inferior-io-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2166 :enable gdb-use-inferior-io-buffer)) |
54538 | 2167 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) |
2168 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2169 (define-key menu [breakpoints] |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2170 '("Breakpoints" . gdb-frame-breakpoints-buffer))) |
54538 | 2171 |
2172 (let ((menu (make-sparse-keymap "GDB-UI"))) | |
2173 (define-key gud-menu-map [ui] | |
2174 `(menu-item "GDB-UI" ,menu :visible (eq gud-minor-mode 'gdba))) | |
2175 (define-key menu [gdb-restore-windows] | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2176 '(menu-item "Restore Window Layout" gdb-restore-windows |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2177 :help "Restore standard layout for debug session.")) |
54538 | 2178 (define-key menu [gdb-many-windows] |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2179 '(menu-item "Display Other Windows" gdb-many-windows |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2180 :help "Toggle display of locals, stack and breakpoint information" |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2181 :button (:toggle . gdb-many-windows))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2182 (define-key menu [gdb-use-inferior-io] |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2183 (menu-bar-make-toggle toggle-gdb-use-inferior-io-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2184 gdb-use-inferior-io-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2185 "Separate inferior IO" "Use separate IO %s" |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2186 "Toggle separate IO for inferior."))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2187 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2188 (defadvice toggle-gdb-use-inferior-io-buffer (after gdb-kill-io-buffer activate) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2189 (unless gdb-use-inferior-io-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2190 (kill-buffer (gdb-inferior-io-name)))) |
54538 | 2191 |
2192 (defun gdb-frame-gdb-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2193 "Display GUD buffer in a new frame." |
54538 | 2194 (interactive) |
54993
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
2195 (select-frame (make-frame gdb-frame-parameters)) |
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
2196 (switch-to-buffer (gdb-get-create-buffer 'gdba)) |
55217
97d0e3a1174f
(gdb-frame-breakpoints-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
54993
diff
changeset
|
2197 (set-window-dedicated-p (selected-window) t)) |
54538 | 2198 |
2199 (defun gdb-display-gdb-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2200 "Display GUD buffer." |
54538 | 2201 (interactive) |
2202 (gdb-display-buffer | |
2203 (gdb-get-create-buffer 'gdba))) | |
2204 | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2205 (defun gdb-set-window-buffer (name) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2206 (set-window-buffer (selected-window) (get-buffer name)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2207 (set-window-dedicated-p (selected-window) t)) |
58470
7858de1f2bdf
(dedicated-switch-to-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58431
diff
changeset
|
2208 |
54538 | 2209 (defun gdb-setup-windows () |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
2210 "Layout the window pattern for gdb-many-windows." |
54538 | 2211 (gdb-display-locals-buffer) |
2212 (gdb-display-stack-buffer) | |
2213 (delete-other-windows) | |
2214 (gdb-display-breakpoints-buffer) | |
2215 (delete-other-windows) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2216 ; Don't dedicate. |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2217 (pop-to-buffer gud-comint-buffer) |
54538 | 2218 (split-window nil ( / ( * (window-height) 3) 4)) |
2219 (split-window nil ( / (window-height) 3)) | |
2220 (split-window-horizontally) | |
2221 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2222 (gdb-set-window-buffer (gdb-locals-buffer-name)) |
54538 | 2223 (other-window 1) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2224 (switch-to-buffer |
54538 | 2225 (if gud-last-last-frame |
2226 (gud-find-file (car gud-last-last-frame)) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2227 (gud-find-file gdb-main-file))) |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
2228 (when gdb-use-inferior-io-buffer |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
2229 (split-window-horizontally) |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
2230 (other-window 1) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2231 (gdb-set-window-buffer |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2232 (gdb-get-create-buffer 'gdb-inferior-io))) |
54538 | 2233 (other-window 1) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2234 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
54538 | 2235 (split-window-horizontally) |
2236 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2237 (gdb-set-window-buffer (gdb-breakpoints-buffer-name)) |
54538 | 2238 (other-window 1)) |
2239 | |
2240 (defcustom gdb-many-windows nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2241 "Nil means just pop up the GUD buffer unless `gdb-show-main' is t. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2242 In this case it starts with two windows: one displaying the GUD |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2243 buffer and the other with the source file with the main routine |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2244 of the inferior. Non-nil means display the layout shown for |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2245 `gdba'." |
54538 | 2246 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
2247 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2248 :version "22.1") |
54538 | 2249 |
2250 (defun gdb-many-windows (arg) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2251 "Toggle the number of windows in the basic arrangement." |
54538 | 2252 (interactive "P") |
2253 (setq gdb-many-windows | |
2254 (if (null arg) | |
2255 (not gdb-many-windows) | |
2256 (> (prefix-numeric-value arg) 0))) | |
54760
c6ccb7a82f9f
(gdb-source-window): Remove variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
54729
diff
changeset
|
2257 (condition-case nil |
c6ccb7a82f9f
(gdb-source-window): Remove variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
54729
diff
changeset
|
2258 (gdb-restore-windows) |
c6ccb7a82f9f
(gdb-source-window): Remove variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
54729
diff
changeset
|
2259 (error nil))) |
54538 | 2260 |
2261 (defun gdb-restore-windows () | |
2262 "Restore the basic arrangement of windows used by gdba. | |
2263 This arrangement depends on the value of `gdb-many-windows'." | |
2264 (interactive) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2265 (pop-to-buffer gud-comint-buffer) ;Select the right window and frame. |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2266 (delete-other-windows) |
54538 | 2267 (if gdb-many-windows |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2268 (gdb-setup-windows) |
54538 | 2269 (split-window) |
2270 (other-window 1) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2271 (switch-to-buffer |
54538 | 2272 (if gud-last-last-frame |
2273 (gud-find-file (car gud-last-last-frame)) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2274 (gud-find-file gdb-main-file))) |
54538 | 2275 (other-window 1))) |
2276 | |
2277 (defun gdb-reset () | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2278 "Exit a debugging session cleanly. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2279 Kills the gdb buffers and resets the source buffers." |
54538 | 2280 (dolist (buffer (buffer-list)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2281 (unless (eq buffer gud-comint-buffer) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2282 (with-current-buffer buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2283 (if (memq gud-minor-mode '(gdbmi gdba)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2284 (if (string-match "\\`\\*.+\\*\\'" (buffer-name)) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2285 (kill-buffer nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2286 (gdb-remove-breakpoint-icons (point-min) (point-max) t) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2287 (setq gud-minor-mode nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2288 (kill-local-variable 'tool-bar-map) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2289 (kill-local-variable 'gdb-define-alist)))))) |
54538 | 2290 (when (markerp gdb-overlay-arrow-position) |
2291 (move-marker gdb-overlay-arrow-position nil) | |
2292 (setq gdb-overlay-arrow-position nil)) | |
2293 (setq overlay-arrow-variable-list | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2294 (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2295 (setq gud-running nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2296 (setq gdb-active-process nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2297 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) |
54538 | 2298 |
2299 (defun gdb-source-info () | |
2300 "Find the source file where the program starts and displays it with related | |
2301 buffers." | |
2302 (goto-char (point-min)) | |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2303 (if (and (search-forward "Located in " nil t) |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
2304 (looking-at "\\S-+")) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2305 (setq gdb-main-file (match-string 0))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2306 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2307 (if (search-forward "Includes preprocessor macro info." nil t) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2308 (setq gdb-macro-info t)) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2309 (if gdb-many-windows |
54538 | 2310 (gdb-setup-windows) |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2311 (gdb-get-create-buffer 'gdb-breakpoints-buffer) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2312 (if gdb-show-main |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2313 (let ((pop-up-windows t)) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2314 (display-buffer (gud-find-file gdb-main-file)))))) |
54538 | 2315 |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2316 (defun gdb-get-location (bptno line flag) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2317 "Find the directory containing the relevant source file. |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2318 Put in buffer and place breakpoint icon." |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2319 (goto-char (point-min)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2320 (catch 'file-not-found |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2321 (if (search-forward "Located in " nil t) |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
2322 (when (looking-at "\\S-+") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2323 (delete (cons bptno "File not found") gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2324 (push (cons bptno (match-string 0)) gdb-location-alist)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2325 (gdb-resync) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2326 (unless (assoc bptno gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2327 (push (cons bptno "File not found") gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2328 (message-box "Cannot find source file for breakpoint location.\n\ |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2329 Add directory to search path for source files using the GDB command, dir.")) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2330 (throw 'file-not-found nil)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2331 (with-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2332 (find-file-noselect (match-string 0)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2333 (save-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2334 (set (make-local-variable 'gud-minor-mode) 'gdba) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2335 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2336 ;; only want one breakpoint icon at each location |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2337 (save-excursion |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2338 (goto-line (string-to-number line)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2339 (gdb-put-breakpoint-icon (eq flag ?y) bptno))))) |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2340 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2341 (add-hook 'find-file-hook 'gdb-find-file-hook) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2342 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2343 (defun gdb-find-file-hook () |
63033
bd3ecd5ebdff
(gdb-info-locals-handler): Use window point to preserve point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62936
diff
changeset
|
2344 "Set up buffer for debugging if file is part of the source code |
bd3ecd5ebdff
(gdb-info-locals-handler): Use window point to preserve point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62936
diff
changeset
|
2345 of the current session." |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2346 (if (and (not gdb-find-file-unhook) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2347 ;; in case gud or gdb-ui is just loaded |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2348 gud-comint-buffer |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2349 (buffer-name gud-comint-buffer) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2350 (with-current-buffer gud-comint-buffer |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2351 (eq gud-minor-mode 'gdba))) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2352 (condition-case nil |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2353 (gdb-enqueue-input |
60124
106946a8423d
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
60073
diff
changeset
|
2354 (list (concat gdb-server-prefix "list " |
106946a8423d
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
60073
diff
changeset
|
2355 (file-name-nondirectory buffer-file-name) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2356 ":1\n") |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2357 `(lambda () (gdb-set-gud-minor-mode ,(current-buffer))))) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2358 (error (setq gdb-find-file-unhook t))))) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2359 |
54538 | 2360 ;;from put-image |
2361 (defun gdb-put-string (putstring pos &optional dprop) | |
2362 "Put string PUTSTRING in front of POS in the current buffer. | |
2363 PUTSTRING is displayed by putting an overlay into the current buffer with a | |
2364 `before-string' STRING that has a `display' property whose value is | |
2365 PUTSTRING." | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2366 (let ((string (make-string 1 ?x)) |
54538 | 2367 (buffer (current-buffer))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2368 (setq putstring (copy-sequence putstring)) |
54538 | 2369 (let ((overlay (make-overlay pos pos buffer)) |
2370 (prop (or dprop | |
2371 (list (list 'margin 'left-margin) putstring)))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2372 (put-text-property 0 (length string) 'display prop string) |
54538 | 2373 (overlay-put overlay 'put-break t) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2374 (overlay-put overlay 'before-string string)))) |
54538 | 2375 |
2376 ;;from remove-images | |
2377 (defun gdb-remove-strings (start end &optional buffer) | |
2378 "Remove strings between START and END in BUFFER. | |
2379 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. | |
2380 BUFFER nil or omitted means use the current buffer." | |
2381 (unless buffer | |
2382 (setq buffer (current-buffer))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2383 (dolist (overlay (overlays-in start end)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2384 (when (overlay-get overlay 'put-break) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2385 (delete-overlay overlay)))) |
54538 | 2386 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2387 (defun gdb-put-breakpoint-icon (enabled bptno) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2388 (let ((start (- (line-beginning-position) 1)) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2389 (end (+ (line-end-position) 1)) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2390 (putstring (if enabled "B" "b"))) |
59635
4d7bfec0bb4a
(gdb-put-breakpoint-icon): Add help-echo for
Nick Roberts <nickrob@snap.net.nz>
parents:
59617
diff
changeset
|
2391 (add-text-properties |
4d7bfec0bb4a
(gdb-put-breakpoint-icon): Add help-echo for
Nick Roberts <nickrob@snap.net.nz>
parents:
59617
diff
changeset
|
2392 0 1 '(help-echo "mouse-1: set/clear bkpt, mouse-3: enable/disable bkpt") |
4d7bfec0bb4a
(gdb-put-breakpoint-icon): Add help-echo for
Nick Roberts <nickrob@snap.net.nz>
parents:
59617
diff
changeset
|
2393 putstring) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2394 (if enabled (add-text-properties |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2395 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2396 (add-text-properties |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2397 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) |
54538 | 2398 (gdb-remove-breakpoint-icons start end) |
2399 (if (display-images-p) | |
2400 (if (>= (car (window-fringes)) 8) | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
2401 (gdb-put-string |
54538 | 2402 nil (1+ start) |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
2403 `(left-fringe breakpoint |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2404 ,(if enabled |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
2405 'breakpoint-enabled |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
2406 'breakpoint-disabled))) |
54538 | 2407 (when (< left-margin-width 2) |
2408 (save-current-buffer | |
2409 (setq left-margin-width 2) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2410 (if (get-buffer-window (current-buffer) 0) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
2411 (set-window-margins |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2412 (get-buffer-window (current-buffer) 0) |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
2413 left-margin-width right-margin-width)))) |
54538 | 2414 (put-image |
2415 (if enabled | |
2416 (or breakpoint-enabled-icon | |
2417 (setq breakpoint-enabled-icon | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
2418 (find-image `((:type xpm :data |
54538 | 2419 ,breakpoint-xpm-data |
2420 :ascent 100 :pointer hand) | |
2421 (:type pbm :data | |
2422 ,breakpoint-enabled-pbm-data | |
2423 :ascent 100 :pointer hand))))) | |
2424 (or breakpoint-disabled-icon | |
2425 (setq breakpoint-disabled-icon | |
2426 (find-image `((:type xpm :data | |
2427 ,breakpoint-xpm-data | |
2428 :conversion disabled | |
2429 :ascent 100) | |
2430 (:type pbm :data | |
2431 ,breakpoint-disabled-pbm-data | |
2432 :ascent 100)))))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2433 (+ start 1) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2434 putstring |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2435 'left-margin)) |
54538 | 2436 (when (< left-margin-width 2) |
2437 (save-current-buffer | |
2438 (setq left-margin-width 2) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2439 (if (get-buffer-window (current-buffer) 0) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
2440 (set-window-margins |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2441 (get-buffer-window (current-buffer) 0) |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
2442 left-margin-width right-margin-width)))) |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
2443 (gdb-put-string |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
2444 (propertize putstring |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
2445 'face (if enabled 'breakpoint-enabled 'breakpoint-disabled)) |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
2446 (1+ start))))) |
54538 | 2447 |
2448 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin) | |
2449 (gdb-remove-strings start end) | |
2450 (if (display-images-p) | |
2451 (remove-images start end)) | |
2452 (when remove-margin | |
2453 (setq left-margin-width 0) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2454 (if (get-buffer-window (current-buffer) 0) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
2455 (set-window-margins |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2456 (get-buffer-window (current-buffer) 0) |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
2457 left-margin-width right-margin-width)))) |
54538 | 2458 |
2459 | |
2460 ;; | |
2461 ;; Assembler buffer. | |
2462 ;; | |
2463 (gdb-set-buffer-rules 'gdb-assembler-buffer | |
2464 'gdb-assembler-buffer-name | |
2465 'gdb-assembler-mode) | |
2466 | |
2467 (def-gdb-auto-updated-buffer gdb-assembler-buffer | |
2468 gdb-invalidate-assembler | |
62716 | 2469 (concat gdb-server-prefix "disassemble " |
2470 (if (member gdb-frame-address '(nil "main")) nil "0x") | |
2471 gdb-frame-address "\n") | |
54538 | 2472 gdb-assembler-handler |
2473 gdb-assembler-custom) | |
2474 | |
2475 (defun gdb-assembler-custom () | |
2476 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) | |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
2477 (pos 1) (address) (flag) (bptno)) |
54538 | 2478 (with-current-buffer buffer |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2479 (save-excursion |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2480 (if (not (equal gdb-frame-address "main")) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2481 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2482 (goto-char (point-min)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2483 (if (and gdb-frame-address |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2484 (re-search-forward gdb-frame-address nil t)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2485 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2486 (setq pos (point)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2487 (beginning-of-line) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2488 (or gdb-overlay-arrow-position |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2489 (setq gdb-overlay-arrow-position (make-marker))) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2490 (set-marker gdb-overlay-arrow-position |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2491 (point) (current-buffer)))))) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2492 ;; remove all breakpoint-icons in assembler buffer before updating. |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2493 (gdb-remove-breakpoint-icons (point-min) (point-max)))) |
54538 | 2494 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
2495 (goto-char (point-min)) | |
2496 (while (< (point) (- (point-max) 1)) | |
2497 (forward-line 1) | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
2498 (if (looking-at "[^\t].*?breakpoint") |
54538 | 2499 (progn |
2500 (looking-at | |
62716 | 2501 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)\\s-+0x0*\\(\\S-+\\)") |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
2502 (setq bptno (match-string 1)) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
2503 (setq flag (char-after (match-beginning 2))) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
2504 (setq address (match-string 3)) |
54538 | 2505 (with-current-buffer buffer |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2506 (save-excursion |
54538 | 2507 (goto-char (point-min)) |
2508 (if (re-search-forward address nil t) | |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
2509 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))))))) |
62716 | 2510 (if (not (equal gdb-frame-address "main")) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2511 (set-window-point (get-buffer-window buffer 0) pos)))) |
54538 | 2512 |
2513 (defvar gdb-assembler-mode-map | |
2514 (let ((map (make-sparse-keymap))) | |
2515 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2516 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2517 map)) |
54538 | 2518 |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2519 (defvar gdb-assembler-font-lock-keywords |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
2520 '(;; <__function.name+n> |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
2521 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
2522 (1 font-lock-function-name-face)) |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
2523 ;; 0xNNNNNNNN <__function.name+n>: opcode |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
2524 ("^0x[0-9a-f]+ \\(<\\(\\(\\sw\\|[_.]\\)+\\)\\+[0-9]+>\\)?:[ \t]+\\(\\sw+\\)" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2525 (4 font-lock-keyword-face)) |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
2526 ;; %register(at least i386) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2527 ("%\\sw+" . font-lock-variable-name-face) |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
2528 ("^\\(Dump of assembler code for function\\) \\(.+\\):" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2529 (1 font-lock-comment-face) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2530 (2 font-lock-function-name-face)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2531 ("^\\(End of assembler dump\\.\\)" . font-lock-comment-face)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2532 "Font lock keywords used in `gdb-assembler-mode'.") |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2533 |
54538 | 2534 (defun gdb-assembler-mode () |
2535 "Major mode for viewing code assembler. | |
2536 | |
2537 \\{gdb-assembler-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2538 (kill-all-local-variables) |
54538 | 2539 (setq major-mode 'gdb-assembler-mode) |
62716 | 2540 (setq mode-name (concat "Machine:" gdb-selected-frame)) |
54538 | 2541 (setq gdb-overlay-arrow-position nil) |
2542 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position) | |
2543 (setq fringes-outside-margins t) | |
2544 (setq buffer-read-only t) | |
2545 (use-local-map gdb-assembler-mode-map) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2546 (gdb-invalidate-assembler) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2547 (set (make-local-variable 'font-lock-defaults) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2548 '(gdb-assembler-font-lock-keywords)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2549 (run-mode-hooks 'gdb-assembler-mode-hook) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2550 'gdb-invalidate-assembler) |
54538 | 2551 |
2552 (defun gdb-assembler-buffer-name () | |
2553 (with-current-buffer gud-comint-buffer | |
62716 | 2554 (concat "*Disassembly of " (gdb-get-target-string) "*"))) |
54538 | 2555 |
2556 (defun gdb-display-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2557 "Display disassembly view." |
54538 | 2558 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
2559 (setq gdb-previous-frame nil) |
54538 | 2560 (gdb-display-buffer |
2561 (gdb-get-create-buffer 'gdb-assembler-buffer))) | |
2562 | |
2563 (defun gdb-frame-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2564 "Display disassembly view in a new frame." |
54538 | 2565 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
2566 (setq gdb-previous-frame nil) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2567 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2568 (special-display-frame-alist gdb-frame-parameters)) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2569 (display-buffer (gdb-get-create-buffer 'gdb-assembler-buffer)))) |
54538 | 2570 |
62716 | 2571 ;; modified because if gdb-frame-address has changed value a new command |
54538 | 2572 ;; must be enqueued to update the buffer with the new output |
2573 (defun gdb-invalidate-assembler (&optional ignored) | |
2574 (if (gdb-get-buffer 'gdb-assembler-buffer) | |
2575 (progn | |
62716 | 2576 (unless (and gdb-selected-frame |
2577 (string-equal gdb-selected-frame gdb-previous-frame)) | |
54538 | 2578 (if (or (not (member 'gdb-invalidate-assembler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2579 gdb-pending-triggers)) |
62716 | 2580 (not (string-equal gdb-frame-address |
2581 gdb-previous-frame-address))) | |
54538 | 2582 (progn |
62716 | 2583 ;; take previous disassemble command, if any, off the queue |
54538 | 2584 (with-current-buffer gud-comint-buffer |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2585 (let ((queue gdb-input-queue)) |
54538 | 2586 (dolist (item queue) |
2587 (if (equal (cdr item) '(gdb-assembler-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2588 (setq gdb-input-queue |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2589 (delete item gdb-input-queue)))))) |
54538 | 2590 (gdb-enqueue-input |
62716 | 2591 (list |
2592 (concat gdb-server-prefix "disassemble " | |
2593 (if (member gdb-frame-address '(nil "main")) nil "0x") | |
2594 gdb-frame-address "\n") | |
54538 | 2595 'gdb-assembler-handler)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2596 (push 'gdb-invalidate-assembler gdb-pending-triggers) |
62716 | 2597 (setq gdb-previous-frame-address gdb-frame-address) |
2598 (setq gdb-previous-frame gdb-selected-frame))))))) | |
54538 | 2599 |
62716 | 2600 (defun gdb-get-selected-frame () |
2601 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers)) | |
54538 | 2602 (progn |
2603 (gdb-enqueue-input | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2604 (list (concat gdb-server-prefix "info frame\n") 'gdb-frame-handler)) |
62716 | 2605 (push 'gdb-get-selected-frame |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2606 gdb-pending-triggers)))) |
54538 | 2607 |
2608 (defun gdb-frame-handler () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2609 (setq gdb-pending-triggers |
62716 | 2610 (delq 'gdb-get-selected-frame gdb-pending-triggers)) |
54538 | 2611 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) |
2612 (goto-char (point-min)) | |
62716 | 2613 (if (re-search-forward "Stack level \\([0-9]+\\)" nil t) |
2614 (setq gdb-frame-number (match-string 1))) | |
2615 (goto-char (point-min)) | |
2616 (if (re-search-forward | |
2617 ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? " nil t) | |
54538 | 2618 (progn |
62716 | 2619 (setq gdb-selected-frame (match-string 2)) |
55850
63ca25eb73a1
(gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents:
55764
diff
changeset
|
2620 (if (gdb-get-buffer 'gdb-locals-buffer) |
63ca25eb73a1
(gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents:
55764
diff
changeset
|
2621 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer) |
62716 | 2622 (setq mode-name (concat "Locals:" gdb-selected-frame)))) |
2623 (if (gdb-get-buffer 'gdb-assembler-buffer) | |
2624 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer) | |
2625 (setq mode-name (concat "Machine:" gdb-selected-frame)))) | |
2626 (setq gdb-frame-address (match-string 1)))) | |
2627 (goto-char (point-min)) | |
54538 | 2628 (if (re-search-forward " source language \\(\\S-*\\)\." nil t) |
2629 (setq gdb-current-language (match-string 1)))) | |
62716 | 2630 (gdb-invalidate-assembler)) |
54538 | 2631 |
2632 (provide 'gdb-ui) | |
2633 | |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2634 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
54538 | 2635 ;;; gdb-ui.el ends here |