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