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