Mercurial > emacs
annotate lisp/progmodes/gdb-ui.el @ 70131:12bbeecf7714
*** empty log message ***
author | Lars Hansen <larsh@soem.dk> |
---|---|
date | Thu, 20 Apr 2006 11:37:44 +0000 |
parents | 9099e9f6d57a |
children | 21438c8b3a3f 2d2f6f096f6e |
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 | |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
7 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 |
68773
dc49655f57ae
Update copyright for 2006.
Nick Roberts <nickrob@snap.net.nz>
parents:
68664
diff
changeset
|
8 ;; Free Software Foundation, Inc. |
54538 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
54538 | 26 |
27 ;;; Commentary: | |
28 | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
29 ;; This mode acts as a graphical user interface to GDB. You can interact with |
54538 | 30 ;; GDB through the GUD buffer in the usual way, but there are also further |
31 ;; 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
|
32 ;; 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
|
33 ;; 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
|
34 ;; 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
|
35 ;; (see the GDB Graphical Interface section in the Emacs info manual). |
54538 | 36 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
37 ;; 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
|
38 ;; gud-gdb-command-name, then start it with M-x gdba. |
54538 | 39 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
40 ;; 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
|
41 ;; 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
|
42 ;; 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
|
43 ;; 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
|
44 ;; Annotations section in the GDB info manual. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
45 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
46 ;; 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
|
47 ;; 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
|
48 ;; 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
|
49 ;; '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
|
50 ;; 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
|
51 ;; 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
|
52 ;; annotations to GDB/MI. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
53 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
54 ;; This mode SHOULD WORK WITH GDB 5.0 onwards but you will NEED GDB 6.0 |
67591
e81d8f1aa8fe
(gdb-many-windows): Echo new state in minibuffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67364
diff
changeset
|
55 ;; onwards to use watch expressions. It works best with GDB 6.4 where |
e81d8f1aa8fe
(gdb-many-windows): Echo new state in minibuffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67364
diff
changeset
|
56 ;; watch expressions will update more quickly. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
57 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
58 ;;; Windows Platforms: |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
59 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
60 ;; 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
|
61 ;; 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
|
62 ;; 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
|
63 ;; using a macro: |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
64 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
65 ;; #ifdef UNBUFFERED |
64999
e1cdc6178b3e
(toggle-gdb-use-inferior-io-buffer):
Nick Roberts <nickrob@snap.net.nz>
parents:
64993
diff
changeset
|
66 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0); |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
67 ;; #endif |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
68 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
69 ;; and compiling with -DUNBUFFERED while debugging. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
70 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
71 ;;; Known Bugs: |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
72 |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
73 ;; 1) Strings that are watched don't update in the speedbar when their |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
74 ;; contents change unless the first character changes. |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
75 ;; 2) Cannot handle multiple debug sessions. |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
76 ;; 3) Initially, the assembler buffer does not display the cursor at the |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
77 ;; current line if the line is not visible in the window (but when testing |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
78 ;; gdb-assembler-custom with a lisp debugger it does!). |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
79 |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
80 ;;; Problems with watch expressions, GDB/MI: |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
81 ;; 1) They go out of scope when the inferior is re-run. |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
82 ;; 2) -stack-list-locals has a type field but also prints type in values field. |
69666
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
83 ;; 3) VARNUM increments even when variable object is not created |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
84 ;; (maybe trivial). |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
85 |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
86 ;; Known Bugs: |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
87 ;; 1) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
88 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
89 ;;; TODO: |
59808 | 90 ;; 1) Use MI command -data-read-memory for memory window. |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
91 ;; 2) Use tree-widget.el instead of the speedbar for watch-expressions? |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
92 ;; 3) Mark breakpoint locations on scroll-bar of source buffer? |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
93 ;; 4) 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
|
94 ;; buffer instead of the value's history number. |
54538 | 95 |
96 ;;; Code: | |
97 | |
98 (require 'gud) | |
99 | |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
100 (defvar tool-bar-map) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
101 (defvar speedbar-initial-expansion-list-name) |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
102 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
103 (defvar gdb-pc-address nil "Initialization for Assembler buffer. |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
104 Set to \"main\" at start if gdb-show-main is t.") |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
105 (defvar gdb-frame-address nil "Identity of frame for watch expression.") |
62716 | 106 (defvar gdb-previous-frame-address nil) |
59808 | 107 (defvar gdb-memory-address "main") |
54538 | 108 (defvar gdb-previous-frame nil) |
62716 | 109 (defvar gdb-selected-frame nil) |
110 (defvar gdb-frame-number nil) | |
54538 | 111 (defvar gdb-current-language nil) |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
112 (defvar gdb-var-list nil |
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
113 "List of variables in watch window. |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
114 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP) |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
115 where STATUS is nil (unchanged), `changed' or `out-of-scope', FP the frame |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
116 address for root variables.") |
69000
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
117 (defvar gdb-force-update t |
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
118 "Non-nil means that view of watch expressions will be updated in the speedbar.") |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
119 (defvar gdb-main-file nil "Source file from which program execution begins.") |
54538 | 120 (defvar gdb-overlay-arrow-position nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
121 (defvar gdb-server-prefix nil) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
122 (defvar gdb-flush-pending-output nil) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
123 (defvar gdb-location-alist nil |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
124 "Alist of breakpoint numbers and full filenames.") |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
125 (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
|
126 and #define directives otherwise.") |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
127 (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
|
128 (defvar gdb-macro-info nil |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
129 "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
|
130 (defvar gdb-buffer-fringe-width nil) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
131 (defvar gdb-signalled nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
132 (defvar gdb-source-window nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
133 (defvar gdb-inferior-status nil) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
134 (defvar gdb-continuation nil) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
135 |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
136 (defvar gdb-buffer-type nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
137 "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
|
138 (make-variable-buffer-local 'gdb-buffer-type) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
139 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
140 (defvar gdb-input-queue () |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
141 "A list of gdb command objects.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
142 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
143 (defvar gdb-prompting nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
144 "True when gdb is idle with no pending input.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
145 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
146 (defvar gdb-output-sink 'user |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
147 "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
|
148 Possible values are these symbols: |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
149 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
150 `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
|
151 for the user to see. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
152 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
153 `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
|
154 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
155 `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
|
156 annotation is received. Then the output-sink |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
157 becomes:... |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
158 `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
|
159 for subsequent processing by a command. This is the |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
160 disposition of output generated by commands that |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
161 gdb mode sends to gdb on its own behalf. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
162 `post-emacs' -- ignore output until the prompt annotation is |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
163 received, then go to USER disposition. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
164 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
165 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
|
166 \(`user' and `emacs').") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
167 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
168 (defvar gdb-current-item nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
169 "The most recent command item sent to gdb.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
170 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
171 (defvar gdb-pending-triggers '() |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
172 "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
|
173 handlers.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
174 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
175 (defvar gdb-first-post-prompt nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
176 (defvar gdb-version nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
177 (defvar gdb-locals-font-lock-keywords nil) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
178 (defvar gdb-source-file-list nil |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
179 "List of source files for the current executable") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
180 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
181 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
182 (defvar gdb-locals-font-lock-keywords-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
183 '( |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
184 ;; var = (struct struct_tag) value |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
185 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
186 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
187 (3 font-lock-keyword-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
188 (4 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
189 ;; var = (type) value |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
190 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
191 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
192 (3 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
193 ;; var = val |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
194 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
195 (1 font-lock-variable-name-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
196 ) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
197 "Font lock keywords used in `gdb-local-mode'.") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
198 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
199 (defvar gdb-locals-font-lock-keywords-2 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
200 '( |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
201 ;; var = type value |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
202 ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
203 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
204 (3 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
205 ) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
206 "Font lock keywords used in `gdb-local-mode'.") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
207 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
208 ;; Variables for GDB 6.4+ |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
209 (defvar gdb-register-names nil "List of register names.") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
210 (defvar gdb-changed-registers nil |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
211 "List of changed register numbers (strings).") |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
212 |
54538 | 213 ;;;###autoload |
214 (defun gdba (command-line) | |
215 "Run gdb on program FILE in buffer *gud-FILE*. | |
216 The directory containing FILE becomes the initial working directory | |
217 and source-file directory for your debugger. | |
218 | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
219 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
|
220 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
|
221 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
|
222 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
|
223 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
224 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
|
225 `gdb-show-main', the layout below will appear unless |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
226 `gdb-use-separate-io-buffer' is nil when the source buffer |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
227 occupies the full width of the frame. Keybindings are shown in |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
228 some of the buffers. |
54538 | 229 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
230 Watch expressions appear in the speedbar/slowbar. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
231 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
232 The following commands help control operation : |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
233 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
234 `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
|
235 `gdb-restore-windows' - To restore the window layout. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
236 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
237 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
|
238 detailed description of this mode. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
239 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
240 |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
241 +----------------------------------------------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
242 | GDB Toolbar | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
243 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
244 | GUD buffer (I/O of GDB) | Locals buffer | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
245 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
246 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
247 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
248 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
249 | Source buffer | I/O buffer (of debugged program) | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
250 | | (comint-mode) | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
251 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
252 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
253 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
254 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
255 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
256 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
257 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
258 | Stack buffer | Breakpoints buffer | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
259 | RET gdb-frames-select | SPC gdb-toggle-breakpoint | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
260 | | RET gdb-goto-breakpoint | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
261 | | D gdb-delete-breakpoint | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
262 +-----------------------------------+----------------------------------+" |
54538 | 263 ;; |
264 (interactive (list (gud-query-cmdline 'gdba))) | |
265 ;; | |
266 ;; Let's start with a basic gud-gdb buffer and then modify it a bit. | |
69666
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
267 (gdb command-line) |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
268 (gdb-init-1)) |
54538 | 269 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
270 (defcustom gdb-debug-ring-max 128 |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
271 "Maximum size of `gdb-debug-ring'." |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
272 :group 'gud |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
273 :type 'integer |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
274 :version "22.1") |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
275 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
276 (defvar gdb-debug-ring nil |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
277 "List of commands, most recent first, sent to and replies received from GDB. |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
278 This variable is used to debug GDB-UI.") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
279 |
64697
7767f4fb012a
* progmodes/gdb-ui.el (gdb-enable-debug-log): Add autoload cookie.
Nick Roberts <nickrob@snap.net.nz>
parents:
64654
diff
changeset
|
280 ;;;###autoload |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
281 (defcustom gdb-enable-debug nil |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
282 "Non-nil means record the process input and output in `gdb-debug-ring'." |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
283 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
284 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
285 :version "22.1") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
286 |
62115
515e18600ed2
(gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
62065
diff
changeset
|
287 (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
|
288 "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
|
289 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
|
290 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
|
291 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
|
292 |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
293 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
|
294 predefined macros." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
295 :type 'string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
296 :group 'gud |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
297 :version "22.1") |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
298 |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
299 (defcustom gdb-cpp-define-alist-flags "" |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
300 "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
|
301 :type 'string |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
302 :group 'gud |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
303 :version "22.1") |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
304 |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
305 (defcustom gdb-show-main nil |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
306 "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
|
307 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
|
308 :type 'boolean |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
309 :group 'gud |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
310 :version "22.1") |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
311 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
312 (defcustom gdb-many-windows nil |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
313 "Nil means just pop up the GUD buffer unless `gdb-show-main' is t. |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
314 In this case it starts with two windows: one displaying the GUD |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
315 buffer and the other with the source file with the main routine |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
316 of the inferior. Non-nil means display the layout shown for |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
317 `gdba'." |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
318 :type 'boolean |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
319 :group 'gud |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
320 :version "22.1") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
321 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
322 (defcustom gdb-use-separate-io-buffer nil |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
323 "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
|
324 :type 'boolean |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
325 :group 'gud |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
326 :version "22.1") |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
327 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
328 (defun gdb-force-mode-line-update (status) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
329 (let ((buffer gud-comint-buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
330 (if (and buffer (buffer-name buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
331 (with-current-buffer buffer |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
332 (setq mode-line-process |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
333 (format ":%s [%s]" |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
334 (process-status (get-buffer-process buffer)) status)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
335 ;; Force mode line redisplay soon. |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
336 (force-mode-line-update))))) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
337 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
338 (defun gdb-many-windows (arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
339 "Toggle the number of windows in the basic arrangement. |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
340 With arg, display additional buffers iff arg is positive." |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
341 (interactive "P") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
342 (setq gdb-many-windows |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
343 (if (null arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
344 (not gdb-many-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
345 (> (prefix-numeric-value arg) 0))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
346 (message (format "Display of other windows %sabled" |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
347 (if gdb-many-windows "en" "dis"))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
348 (if (and gud-comint-buffer |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
349 (buffer-name gud-comint-buffer)) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
350 (condition-case nil |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
351 (gdb-restore-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
352 (error nil)))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
353 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
354 (defun gdb-use-separate-io-buffer (arg) |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
355 "Toggle separate IO for inferior. |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
356 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
|
357 (interactive "P") |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
358 (setq gdb-use-separate-io-buffer |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
359 (if (null arg) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
360 (not gdb-use-separate-io-buffer) |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
361 (> (prefix-numeric-value arg) 0))) |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
362 (message (format "Separate inferior IO %sabled" |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
363 (if gdb-use-separate-io-buffer "en" "dis"))) |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
364 (if (and gud-comint-buffer |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
365 (buffer-name gud-comint-buffer)) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
366 (condition-case nil |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
367 (if gdb-use-separate-io-buffer |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
368 (if gdb-many-windows (gdb-restore-windows)) |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
369 (kill-buffer (gdb-inferior-io-name))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
370 (error nil)))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
371 |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
372 (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
|
373 |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
374 (defun gdb-create-define-alist () |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
375 "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
|
376 (let* ((file (buffer-file-name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
377 (output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
378 (with-output-to-string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
379 (with-current-buffer standard-output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
380 (call-process shell-file-name |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
381 (if (file-exists-p file) file nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
382 (list t nil) nil "-c" |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
383 (concat gdb-cpp-define-alist-program " " |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
384 gdb-cpp-define-alist-flags))))) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
385 (define-list (split-string output "\n" t)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
386 (name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
387 (setq gdb-define-alist nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
388 (dolist (define define-list) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
389 (setq name (nth 1 (split-string define "[( ]"))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
390 (push (cons name define) gdb-define-alist)))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
391 |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
392 (defun gdb-tooltip-print (expr) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
393 (tooltip-show |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
394 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
395 (goto-char (point-min)) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
396 (let ((string |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
397 (if (search-forward "=" nil t) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
398 (concat expr (buffer-substring (- (point) 2) (point-max))) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
399 (buffer-string)))) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
400 ;; 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
|
401 (substring string 0 (- (length string) 1)))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
402 (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
|
403 |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
404 ;; 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
|
405 ;; 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
|
406 ;; unexpected starting annotation (phase error). |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
407 (defun gdb-tooltip-print-1 (expr) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
408 (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
|
409 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
410 (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
|
411 (unless (looking-at "\\S-+.*(.*).*") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
412 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
413 (list (concat gdb-server-prefix "print " expr "\n") |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
414 `(lambda () (gdb-tooltip-print ,expr)))))))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
415 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
416 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)") |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
417 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
418 (defun gdb-set-gud-minor-mode-existing-buffers () |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
419 "Create list of source files for current GDB session." |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
420 (goto-char (point-min)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
421 (when (search-forward "read in on demand:" nil t) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
422 (while (re-search-forward gdb-source-file-regexp nil t) |
69988
f4b6648f6d4f
(gdb-set-gud-minor-mode-existing-buffers):
Nick Roberts <nickrob@snap.net.nz>
parents:
69910
diff
changeset
|
423 (push (file-name-nondirectory (or (match-string 1) (match-string 2))) |
f4b6648f6d4f
(gdb-set-gud-minor-mode-existing-buffers):
Nick Roberts <nickrob@snap.net.nz>
parents:
69910
diff
changeset
|
424 gdb-source-file-list)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
425 (dolist (buffer (buffer-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
426 (with-current-buffer buffer |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
427 (when (and buffer-file-name |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
428 (member (file-name-nondirectory buffer-file-name) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
429 gdb-source-file-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
430 (set (make-local-variable 'gud-minor-mode) 'gdba) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
431 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
432 (when gud-tooltip-mode |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
433 (make-local-variable 'gdb-define-alist) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
434 (gdb-create-define-alist) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
435 (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
|
436 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
437 (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
|
438 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
439 (varnum (car var)) expr array) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
440 (string-match "\\(var[0-9]+\\)\\.\\(.*\\)" varnum) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
441 (let ((var1 (assoc (match-string 1 varnum) gdb-var-list)) var2 varnumlet |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
442 (component-list (split-string (match-string 2 varnum) "\\." t))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
443 (setq expr (nth 1 var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
444 (setq varnumlet (car var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
445 (dolist (component component-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
446 (setq var2 (assoc varnumlet gdb-var-list)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
447 (setq expr (concat expr |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
448 (if (string-match ".*\\[[0-9]+\\]$" (nth 3 var2)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
449 (concat "[" component "]") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
450 (concat "." component)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
451 (setq varnumlet (concat varnumlet "." component))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
452 expr))) |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
453 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
454 (defun gdb-init-1 () |
54538 | 455 (set (make-local-variable 'gud-minor-mode) 'gdba) |
456 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) | |
457 ;; | |
62716 | 458 (gud-def gud-break (if (not (string-match "Machine" mode-name)) |
54538 | 459 (gud-call "break %f:%l" arg) |
460 (save-excursion | |
461 (beginning-of-line) | |
462 (forward-char 2) | |
463 (gud-call "break *%a" arg))) | |
464 "\C-b" "Set breakpoint at current line or address.") | |
465 ;; | |
62716 | 466 (gud-def gud-remove (if (not (string-match "Machine" mode-name)) |
54538 | 467 (gud-call "clear %f:%l" arg) |
468 (save-excursion | |
469 (beginning-of-line) | |
470 (forward-char 2) | |
471 (gud-call "clear *%a" arg))) | |
472 "\C-d" "Remove breakpoint at current line or address.") | |
473 ;; | |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
474 (gud-def gud-until (if (not (string-match "Machine" mode-name)) |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
475 (gud-call "until %f:%l" arg) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
476 (save-excursion |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
477 (beginning-of-line) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
478 (forward-char 2) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
479 (gud-call "until *%a" arg))) |
54538 | 480 "\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
|
481 ;; |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
482 (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
|
483 nil "Start or continue execution.") |
54538 | 484 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
485 ;; For debugging Emacs only. |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
486 (gud-def gud-pp |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
487 (gud-call |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
488 (concat |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
489 "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
|
490 '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
|
491 (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
|
492 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
|
493 |
54538 | 494 (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
|
495 'gdb-mouse-set-clear-breakpoint) |
54538 | 496 (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
|
497 'gdb-mouse-set-clear-breakpoint) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
498 (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
|
499 'gdb-mouse-until) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
500 (define-key gud-minor-mode-map [left-margin drag-mouse-1] |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
501 'gdb-mouse-until) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
502 (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
|
503 'gdb-mouse-until) |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
504 (define-key gud-minor-mode-map [left-margin mouse-2] |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
505 'gdb-mouse-until) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
506 (define-key gud-minor-mode-map [left-margin C-drag-mouse-1] |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
507 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
508 (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1] |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
509 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
510 (define-key gud-minor-mode-map [left-fringe C-mouse-2] |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
511 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
512 (define-key gud-minor-mode-map [left-margin C-mouse-2] |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
513 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
514 (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
|
515 'gdb-mouse-toggle-breakpoint-margin) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
516 (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
|
517 'gdb-mouse-toggle-breakpoint-fringe) |
54538 | 518 |
519 (setq comint-input-sender 'gdb-send) | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
520 |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
521 ;; (re-)initialize |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
522 (setq gdb-pc-address (if gdb-show-main "main" nil)) |
62716 | 523 (setq gdb-previous-frame-address nil |
524 gdb-memory-address "main" | |
525 gdb-previous-frame nil | |
526 gdb-selected-frame nil | |
527 gdb-current-language nil | |
528 gdb-frame-number nil | |
529 gdb-var-list nil | |
69000
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
530 gdb-force-update t |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
531 gdb-main-file nil |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
532 gdb-first-post-prompt t |
62716 | 533 gdb-prompting nil |
534 gdb-input-queue nil | |
535 gdb-current-item nil | |
536 gdb-pending-triggers nil | |
537 gdb-output-sink 'user | |
538 gdb-server-prefix "server " | |
539 gdb-flush-pending-output nil | |
540 gdb-location-alist nil | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
541 gdb-source-file-list nil |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
542 gdb-error nil |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
543 gdb-macro-info nil |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
544 gdb-buffer-fringe-width (car (window-fringes)) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
545 gdb-debug-ring nil |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
546 gdb-signalled nil |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
547 gdb-source-window nil |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
548 gdb-inferior-status nil |
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
549 gdb-continuation nil) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
550 |
54538 | 551 (setq gdb-buffer-type 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
552 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
553 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
554 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
555 ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
556 (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
557 'gdb-get-version))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
558 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
559 (defun gdb-init-2 () |
54538 | 560 (if (eq window-system 'w32) |
561 (gdb-enqueue-input (list "set new-console off\n" 'ignore))) | |
562 (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
|
563 (gdb-enqueue-input (list "set width 0\n" 'ignore)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
564 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
565 (if (string-equal gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
566 (progn |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
567 (gdb-enqueue-input (list (concat gdb-server-prefix "info sources\n") |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
568 'gdb-set-gud-minor-mode-existing-buffers)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
569 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
570 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
571 (list "server interpreter mi -data-list-register-names\n" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
572 'gdb-get-register-names)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
573 ; Needs GDB 6.2 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
574 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
575 (list "server interpreter mi \"-file-list-exec-source-files\"\n" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
576 'gdb-set-gud-minor-mode-existing-buffers-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
577 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-2)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
578 |
69839
f91451ffdab7
(gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents:
69666
diff
changeset
|
579 ;; Find source file and compilation directory here. |
f91451ffdab7
(gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents:
69666
diff
changeset
|
580 ;; Works for C, C++, Fortran and Ada but not Java (GDB 6.4) |
f91451ffdab7
(gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents:
69666
diff
changeset
|
581 (gdb-enqueue-input (list "server list\n" 'ignore)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
582 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
583 |
54538 | 584 (run-hooks 'gdba-mode-hook)) |
585 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
586 (defun gdb-get-version () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
587 (goto-char (point-min)) |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
588 (if (re-search-forward "Undefined\\( mi\\)* command:" nil t) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
589 (setq gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
590 (setq gdb-version "6.4+")) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
591 (gdb-init-2)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
592 |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
593 (defun gdb-mouse-until (event) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
594 "Continue running until a source line past the current line. |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
595 The destination source line can be selected either by clicking with mouse-2 |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
596 on the fringe/margin or dragging the arrow with mouse-1 (default bindings)." |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
597 (interactive "e") |
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
598 (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
|
599 (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
|
600 (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
|
601 (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
|
602 (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
|
603 (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
|
604 (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
|
605 (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
|
606 (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
|
607 (marker-position |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
608 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
|
609 (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
|
610 (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
|
611 (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
|
612 (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
|
613 (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
|
614 (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
|
615 (marker-position |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
616 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
|
617 (save-excursion |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
618 (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
|
619 (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
|
620 (gud-call (concat "until *%a"))))))))) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
621 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
622 (defun gdb-mouse-jump (event) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
623 "Set execution address/line. |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
624 The destination source line can be selected either by clicking with mouse-2 |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
625 on the fringe/margin or dragging the arrow with mouse-1 (default bindings). |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
626 Unlike gdb-mouse-until the destination address can be before the current |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
627 line, and no execution takes place." |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
628 (interactive "e") |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
629 (if gud-overlay-arrow-position |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
630 (let ((start (event-start event)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
631 (end (event-end event)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
632 (buffer (marker-buffer gud-overlay-arrow-position)) (line)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
633 (if (not (string-match "Machine" mode-name)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
634 (if (equal buffer (window-buffer (posn-window end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
635 (with-current-buffer buffer |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
636 (when (or (equal start end) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
637 (equal (posn-point start) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
638 (marker-position |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
639 gud-overlay-arrow-position))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
640 (setq line (line-number-at-pos (posn-point end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
641 (progn (gud-call (concat "tbreak " (number-to-string line))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
642 (gud-call (concat "jump " (number-to-string line))))))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
643 (if (equal (marker-buffer gdb-overlay-arrow-position) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
644 (window-buffer (posn-window end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
645 (when (or (equal start end) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
646 (equal (posn-point start) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
647 (marker-position |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
648 gdb-overlay-arrow-position))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
649 (save-excursion |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
650 (goto-line (line-number-at-pos (posn-point end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
651 (forward-char 2) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
652 (progn |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
653 (gud-call (concat "tbreak *%a")) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
654 (gud-call (concat "jump *%a")))))))))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
655 |
69042
01ec984a6ce6
(gdb-speedbar-auto-raise): Don't enable by default.
Nick Roberts <nickrob@snap.net.nz>
parents:
69023
diff
changeset
|
656 (defcustom gdb-speedbar-auto-raise nil |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
657 "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
|
658 updated." |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
659 :type 'boolean |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
660 :group 'gud |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
661 :version "22.1") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
662 |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
663 (defun gdb-speedbar-auto-raise (arg) |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
664 "Toggle automatic raising of the speedbar for watch expressions. |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
665 With arg, automatically raise speedbar iff arg is positive." |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
666 (interactive "P") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
667 (setq gdb-speedbar-auto-raise |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
668 (if (null arg) |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
669 (not gdb-speedbar-auto-raise) |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
670 (> (prefix-numeric-value arg) 0))) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
671 (message (format "Auto raising %sabled" |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
672 (if gdb-speedbar-auto-raise "en" "dis")))) |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
673 |
54538 | 674 (defcustom gdb-use-colon-colon-notation nil |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
675 "If non-nil use FUN::VAR format to display variables in the speedbar." |
54538 | 676 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
677 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
678 :version "22.1") |
54538 | 679 |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
680 (define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
681 (define-key global-map (concat gud-key-prefix "\C-w") 'gud-watch) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
682 |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
683 (defun gud-watch (&optional arg event) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
684 "Watch expression at point. |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
685 With arg, enter name of variable to be watched in the minibuffer." |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
686 (interactive (list current-prefix-arg last-input-event)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
687 (let ((minor-mode (buffer-local-value 'gud-minor-mode gud-comint-buffer))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
688 (if (memq minor-mode '(gdbmi gdba)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
689 (progn |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
690 (if event (posn-set-point (event-end event))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
691 (require 'tooltip) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
692 (save-selected-window |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
693 (let ((expr (if arg |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
694 (completing-read "Name of variable: " |
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
695 'gud-gdb-complete-command) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
696 (tooltip-identifier-from-point (point))))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
697 (catch 'already-watched |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
698 (dolist (var gdb-var-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
699 (unless (string-match "\\." (car var)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
700 (if (string-equal expr (nth 1 var)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
701 (throw 'already-watched nil)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
702 (set-text-properties 0 (length expr) nil expr) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
703 (gdb-enqueue-input |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
704 (list |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
705 (if (eq minor-mode 'gdba) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
706 (concat |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
707 "server interpreter mi \"-var-create - * " expr "\"\n") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
708 (concat"-var-create - * " expr "\n")) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
709 `(lambda () (gdb-var-create-handler ,expr)))))))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
710 (message "gud-watch is a no-op in this mode.")))) |
54538 | 711 |
712 (defconst gdb-var-create-regexp | |
69666
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
713 "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",.*type=\"\\(.*?\\)\"") |
54538 | 714 |
715 (defun gdb-var-create-handler (expr) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
716 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
717 (if (re-search-forward gdb-var-create-regexp nil t) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
718 (let ((var (list |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
719 (match-string 1) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
720 (if (and (string-equal gdb-current-language "c") |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
721 gdb-use-colon-colon-notation gdb-selected-frame) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
722 (setq expr (concat gdb-selected-frame "::" expr)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
723 expr) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
724 (match-string 2) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
725 (match-string 3) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
726 nil nil gdb-frame-address))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
727 (push var gdb-var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
728 (speedbar 1) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
729 (unless (string-equal |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
730 speedbar-initial-expansion-list-name "GUD") |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
731 (speedbar-change-initial-expansion-list "GUD")) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
732 (gdb-enqueue-input |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
733 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
734 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
735 (concat "server interpreter mi \"-var-evaluate-expression " |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
736 (car var) "\"\n") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
737 (concat "-var-evaluate-expression " (car var) "\n")) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
738 `(lambda () (gdb-var-evaluate-expression-handler |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
739 ,(car var) nil))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
740 (if (search-forward "Undefined command" nil t) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
741 (message-box "Watching expressions requires gdb 6.0 onwards") |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
742 (message-box "No symbol \"%s\" in current context." expr)))) |
54538 | 743 |
744 (defun gdb-var-evaluate-expression-handler (varnum changed) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
745 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
746 (re-search-forward ".*value=\\(\".*\"\\)" nil t) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
747 (let ((var (assoc varnum gdb-var-list))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
748 (when var |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
749 (if changed (setcar (nthcdr 5 var) 'changed)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
750 (setcar (nthcdr 4 var) (read (match-string 1)))))) |
54538 | 751 |
752 (defun gdb-var-list-children (varnum) | |
753 (gdb-enqueue-input | |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
754 (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
|
755 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
54538 | 756 |
757 (defconst gdb-var-list-children-regexp | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
758 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
759 numchild=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\".*?}") |
54538 | 760 |
761 (defun gdb-var-list-children-handler (varnum) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
762 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
763 (let ((var-list nil)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
764 (catch 'child-already-watched |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
765 (dolist (var gdb-var-list) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
766 (if (string-equal varnum (car var)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
767 (progn |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
768 (push var var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
769 (while (re-search-forward gdb-var-list-children-regexp nil t) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
770 (let ((varchild (list (match-string 1) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
771 (match-string 2) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
772 (match-string 3) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
773 (match-string 4) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
774 nil nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
775 (if (assoc (car varchild) gdb-var-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
776 (throw 'child-already-watched nil)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
777 (push varchild var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
778 (gdb-enqueue-input |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
779 (list |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
780 (concat |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
781 "server interpreter mi \"-var-evaluate-expression " |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
782 (car varchild) "\"\n") |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
783 `(lambda () (gdb-var-evaluate-expression-handler |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
784 ,(car varchild) nil))))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
785 (push var var-list))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
786 (setq gdb-var-list (nreverse var-list))))) |
54538 | 787 |
788 (defun gdb-var-update () | |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
789 (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
|
790 (gdb-enqueue-input |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
791 (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
|
792 'gdb-var-update-handler)) |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
793 (push 'gdb-var-update gdb-pending-triggers))) |
54538 | 794 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
795 (defconst gdb-var-update-regexp |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
796 "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
797 type_changed=\".*?\".*?}") |
54538 | 798 |
799 (defun gdb-var-update-handler () | |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
800 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
801 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
802 (goto-char (point-min)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
803 (while (re-search-forward gdb-var-update-regexp nil t) |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
804 (let ((varnum (match-string 1))) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
805 (if (string-equal (match-string 2) "false") |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
806 (let ((var (assoc varnum gdb-var-list))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
807 (if var (setcar (nthcdr 5 var) 'out-of-scope))) |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
808 (gdb-enqueue-input |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
809 (list |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
810 (concat "server interpreter mi \"-var-evaluate-expression " |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
811 varnum "\"\n") |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
812 `(lambda () (gdb-var-evaluate-expression-handler ,varnum t))))))) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
813 (setq gdb-pending-triggers |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
814 (delq 'gdb-var-update gdb-pending-triggers)) |
60153
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
815 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
64654 | 816 ;; Dummy command to update speedbar at right time. |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
817 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh)) |
64654 | 818 ;; Keep gdb-pending-triggers non-nil till end. |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
819 (push 'gdb-speedbar-refresh gdb-pending-triggers))) |
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
820 |
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
821 (defun gdb-speedbar-refresh () |
60153
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
822 (setq gdb-pending-triggers |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
823 (delq 'gdb-speedbar-refresh gdb-pending-triggers)) |
60153
10993bad7aee
(gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
60124
diff
changeset
|
824 (with-current-buffer gud-comint-buffer |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
825 (let ((speedbar-verbosity-level 0) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
826 (speedbar-shown-directories nil)) |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
827 (save-excursion |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
828 (speedbar-refresh))))) |
54538 | 829 |
830 (defun gdb-var-delete () | |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
831 "Delete watch expression at point from the speedbar." |
54538 | 832 (interactive) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
833 (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
|
834 '(gdbmi gdba)) |
54538 | 835 (let ((text (speedbar-line-text))) |
836 (string-match "\\(\\S-+\\)" text) | |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
837 (let ((expr (match-string 1 text)) var varnum) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
838 (catch 'expr-found |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
839 (dolist (var1 gdb-var-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
840 (when (string-equal expr (nth 1 var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
841 (setq var var1) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
842 (setq varnum (car var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
843 (throw 'expr-found nil)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
844 (unless (string-match "\\." (car var)) |
54538 | 845 (gdb-enqueue-input |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
846 (list |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
847 (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
|
848 'gdba) |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
849 (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
|
850 (concat "-var-delete " varnum "\n")) |
54538 | 851 'ignore)) |
852 (setq gdb-var-list (delq var gdb-var-list)) | |
853 (dolist (varchild gdb-var-list) | |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
854 (if (string-match (concat (car var) "\\.") (car varchild)) |
69000
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
855 (setq gdb-var-list (delq varchild gdb-var-list))))))))) |
54538 | 856 |
857 (defun gdb-edit-value (text token indent) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
858 "Assign a value to a variable displayed in the speedbar." |
54538 | 859 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
860 (varnum (car var)) (value)) |
54538 | 861 (setq value (read-string "New value: ")) |
862 (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
|
863 (list |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
864 (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
|
865 (concat "server interpreter mi \"-var-assign " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
866 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
|
867 (concat "-var-assign " varnum " " value "\n")) |
69325
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
868 `(lambda () (gdb-edit-value-handler ,value)))))) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
869 |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
870 (defun gdb-edit-value-handler (value) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
871 (goto-char (point-min)) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
872 (if (re-search-forward gdb-error-regexp nil t) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
873 (message-box "Invalid number or expression (%s)" value))) |
54538 | 874 |
875 (defcustom gdb-show-changed-values t | |
68967
87bf1f965a0f
(gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68941
diff
changeset
|
876 "If non-nil change the face of out of scope variables and changed values. |
87bf1f965a0f
(gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68941
diff
changeset
|
877 Out of scope variables are suppressed with `shadow' face. |
87bf1f965a0f
(gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68941
diff
changeset
|
878 Changed values are highlighted with the face `font-lock-warning-face'." |
54538 | 879 :type 'boolean |
58049
fd0093bd412a
(gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
57982
diff
changeset
|
880 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
881 :version "22.1") |
54538 | 882 |
883 (defun gdb-speedbar-expand-node (text token indent) | |
884 "Expand the node the user clicked on. | |
885 TEXT is the text of the button we clicked on, a + or - item. | |
886 TOKEN is data related to this node. | |
887 INDENT is the current indentation depth." | |
888 (cond ((string-match "+" text) ;expand this node | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
889 (if (and |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
890 (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
891 (string-equal gdb-version "pre-6.4")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
892 (gdb-var-list-children token) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
893 (gdb-var-list-children-1 token))) |
54538 | 894 ((string-match "-" text) ;contract this node |
895 (dolist (var gdb-var-list) | |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
896 (if (string-match (concat token "\\.") (car var)) |
54538 | 897 (setq gdb-var-list (delq var gdb-var-list)))) |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
898 (speedbar-change-expand-button-char ?+) |
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
899 (speedbar-delete-subblock indent)) |
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
900 (t (error "Ooops... not sure what to do"))) |
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
901 (speedbar-center-buffer-smartly)) |
54538 | 902 |
903 (defun gdb-get-target-string () | |
904 (with-current-buffer gud-comint-buffer | |
905 gud-target-name)) | |
906 | |
907 | |
908 ;; | |
909 ;; gdb buffers. | |
910 ;; | |
911 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
912 ;; of that particular buffer. | |
913 ;; | |
914 ;; The usual gdb interaction buffer is given the type `gdba' and | |
915 ;; is constructed specially. | |
916 ;; | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
917 ;; Others are constructed by gdb-get-buffer-create and |
54538 | 918 ;; named according to the rules set forth in the gdb-buffer-rules-assoc |
919 | |
920 (defvar gdb-buffer-rules-assoc '()) | |
921 | |
922 (defun gdb-get-buffer (key) | |
923 "Return the gdb buffer tagged with type KEY. | |
924 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
925 (save-excursion | |
926 (gdb-look-for-tagged-buffer key (buffer-list)))) | |
927 | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
928 (defun gdb-get-buffer-create (key) |
54538 | 929 "Create a new gdb buffer of the type specified by KEY. |
930 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
931 (or (gdb-get-buffer key) | |
932 (let* ((rules (assoc key gdb-buffer-rules-assoc)) | |
933 (name (funcall (gdb-rules-name-maker rules))) | |
934 (new (get-buffer-create name))) | |
935 (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
|
936 (let ((trigger)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
937 (if (cdr (cdr rules)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
938 (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
|
939 (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
|
940 (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
|
941 (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
|
942 (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
|
943 (if trigger (funcall trigger))) |
54538 | 944 new)))) |
945 | |
946 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
947 | |
948 (defun gdb-look-for-tagged-buffer (key bufs) | |
949 (let ((retval nil)) | |
950 (while (and (not retval) bufs) | |
951 (set-buffer (car bufs)) | |
952 (if (eq gdb-buffer-type key) | |
953 (setq retval (car bufs))) | |
954 (setq bufs (cdr bufs))) | |
955 retval)) | |
956 | |
957 ;; | |
958 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
959 ;; at least one and possible more functions. The functions have these | |
960 ;; roles in defining a buffer type: | |
961 ;; | |
962 ;; NAME - Return a name for this buffer type. | |
963 ;; | |
964 ;; The remaining function(s) are optional: | |
965 ;; | |
966 ;; MODE - called in a new buffer with no arguments, should establish | |
967 ;; the proper mode for the buffer. | |
968 ;; | |
969 | |
970 (defun gdb-set-buffer-rules (buffer-type &rest rules) | |
971 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) | |
972 (if binding | |
973 (setcdr binding rules) | |
974 (push (cons buffer-type rules) | |
975 gdb-buffer-rules-assoc)))) | |
976 | |
977 ;; GUD buffers are an exception to the rules | |
978 (gdb-set-buffer-rules 'gdba 'error) | |
979 | |
980 ;; Partial-output buffer : This accumulates output from a command executed on | |
981 ;; behalf of emacs (rather than the user). | |
982 ;; | |
983 (gdb-set-buffer-rules 'gdb-partial-output-buffer | |
984 'gdb-partial-output-name) | |
985 | |
986 (defun gdb-partial-output-name () | |
987 (concat "*partial-output-" | |
988 (gdb-get-target-string) | |
989 "*")) | |
990 | |
991 | |
992 (gdb-set-buffer-rules 'gdb-inferior-io | |
993 'gdb-inferior-io-name | |
994 'gdb-inferior-io-mode) | |
995 | |
996 (defun gdb-inferior-io-name () | |
997 (concat "*input/output of " | |
998 (gdb-get-target-string) | |
999 "*")) | |
1000 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1001 (defun gdb-display-separate-io-buffer () |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1002 "Display IO of debugged program in a separate window." |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1003 (interactive) |
68903
57fa3643220b
(gdb-display-separate-io-buffer): Change use of
Nick Roberts <nickrob@snap.net.nz>
parents:
68902
diff
changeset
|
1004 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1005 (gdb-display-buffer |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1006 (gdb-get-buffer-create 'gdb-inferior-io)))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1007 |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1008 (defconst gdb-frame-parameters |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1009 '((height . 14) (width . 80) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1010 (unsplittable . t) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1011 (tool-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1012 (menu-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1013 (minibuffer . nil))) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1014 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1015 (defun gdb-frame-separate-io-buffer () |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1016 "Display IO of inferior in a new frame." |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1017 (interactive) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1018 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1019 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1020 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1021 (display-buffer (gdb-get-buffer-create 'gdb-inferior-io))))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1022 |
54538 | 1023 (defvar gdb-inferior-io-mode-map |
1024 (let ((map (make-sparse-keymap))) | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1025 (define-key map "\C-c\C-c" 'gdb-separate-io-interrupt) |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1026 (define-key map "\C-c\C-z" 'gdb-separate-io-stop) |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1027 (define-key map "\C-c\C-\\" 'gdb-separate-io-quit) |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1028 (define-key map "\C-c\C-d" 'gdb-separate-io-eof) |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1029 (define-key map "\C-d" 'gdb-separate-io-eof) |
54538 | 1030 map)) |
1031 | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1032 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
54538 | 1033 "Major mode for gdb inferior-io." |
1034 :syntax-table nil :abbrev-table nil | |
1035 ;; We want to use comint because it has various nifty and familiar | |
1036 ;; features. We don't need a process, but comint wants one, so create | |
1037 ;; a dummy one. | |
1038 (make-comint-in-buffer | |
1039 (substring (buffer-name) 1 (- (length (buffer-name)) 1)) | |
1040 (current-buffer) "hexl") | |
1041 (setq comint-input-sender 'gdb-inferior-io-sender)) | |
1042 | |
1043 (defun gdb-inferior-io-sender (proc string) | |
1044 ;; PROC is the pseudo-process created to satisfy comint. | |
1045 (with-current-buffer (process-buffer proc) | |
1046 (setq proc (get-buffer-process gud-comint-buffer)) | |
1047 (process-send-string proc string) | |
1048 (process-send-string proc "\n"))) | |
1049 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1050 (defun gdb-separate-io-interrupt () |
54538 | 1051 "Interrupt the program being debugged." |
1052 (interactive) | |
1053 (interrupt-process | |
1054 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1055 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1056 (defun gdb-separate-io-quit () |
54538 | 1057 "Send quit signal to the program being debugged." |
1058 (interactive) | |
1059 (quit-process | |
1060 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1061 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1062 (defun gdb-separate-io-stop () |
54538 | 1063 "Stop the program being debugged." |
1064 (interactive) | |
1065 (stop-process | |
1066 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1067 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1068 (defun gdb-separate-io-eof () |
54538 | 1069 "Send end-of-file to the program being debugged." |
1070 (interactive) | |
1071 (process-send-eof | |
1072 (get-buffer-process gud-comint-buffer))) | |
1073 | |
1074 | |
1075 ;; gdb communications | |
1076 ;; | |
1077 | |
1078 ;; INPUT: things sent to gdb | |
1079 ;; | |
1080 ;; The queues are lists. Each element is either a string (indicating user or | |
1081 ;; user-like input) or a list of the form: | |
1082 ;; | |
1083 ;; (INPUT-STRING HANDLER-FN) | |
1084 ;; | |
1085 ;; The handler function will be called from the partial-output buffer when the | |
1086 ;; command completes. This is the way to write commands which invoke gdb | |
1087 ;; commands autonomously. | |
1088 ;; | |
1089 ;; These lists are consumed tail first. | |
1090 ;; | |
1091 | |
1092 (defun gdb-send (proc string) | |
1093 "A comint send filter for gdb. | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1094 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
|
1095 (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
|
1096 (let ((inhibit-read-only t)) |
9e9e3aac0fda
(gdb-send): Bind inhibit-read-only to t
Nick Roberts <nickrob@snap.net.nz>
parents:
66162
diff
changeset
|
1097 (remove-text-properties (point-min) (point-max) '(face)))) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1098 (if gud-running |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1099 (progn |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1100 (let ((item (concat string "\n"))) |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
1101 (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring)) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1102 (process-send-string proc item))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1103 (if (string-match "\\\\$" string) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1104 (setq gdb-continuation (concat gdb-continuation string "\n")) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1105 (let ((item (concat gdb-continuation string "\n"))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1106 (gdb-enqueue-input item) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1107 (setq gdb-continuation nil))))) |
54538 | 1108 |
1109 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
1110 ;; is a query, or other non-top-level prompt. | |
1111 | |
1112 (defun gdb-enqueue-input (item) | |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1113 (if (not gud-running) |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1114 (if gdb-prompting |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1115 (progn |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1116 (gdb-send-item item) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1117 (setq gdb-prompting nil)) |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1118 (push item gdb-input-queue)))) |
54538 | 1119 |
1120 (defun gdb-dequeue-input () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1121 (let ((queue gdb-input-queue)) |
54538 | 1122 (and queue |
1123 (let ((last (car (last queue)))) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1124 (unless (nbutlast queue) (setq gdb-input-queue '())) |
54538 | 1125 last)))) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1126 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1127 (defun gdb-send-item (item) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1128 (setq gdb-flush-pending-output nil) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1129 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-ring)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1130 (setq gdb-current-item item) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1131 (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
|
1132 (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
|
1133 (if (stringp item) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1134 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1135 (setq gdb-output-sink 'user) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1136 (process-send-string process item)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1137 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1138 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1139 (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
|
1140 (process-send-string process |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1141 (car item)))) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1142 ;; case: eq gud-minor-mode 'gdbmi |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1143 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1144 (setq gdb-output-sink 'emacs) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1145 (process-send-string process (car item))))) |
54538 | 1146 |
1147 ;; | |
1148 ;; output -- things gdb prints to emacs | |
1149 ;; | |
1150 ;; GDB output is a stream interrupted by annotations. | |
1151 ;; Annotations can be recognized by their beginning | |
1152 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
1153 ;; | |
1154 ;; The tag is a string obeying symbol syntax. | |
1155 ;; | |
1156 ;; The optional part `<opt>' can be either the empty string | |
1157 ;; or a space followed by more data relating to the annotation. | |
1158 ;; For example, the SOURCE annotation is followed by a filename, | |
1159 ;; line number and various useless goo. This data must not include | |
1160 ;; any newlines. | |
1161 ;; | |
1162 | |
1163 (defcustom gud-gdba-command-name "gdb -annotate=3" | |
1164 "Default command to execute an executable under the GDB-UI debugger." | |
1165 :type 'string | |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
1166 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1167 :version "22.1") |
54538 | 1168 |
1169 (defvar gdb-annotation-rules | |
1170 '(("pre-prompt" gdb-pre-prompt) | |
1171 ("prompt" gdb-prompt) | |
1172 ("commands" gdb-subprompt) | |
1173 ("overload-choice" gdb-subprompt) | |
1174 ("query" gdb-subprompt) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1175 ;; 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
|
1176 ("nquery" gdb-subprompt) |
54538 | 1177 ("prompt-for-continue" gdb-subprompt) |
1178 ("post-prompt" gdb-post-prompt) | |
1179 ("source" gdb-source) | |
1180 ("starting" gdb-starting) | |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1181 ("exited" gdb-exited) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1182 ("signalled" gdb-signalled) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1183 ("signal" gdb-signal) |
54538 | 1184 ("breakpoint" gdb-stopping) |
1185 ("watchpoint" gdb-stopping) | |
1186 ("frame-begin" gdb-frame-begin) | |
1187 ("stopped" gdb-stopped) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1188 ("error-begin" gdb-error) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1189 ("error" gdb-error) |
54538 | 1190 ) "An assoc mapping annotation tags to functions which process them.") |
1191 | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1192 (defun gdb-resync() |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1193 (setq gdb-flush-pending-output t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1194 (setq gud-running nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1195 (gdb-force-mode-line-update "stopped") |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1196 (setq gdb-output-sink 'user) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1197 (setq gdb-input-queue nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1198 (setq gdb-pending-triggers nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1199 (setq gdb-prompting t)) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1200 |
54538 | 1201 (defconst gdb-source-spec-regexp |
62716 | 1202 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)") |
54538 | 1203 |
1204 ;; Do not use this except as an annotation handler. | |
1205 (defun gdb-source (args) | |
1206 (string-match gdb-source-spec-regexp args) | |
1207 ;; Extract the frame position from the marker. | |
1208 (setq gud-last-frame | |
1209 (cons | |
1210 (match-string 1 args) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
1211 (string-to-number (match-string 2 args)))) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
1212 (setq gdb-pc-address (match-string 3 args)) |
54962
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1213 ;; cover for auto-display output which comes *before* |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1214 ;; stopped annotation |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1215 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) |
54538 | 1216 |
1217 (defun gdb-pre-prompt (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1218 "An annotation handler for `pre-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1219 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
|
1220 happens to be in effect." |
67164
c3990f178905
(gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents:
67147
diff
changeset
|
1221 (setq gdb-error nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1222 (let ((sink gdb-output-sink)) |
54538 | 1223 (cond |
1224 ((eq sink 'user) t) | |
1225 ((eq sink 'emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1226 (setq gdb-output-sink 'post-emacs)) |
54538 | 1227 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1228 (gdb-resync) |
54538 | 1229 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
1230 | |
1231 (defun gdb-prompt (ignored) | |
1232 "An annotation handler for `prompt'. | |
1233 This sends the next command (if any) to gdb." | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1234 (when gdb-first-prompt |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1235 (gdb-init-1) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1236 (setq gdb-first-prompt nil)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1237 (let ((sink gdb-output-sink)) |
54538 | 1238 (cond |
1239 ((eq sink 'user) t) | |
1240 ((eq sink 'post-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1241 (setq gdb-output-sink 'user) |
54538 | 1242 (let ((handler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1243 (car (cdr gdb-current-item)))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1244 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1245 (funcall handler)))) |
1246 (t | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1247 (gdb-resync) |
54538 | 1248 (error "Phase error in gdb-prompt (got %s)" sink)))) |
1249 (let ((input (gdb-dequeue-input))) | |
1250 (if input | |
1251 (gdb-send-item input) | |
1252 (progn | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1253 (setq gdb-prompting t) |
54538 | 1254 (gud-display-frame))))) |
1255 | |
1256 (defun gdb-subprompt (ignored) | |
1257 "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
|
1258 (setq gdb-prompting t)) |
54538 | 1259 |
1260 (defun gdb-starting (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1261 "An annotation handler for `starting'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1262 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
|
1263 not GDB." |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1264 (setq gdb-active-process t) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1265 (let ((sink gdb-output-sink)) |
54538 | 1266 (cond |
1267 ((eq sink 'user) | |
1268 (progn | |
1269 (setq gud-running t) | |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1270 (setq gdb-inferior-status "running") |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1271 (gdb-force-mode-line-update gdb-inferior-status) |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1272 (gdb-remove-text-properties) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
1273 (setq gud-overlay-arrow-position nil) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
1274 (setq gdb-overlay-arrow-position nil) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1275 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1276 (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
|
1277 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1278 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1279 (error "Unexpected `starting' annotation"))))) |
54538 | 1280 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1281 (defun gdb-signal (ignored) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1282 (setq gdb-inferior-status "signal") |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1283 (gdb-force-mode-line-update gdb-inferior-status) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1284 (gdb-stopping ignored)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1285 |
54538 | 1286 (defun gdb-stopping (ignored) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1287 "An annotation handler for `breakpoint' and other annotations. |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1288 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
|
1289 being debugged." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1290 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1291 (let ((sink gdb-output-sink)) |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1292 (cond |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1293 ((eq sink 'inferior) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1294 (setq gdb-output-sink 'user)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1295 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1296 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1297 (error "Unexpected stopping annotation")))))) |
54538 | 1298 |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1299 (defun gdb-exited (ignored) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1300 "An annotation handler for `exited' and `signalled'. |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1301 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
|
1302 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
|
1303 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
|
1304 directives." |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1305 (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
|
1306 (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
|
1307 (setq gdb-overlay-arrow-position nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1308 (setq gdb-inferior-status "exited") |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1309 (gdb-force-mode-line-update gdb-inferior-status) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1310 (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
|
1311 |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1312 (defun gdb-signalled (ignored) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1313 (setq gdb-signalled t)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1314 |
54538 | 1315 (defun gdb-frame-begin (ignored) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1316 (let ((sink gdb-output-sink)) |
54538 | 1317 (cond |
1318 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1319 (setq gdb-output-sink 'user)) |
54538 | 1320 ((eq sink 'user) t) |
1321 ((eq sink 'emacs) t) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1322 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1323 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1324 (error "Unexpected frame-begin annotation (%S)" sink))))) |
54538 | 1325 |
1326 (defun gdb-stopped (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1327 "An annotation handler for `stopped'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1328 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
|
1329 sink to `user' in `gdb-stopping', that is fine." |
54538 | 1330 (setq gud-running nil) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
1331 (unless (or gud-overlay-arrow-position gud-last-frame |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
1332 (not gud-last-last-frame)) |
69585
5df134d9ab7f
(gdb-stopped): Even when there is no source
Nick Roberts <nickrob@snap.net.nz>
parents:
69526
diff
changeset
|
1333 (gud-display-line (car gud-last-last-frame) (cdr gud-last-last-frame))) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1334 (unless (member gdb-inferior-status '("exited" "signal")) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1335 (setq gdb-inferior-status "stopped") |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1336 (gdb-force-mode-line-update gdb-inferior-status)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1337 (let ((sink gdb-output-sink)) |
54538 | 1338 (cond |
1339 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1340 (setq gdb-output-sink 'user)) |
54538 | 1341 ((eq sink 'user) t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1342 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1343 (gdb-resync) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1344 (error "Unexpected stopped annotation")))) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1345 (if gdb-signalled (gdb-exited ignored))) |
54538 | 1346 |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1347 (defun gdb-error (ignored) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1348 (setq gdb-error (not gdb-error))) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1349 |
54538 | 1350 (defun gdb-post-prompt (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1351 "An annotation handler for `post-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1352 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
|
1353 happens to be appropriate." |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
1354 ;; Don't add to queue if there outstanding items or gdb-version is not known |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
1355 ;; yet. |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1356 (unless (or gdb-pending-triggers gdb-first-post-prompt) |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1357 (gdb-get-selected-frame) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1358 (gdb-invalidate-frames) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1359 ;; Regenerate breakpoints buffer in case it has been inadvertantly deleted. |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1360 (gdb-get-buffer-create 'gdb-breakpoints-buffer) |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1361 (gdb-invalidate-breakpoints) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1362 ;; Do this through gdb-get-selected-frame -> gdb-frame-handler |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
1363 ;; so gdb-pc-address is updated. |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1364 ;; (gdb-invalidate-assembler) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1365 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1366 (if (string-equal gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1367 (gdb-invalidate-registers) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1368 (gdb-get-changed-registers) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1369 (gdb-invalidate-registers-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1370 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1371 (gdb-invalidate-memory) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1372 (if (string-equal gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1373 (gdb-invalidate-locals) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1374 (gdb-invalidate-locals-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1375 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1376 (gdb-invalidate-threads) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1377 (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
|
1378 ;; FIXME: with GDB-6 on Darwin, this might very well work. |
64654 | 1379 ;; 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
|
1380 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
69000
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
1381 (setq gdb-force-update t) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1382 (if (string-equal gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1383 (gdb-var-update) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1384 (gdb-var-update-1))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1385 (setq gdb-first-post-prompt nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1386 (let ((sink gdb-output-sink)) |
54538 | 1387 (cond |
1388 ((eq sink 'user) t) | |
1389 ((eq sink 'pre-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1390 (setq gdb-output-sink 'emacs)) |
54538 | 1391 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1392 (gdb-resync) |
54538 | 1393 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
1394 | |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1395 (defconst gdb-buffer-list |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1396 '(gdb-stack-buffer gdb-locals-buffer gdb-registers-buffer gdb-threads-buffer)) |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1397 |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1398 (defun gdb-remove-text-properties () |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1399 (dolist (buffertype gdb-buffer-list) |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1400 (let ((buffer (gdb-get-buffer buffertype))) |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1401 (if buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1402 (with-current-buffer buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1403 (let ((inhibit-read-only t)) |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1404 (remove-text-properties |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1405 (point-min) (point-max) '(mouse-face nil help-echo nil)))))))) |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1406 |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1407 ;; GUD displays the selected GDB frame. This might might not be the current |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1408 ;; GDB frame (after up, down etc). If no GDB frame is visible but the last |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1409 ;; visited breakpoint is, use that window. |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1410 (defun gdb-display-source-buffer (buffer) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1411 (let* ((last-window (if gud-last-last-frame |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1412 (get-buffer-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1413 (gud-find-file (car gud-last-last-frame))))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1414 (source-window (or last-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1415 (if (and gdb-source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1416 (window-live-p gdb-source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1417 gdb-source-window)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1418 (when source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1419 (setq gdb-source-window source-window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1420 (set-window-buffer source-window buffer)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1421 source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1422 |
54538 | 1423 (defun gud-gdba-marker-filter (string) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1424 "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
|
1425 (if gdb-flush-pending-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1426 nil |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1427 (when gdb-enable-debug |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1428 (push (cons 'recv string) gdb-debug-ring) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1429 (if (> (length gdb-debug-ring) gdb-debug-ring-max) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1430 (setcdr (nthcdr (1- gdb-debug-ring-max) gdb-debug-ring) nil))) |
64654 | 1431 ;; 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
|
1432 (setq gud-marker-acc (concat gud-marker-acc string)) |
64654 | 1433 ;; 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
|
1434 (let ((output "")) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1435 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1436 ;; 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
|
1437 (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
|
1438 (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
|
1439 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1440 ;; 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
|
1441 ;; 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
|
1442 ;; elsewhere. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1443 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1444 (gdb-concat-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1445 output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1446 (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
|
1447 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1448 ;; 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
|
1449 (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
|
1450 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1451 ;; 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
|
1452 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1453 (let* ((annotation-type (match-string 1 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1454 (annotation-arguments (match-string 2 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1455 (annotation-rule (assoc annotation-type |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1456 gdb-annotation-rules))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1457 ;; Call the handler for this annotation. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1458 (if annotation-rule |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1459 (funcall (car (cdr annotation-rule)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1460 annotation-arguments) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1461 ;; 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
|
1462 ;; 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
|
1463 ;; us to blow up. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1464 )))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1465 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1466 ;; 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
|
1467 ;; 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
|
1468 (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
|
1469 gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1470 (progn |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1471 ;; 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
|
1472 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1473 (gdb-concat-output output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1474 (substring gud-marker-acc 0 |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1475 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1476 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1477 ;; 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
|
1478 (setq gud-marker-acc (substring gud-marker-acc |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1479 (match-beginning 0)))) |
54538 | 1480 ;; |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1481 ;; In case we know the gud-marker-acc contains no partial annotations: |
54538 | 1482 (progn |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1483 (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
|
1484 (setq gud-marker-acc ""))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1485 output))) |
54538 | 1486 |
1487 (defun gdb-concat-output (so-far new) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1488 (if gdb-error |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1489 (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
|
1490 (let ((sink gdb-output-sink)) |
54538 | 1491 (cond |
1492 ((eq sink 'user) (concat so-far new)) | |
1493 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
1494 ((eq sink 'emacs) | |
1495 (gdb-append-to-partial-output new) | |
1496 so-far) | |
1497 ((eq sink 'inferior) | |
1498 (gdb-append-to-inferior-io new) | |
1499 so-far) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1500 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1501 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1502 (error "Bogon output sink %S" sink))))) |
54538 | 1503 |
1504 (defun gdb-append-to-partial-output (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1505 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1506 (goto-char (point-max)) |
1507 (insert string))) | |
1508 | |
1509 (defun gdb-clear-partial-output () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1510 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1511 (erase-buffer))) |
1512 | |
1513 (defun gdb-append-to-inferior-io (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1514 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1515 (goto-char (point-max)) |
1516 (insert-before-markers string)) | |
1517 (if (not (string-equal string "")) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1518 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))) |
54538 | 1519 |
1520 (defun gdb-clear-inferior-io () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1521 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1522 (erase-buffer))) |
1523 | |
1524 | |
1525 ;; One trick is to have a command who's output is always available in a buffer | |
1526 ;; of it's own, and is always up to date. We build several buffers of this | |
1527 ;; type. | |
1528 ;; | |
1529 ;; There are two aspects to this: gdb has to tell us when the output for that | |
1530 ;; command might have changed, and we have to be able to run the command | |
1531 ;; behind the user's back. | |
1532 ;; | |
1533 ;; The output phasing associated with the variable gdb-output-sink | |
1534 ;; help us to run commands behind the user's back. | |
1535 ;; | |
1536 ;; Below is the code for specificly managing buffers of output from one | |
1537 ;; command. | |
1538 ;; | |
1539 | |
1540 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | |
1541 ;; It adds an input for the command we are tracking. It should be the | |
1542 ;; annotation rule binding of whatever gdb sends to tell us this command | |
1543 ;; might have changed it's output. | |
1544 ;; | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1545 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
54538 | 1546 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
1547 ;; input in the input queue (see comment about ``gdb communications'' above). | |
1548 | |
1549 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command | |
1550 output-handler) | |
1551 `(defun ,name (&optional ignored) | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1552 (if (and ,demand-predicate |
54538 | 1553 (not (member ',name |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1554 gdb-pending-triggers))) |
54538 | 1555 (progn |
1556 (gdb-enqueue-input | |
1557 (list ,gdb-command ',output-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1558 (push ',name gdb-pending-triggers))))) |
54538 | 1559 |
1560 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) | |
1561 `(defun ,name () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1562 (setq gdb-pending-triggers |
54538 | 1563 (delq ',trigger |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1564 gdb-pending-triggers)) |
54538 | 1565 (let ((buf (gdb-get-buffer ',buf-key))) |
1566 (and buf | |
1567 (with-current-buffer buf | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1568 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1569 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1570 (p (window-point window)) |
54538 | 1571 (buffer-read-only nil)) |
1572 (erase-buffer) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1573 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 1574 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1575 (set-window-start window start) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1576 (set-window-point window p))))) |
54538 | 1577 ;; put customisation here |
1578 (,custom-defun))) | |
1579 | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1580 (defmacro def-gdb-auto-updated-buffer (buffer-key |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1581 trigger-name gdb-command |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1582 output-handler-name custom-defun) |
54538 | 1583 `(progn |
1584 (def-gdb-auto-update-trigger ,trigger-name | |
1585 ;; The demand predicate: | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1586 (gdb-get-buffer ',buffer-key) |
54538 | 1587 ,gdb-command |
1588 ,output-handler-name) | |
1589 (def-gdb-auto-update-handler ,output-handler-name | |
1590 ,trigger-name ,buffer-key ,custom-defun))) | |
1591 | |
1592 | |
1593 ;; | |
1594 ;; Breakpoint buffer : This displays the output of `info breakpoints'. | |
1595 ;; | |
1596 (gdb-set-buffer-rules 'gdb-breakpoints-buffer | |
1597 'gdb-breakpoints-buffer-name | |
1598 'gdb-breakpoints-mode) | |
1599 | |
1600 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
1601 ;; This defines the auto update rule for buffers of type | |
1602 ;; `gdb-breakpoints-buffer'. | |
1603 ;; | |
1604 ;; It defines a function to serve as the annotation handler that | |
1605 ;; handles the `foo-invalidated' message. That function is called: | |
1606 gdb-invalidate-breakpoints | |
1607 ;; | |
1608 ;; To update the buffer, this command is sent to gdb. | |
1609 "server info breakpoints\n" | |
1610 ;; | |
1611 ;; This also defines a function to be the handler for the output | |
1612 ;; from the command above. That function will copy the output into | |
1613 ;; the appropriately typed buffer. That function will be called: | |
1614 gdb-info-breakpoints-handler | |
1615 ;; buffer specific functions | |
1616 gdb-info-breakpoints-custom) | |
1617 | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1618 (defconst breakpoint-xpm-data |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1619 "/* XPM */ |
54538 | 1620 static char *magick[] = { |
1621 /* columns rows colors chars-per-pixel */ | |
1622 \"10 10 2 1\", | |
1623 \" c red\", | |
1624 \"+ c None\", | |
1625 /* pixels */ | |
1626 \"+++ +++\", | |
1627 \"++ ++\", | |
1628 \"+ +\", | |
1629 \" \", | |
1630 \" \", | |
1631 \" \", | |
1632 \" \", | |
1633 \"+ +\", | |
1634 \"++ ++\", | |
1635 \"+++ +++\", | |
1636 };" | |
1637 "XPM data used for breakpoint icon.") | |
1638 | |
1639 (defconst breakpoint-enabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1640 "P1 |
54538 | 1641 10 10\", |
1642 0 0 0 0 1 1 1 1 0 0 0 0 | |
1643 0 0 0 1 1 1 1 1 1 0 0 0 | |
1644 0 0 1 1 1 1 1 1 1 1 0 0 | |
1645 0 1 1 1 1 1 1 1 1 1 1 0 | |
1646 0 1 1 1 1 1 1 1 1 1 1 0 | |
1647 0 1 1 1 1 1 1 1 1 1 1 0 | |
1648 0 1 1 1 1 1 1 1 1 1 1 0 | |
1649 0 0 1 1 1 1 1 1 1 1 0 0 | |
1650 0 0 0 1 1 1 1 1 1 0 0 0 | |
1651 0 0 0 0 1 1 1 1 0 0 0 0" | |
1652 "PBM data used for enabled breakpoint icon.") | |
1653 | |
1654 (defconst breakpoint-disabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1655 "P1 |
54538 | 1656 10 10\", |
1657 0 0 1 0 1 0 1 0 0 0 | |
1658 0 1 0 1 0 1 0 1 0 0 | |
1659 1 0 1 0 1 0 1 0 1 0 | |
1660 0 1 0 1 0 1 0 1 0 1 | |
1661 1 0 1 0 1 0 1 0 1 0 | |
1662 0 1 0 1 0 1 0 1 0 1 | |
1663 1 0 1 0 1 0 1 0 1 0 | |
1664 0 1 0 1 0 1 0 1 0 1 | |
1665 0 0 1 0 1 0 1 0 1 0 | |
1666 0 0 0 1 0 1 0 1 0 0" | |
1667 "PBM data used for disabled breakpoint icon.") | |
1668 | |
1669 (defvar breakpoint-enabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1670 "Icon for enabled breakpoint in display margin.") |
54538 | 1671 |
1672 (defvar breakpoint-disabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1673 "Icon for disabled breakpoint in display margin.") |
54538 | 1674 |
57982
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1675 (and (display-images-p) |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1676 ;; 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
|
1677 (define-fringe-bitmap 'breakpoint |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1678 "\x3c\x7e\xff\xff\xff\xff\x7e\x3c") |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1679 ;; Bitmap for gud-overlay-arrow in fringe |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1680 (define-fringe-bitmap 'hollow-right-triangle |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1681 "\xe0\x90\x88\x84\x84\x88\x90\xe0")) |
54538 | 1682 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1683 (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
|
1684 '((t |
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1685 :foreground "red" |
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1686 :weight bold)) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1687 "Face for enabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1688 :group 'gud) |
54538 | 1689 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1690 (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
|
1691 ;; 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
|
1692 ;; 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
|
1693 ;; if it has to be approximated. |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
1694 '((t :foreground "grey70")) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1695 "Face for disabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1696 :group 'gud) |
54538 | 1697 |
64654 | 1698 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). |
54538 | 1699 (defun gdb-info-breakpoints-custom () |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1700 (let ((flag) (bptno)) |
64654 | 1701 ;; Remove all breakpoint-icons in source buffers but not assembler buffer. |
54538 | 1702 (dolist (buffer (buffer-list)) |
1703 (with-current-buffer buffer | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1704 (if (and (memq gud-minor-mode '(gdba gdbmi)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1705 (not (string-match "\\`\\*.+\\*\\'" (buffer-name)))) |
54538 | 1706 (gdb-remove-breakpoint-icons (point-min) (point-max))))) |
1707 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) | |
1708 (save-excursion | |
1709 (goto-char (point-min)) | |
1710 (while (< (point) (- (point-max) 1)) | |
1711 (forward-line 1) | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
1712 (if (looking-at "[^\t].*?breakpoint") |
54538 | 1713 (progn |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1714 (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
|
1715 (setq bptno (match-string 1)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1716 (setq flag (char-after (match-beginning 2))) |
54538 | 1717 (beginning-of-line) |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1718 (if (re-search-forward " in \\(.*\\) at\\s-+" nil t) |
54538 | 1719 (progn |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1720 (let ((buffer-read-only nil)) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1721 (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
|
1722 '(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
|
1723 (looking-at "\\(\\S-+\\):\\([0-9]+\\)") |
54538 | 1724 (let ((line (match-string 2)) (buffer-read-only nil) |
1725 (file (match-string 1))) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
1726 (add-text-properties (line-beginning-position) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
1727 (line-end-position) |
54538 | 1728 '(mouse-face highlight |
1729 help-echo "mouse-2, RET: visit breakpoint")) | |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1730 (unless (file-exists-p file) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1731 (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
|
1732 (if (and file |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1733 (not (string-equal file "File not found"))) |
64654 | 1734 (with-current-buffer |
1735 (find-file-noselect file 'nowarn) | |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1736 (set (make-local-variable 'gud-minor-mode) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1737 'gdba) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1738 (set (make-local-variable 'tool-bar-map) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1739 gud-tool-bar-map) |
64654 | 1740 ;; Only want one breakpoint icon at each |
1741 ;; location. | |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1742 (save-excursion |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1743 (goto-line (string-to-number line)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1744 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1745 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1746 (list |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1747 (concat gdb-server-prefix "list " |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1748 (match-string-no-properties 1) ":1\n") |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1749 'ignore)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1750 (gdb-enqueue-input |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1751 (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
|
1752 `(lambda () (gdb-get-location |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
1753 ,bptno ,line ,flag)))))))))) |
54962
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1754 (end-of-line))))) |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1755 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) |
54538 | 1756 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1757 (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
|
1758 "Set/clear breakpoint in left fringe/margin with mouse click." |
54538 | 1759 (interactive "e") |
1760 (mouse-minibuffer-check event) | |
1761 (let ((posn (event-end event))) | |
1762 (if (numberp (posn-point posn)) | |
1763 (with-selected-window (posn-window posn) | |
1764 (save-excursion | |
1765 (goto-char (posn-point posn)) | |
1766 (if (or (posn-object posn) | |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
1767 (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
|
1768 'breakpoint)) |
54538 | 1769 (gud-remove nil) |
1770 (gud-break nil))))))) | |
1771 | |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1772 (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
|
1773 "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
|
1774 (interactive "e") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1775 (mouse-minibuffer-check event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1776 (let ((posn (event-end event))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1777 (if (numberp (posn-point posn)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1778 (with-selected-window (posn-window posn) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1779 (save-excursion |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1780 (goto-char (posn-point posn)) |
64654 | 1781 (if (posn-object posn) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1782 (gdb-enqueue-input |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1783 (list |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1784 (let ((bptno (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1785 0 'gdb-bptno (car (posn-string posn))))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1786 (concat gdb-server-prefix |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1787 (if (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1788 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
|
1789 "disable " |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1790 "enable ") |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1791 bptno "\n")) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1792 'ignore)))))))) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1793 |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1794 (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
|
1795 "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
|
1796 (interactive "e") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1797 (mouse-minibuffer-check event) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1798 (let* ((posn (event-end event)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1799 (pos (posn-point posn)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1800 obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1801 (when (numberp pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1802 (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
|
1803 (save-excursion |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1804 (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
|
1805 (goto-char pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1806 (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
|
1807 (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
|
1808 (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
|
1809 (when (stringp obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1810 (gdb-enqueue-input |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1811 (list |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1812 (concat gdb-server-prefix |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1813 (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
|
1814 "disable " |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1815 "enable ") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1816 (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
|
1817 'ignore)))))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1818 |
54538 | 1819 (defun gdb-breakpoints-buffer-name () |
1820 (with-current-buffer gud-comint-buffer | |
1821 (concat "*breakpoints of " (gdb-get-target-string) "*"))) | |
1822 | |
1823 (defun gdb-display-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1824 "Display status of user-settable breakpoints." |
54538 | 1825 (interactive) |
1826 (gdb-display-buffer | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1827 (gdb-get-buffer-create 'gdb-breakpoints-buffer))) |
54538 | 1828 |
1829 (defun gdb-frame-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1830 "Display status of user-settable breakpoints in a new frame." |
54538 | 1831 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1832 (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
|
1833 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1834 (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer)))) |
54538 | 1835 |
1836 (defvar gdb-breakpoints-mode-map | |
1837 (let ((map (make-sparse-keymap)) | |
1838 (menu (make-sparse-keymap "Breakpoints"))) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1839 (define-key menu [quit] '("Quit" . gdb-delete-frame-or-window)) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1840 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
54538 | 1841 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1842 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
54538 | 1843 (suppress-keymap map) |
1844 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) | |
1845 (define-key map " " 'gdb-toggle-breakpoint) | |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
1846 (define-key map "D" 'gdb-delete-breakpoint) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1847 ;; Don't bind "q" to kill-this-buffer as we need it for breakpoint icons. |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1848 (define-key map "q" 'gdb-delete-frame-or-window) |
54538 | 1849 (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
|
1850 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1851 (define-key map [follow-link] 'mouse-face) |
54538 | 1852 map)) |
1853 | |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1854 (defun gdb-delete-frame-or-window () |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1855 "Delete frame if there is only one window. Otherwise delete the window." |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1856 (interactive) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1857 (if (one-window-p) (delete-frame) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1858 (delete-window))) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1859 |
54538 | 1860 (defun gdb-breakpoints-mode () |
1861 "Major mode for gdb breakpoints. | |
1862 | |
1863 \\{gdb-breakpoints-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1864 (kill-all-local-variables) |
54538 | 1865 (setq major-mode 'gdb-breakpoints-mode) |
1866 (setq mode-name "Breakpoints") | |
1867 (use-local-map gdb-breakpoints-mode-map) | |
1868 (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
|
1869 (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
|
1870 (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
|
1871 'gdb-invalidate-breakpoints |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1872 'gdbmi-invalidate-breakpoints)) |
54538 | 1873 |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1874 (defconst gdb-breakpoint-regexp |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1875 "\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\s-+\\(.\\)\\s-+") |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1876 |
54538 | 1877 (defun gdb-toggle-breakpoint () |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1878 "Enable/disable breakpoint at current line." |
54538 | 1879 (interactive) |
1880 (save-excursion | |
1881 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1882 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1883 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1884 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1885 (concat gdb-server-prefix |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1886 (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
|
1887 "disable " |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1888 "enable ") |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1889 (match-string 1) "\n") 'ignore)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1890 (error "Not recognized as break/watchpoint line")))) |
54538 | 1891 |
1892 (defun gdb-delete-breakpoint () | |
1893 "Delete the breakpoint at current line." | |
1894 (interactive) | |
1895 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1896 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1897 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1898 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1899 (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
|
1900 (error "Not recognized as break/watchpoint line"))) |
54538 | 1901 |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1902 (defun gdb-goto-breakpoint (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1903 "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
|
1904 (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
|
1905 (if event (posn-set-point (event-end event))) |
54538 | 1906 (save-excursion |
1907 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1908 (if (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1909 (let ((bptno (match-string 1)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1910 (file (match-string 2)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
1911 (line (match-string 3))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1912 (save-selected-window |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1913 (let* ((buffer (find-file-noselect |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1914 (if (file-exists-p file) file |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1915 (cdr (assoc bptno gdb-location-alist))))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1916 (window (unless (gdb-display-source-buffer buffer) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1917 (display-buffer buffer)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1918 (setq gdb-source-window window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1919 (with-current-buffer buffer |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1920 (goto-line (string-to-number line)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1921 (set-window-point window (point)))))) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1922 (error "No location specified.")))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
1923 |
54538 | 1924 |
1925 ;; Frames buffer. This displays a perpetually correct bactracktrace | |
1926 ;; (from the command `where'). | |
1927 ;; | |
1928 ;; Alas, if your stack is deep, it is costly. | |
1929 ;; | |
1930 (gdb-set-buffer-rules 'gdb-stack-buffer | |
1931 'gdb-stack-buffer-name | |
1932 'gdb-frames-mode) | |
1933 | |
1934 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
1935 gdb-invalidate-frames | |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1936 "server info stack\n" |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1937 gdb-info-stack-handler |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1938 gdb-info-stack-custom) |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1939 |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1940 (defun gdb-info-stack-custom () |
54538 | 1941 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) |
1942 (save-excursion | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1943 (let ((buffer-read-only nil) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1944 bl el) |
54538 | 1945 (goto-char (point-min)) |
1946 (while (< (point) (point-max)) | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1947 (setq bl (line-beginning-position) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1948 el (line-end-position)) |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
1949 (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
|
1950 (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
|
1951 '(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
|
1952 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
|
1953 (goto-char bl) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
1954 (when (looking-at "^#\\([0-9]+\\)") |
65861
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1955 (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
|
1956 (put-text-property bl (+ bl 4) |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1957 'face '(:inverse-video t))) |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1958 (when (re-search-forward |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1959 (concat |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1960 (if (string-equal (match-string 1) "0") "" " in ") |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1961 "\\([^ ]+\\) (") el t) |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1962 (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
|
1963 'face font-lock-function-name-face) |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1964 (setq bl (match-end 0)) |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1965 (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
|
1966 (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
|
1967 'face font-lock-function-name-face)) |
65861
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1968 (goto-char bl) |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1969 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) |
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
1970 (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
|
1971 'face font-lock-variable-name-face)))) |
54538 | 1972 (forward-line 1)))))) |
1973 | |
1974 (defun gdb-stack-buffer-name () | |
1975 (with-current-buffer gud-comint-buffer | |
1976 (concat "*stack frames of " (gdb-get-target-string) "*"))) | |
1977 | |
1978 (defun gdb-display-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1979 "Display backtrace of current stack." |
54538 | 1980 (interactive) |
1981 (gdb-display-buffer | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1982 (gdb-get-buffer-create 'gdb-stack-buffer))) |
54538 | 1983 |
1984 (defun gdb-frame-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1985 "Display backtrace of current stack in a new frame." |
54538 | 1986 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1987 (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
|
1988 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1989 (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer)))) |
54538 | 1990 |
1991 (defvar gdb-frames-mode-map | |
1992 (let ((map (make-sparse-keymap))) | |
1993 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
1994 (define-key map "q" 'kill-this-buffer) |
54538 | 1995 (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
|
1996 (define-key map [mouse-2] 'gdb-frames-select) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1997 (define-key map [follow-link] 'mouse-face) |
54538 | 1998 map)) |
1999 | |
2000 (defun gdb-frames-mode () | |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2001 "Major mode for gdb call stack. |
54538 | 2002 |
2003 \\{gdb-frames-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2004 (kill-all-local-variables) |
54538 | 2005 (setq major-mode 'gdb-frames-mode) |
2006 (setq mode-name "Frames") | |
2007 (setq buffer-read-only t) | |
2008 (use-local-map gdb-frames-mode-map) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2009 (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
|
2010 (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
|
2011 'gdb-invalidate-frames |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2012 'gdbmi-invalidate-frames)) |
54538 | 2013 |
2014 (defun gdb-get-frame-number () | |
2015 (save-excursion | |
65861
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
2016 (end-of-line) |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
2017 (let* ((start (line-beginning-position)) |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
2018 (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) |
54538 | 2019 (n (or (and pos (match-string-no-properties 1)) "0"))) |
2020 n))) | |
2021 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2022 (defun gdb-frames-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2023 "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
|
2024 (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
|
2025 (if event (posn-set-point (event-end event))) |
54538 | 2026 (gdb-enqueue-input |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2027 (list (concat gdb-server-prefix "frame " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2028 (gdb-get-frame-number) "\n") 'ignore)) |
54538 | 2029 (gud-display-frame)) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2030 |
54538 | 2031 |
2032 ;; Threads buffer. This displays a selectable thread list. | |
2033 ;; | |
2034 (gdb-set-buffer-rules 'gdb-threads-buffer | |
2035 'gdb-threads-buffer-name | |
2036 'gdb-threads-mode) | |
2037 | |
2038 (def-gdb-auto-updated-buffer gdb-threads-buffer | |
2039 gdb-invalidate-threads | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2040 (concat gdb-server-prefix "info threads\n") |
54538 | 2041 gdb-info-threads-handler |
2042 gdb-info-threads-custom) | |
2043 | |
2044 (defun gdb-info-threads-custom () | |
2045 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | |
2046 (let ((buffer-read-only nil)) | |
2047 (goto-char (point-min)) | |
2048 (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
|
2049 (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
|
2050 (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
|
2051 '(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
|
2052 help-echo "mouse-2, RET: select thread"))) |
54538 | 2053 (forward-line 1))))) |
2054 | |
2055 (defun gdb-threads-buffer-name () | |
2056 (with-current-buffer gud-comint-buffer | |
2057 (concat "*threads of " (gdb-get-target-string) "*"))) | |
2058 | |
2059 (defun gdb-display-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2060 "Display IDs of currently known threads." |
54538 | 2061 (interactive) |
2062 (gdb-display-buffer | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2063 (gdb-get-buffer-create 'gdb-threads-buffer))) |
54538 | 2064 |
2065 (defun gdb-frame-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2066 "Display IDs of currently known threads in a new frame." |
54538 | 2067 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2068 (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
|
2069 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2070 (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer)))) |
54538 | 2071 |
2072 (defvar gdb-threads-mode-map | |
2073 (let ((map (make-sparse-keymap))) | |
2074 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2075 (define-key map "q" 'kill-this-buffer) |
54538 | 2076 (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
|
2077 (define-key map [mouse-2] 'gdb-threads-select) |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
2078 (define-key map [follow-link] 'mouse-face) |
54538 | 2079 map)) |
2080 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2081 (defvar gdb-threads-font-lock-keywords |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2082 '((") +\\([^ ]+\\) (" (1 font-lock-function-name-face)) |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2083 ("in \\([^ ]+\\) (" (1 font-lock-function-name-face)) |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2084 ("\\(\\(\\sw\\|[_.]\\)+\\)=" (1 font-lock-variable-name-face))) |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2085 "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
|
2086 |
54538 | 2087 (defun gdb-threads-mode () |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2088 "Major mode for gdb threads. |
54538 | 2089 |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2090 \\{gdb-threads-mode-map}" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2091 (kill-all-local-variables) |
54538 | 2092 (setq major-mode 'gdb-threads-mode) |
2093 (setq mode-name "Threads") | |
2094 (setq buffer-read-only t) | |
2095 (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
|
2096 (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
|
2097 '(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
|
2098 (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
|
2099 'gdb-invalidate-threads) |
54538 | 2100 |
2101 (defun gdb-get-thread-number () | |
2102 (save-excursion | |
2103 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) | |
2104 (match-string-no-properties 1))) | |
2105 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2106 (defun gdb-threads-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2107 "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
|
2108 (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
|
2109 (if event (posn-set-point (event-end event))) |
54538 | 2110 (gdb-enqueue-input |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2111 (list (concat gdb-server-prefix "thread " |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2112 (gdb-get-thread-number) "\n") 'ignore)) |
54538 | 2113 (gud-display-frame)) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2114 |
54538 | 2115 |
2116 ;; Registers buffer. | |
2117 ;; | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2118 (defcustom gdb-all-registers nil |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2119 "Non-nil means include floating-point registers." |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2120 :type 'boolean |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2121 :group 'gud |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2122 :version "22.1") |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2123 |
54538 | 2124 (gdb-set-buffer-rules 'gdb-registers-buffer |
2125 'gdb-registers-buffer-name | |
2126 'gdb-registers-mode) | |
2127 | |
2128 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
2129 gdb-invalidate-registers | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2130 (concat |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2131 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n") |
54538 | 2132 gdb-info-registers-handler |
2133 gdb-info-registers-custom) | |
2134 | |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2135 (defun gdb-info-registers-custom () |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2136 (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
|
2137 (save-excursion |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2138 (let ((buffer-read-only nil) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2139 start end) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2140 (goto-char (point-min)) |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2141 (while (< (point) (point-max)) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2142 (setq start (line-beginning-position)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2143 (setq end (line-end-position)) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2144 (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
|
2145 (unless (string-equal (match-string 0) "The") |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2146 (put-text-property start (match-end 0) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2147 'face font-lock-variable-name-face) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
2148 (add-text-properties start end |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2149 '(help-echo "mouse-2: edit value" |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2150 mouse-face highlight)))) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2151 (forward-line 1)))))) |
54538 | 2152 |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2153 (defun gdb-edit-register-value (&optional event) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2154 (interactive (list last-input-event)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2155 (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
|
2156 (if event (posn-set-point (event-end event))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2157 (beginning-of-line) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2158 (let* ((register (current-word)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2159 (value (read-string (format "New value (%s): " register)))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2160 (gdb-enqueue-input |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2161 (list (concat gdb-server-prefix "set $" register "=" value "\n") |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2162 'ignore))))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2163 |
54538 | 2164 (defvar gdb-registers-mode-map |
2165 (let ((map (make-sparse-keymap))) | |
2166 (suppress-keymap map) | |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2167 (define-key map "\r" 'gdb-edit-register-value) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2168 (define-key map [mouse-2] 'gdb-edit-register-value) |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
2169 (define-key map " " 'gdb-all-registers) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2170 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2171 map)) |
54538 | 2172 |
2173 (defun gdb-registers-mode () | |
2174 "Major mode for gdb registers. | |
2175 | |
2176 \\{gdb-registers-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2177 (kill-all-local-variables) |
54538 | 2178 (setq major-mode 'gdb-registers-mode) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2179 (setq mode-name "Registers") |
54538 | 2180 (setq buffer-read-only t) |
2181 (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
|
2182 (run-mode-hooks 'gdb-registers-mode-hook) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2183 (if (string-equal gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2184 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2185 (if gdb-all-registers (setq mode-name "Registers:All")) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2186 'gdb-invalidate-registers) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2187 'gdb-invalidate-registers-1)) |
54538 | 2188 |
2189 (defun gdb-registers-buffer-name () | |
2190 (with-current-buffer gud-comint-buffer | |
2191 (concat "*registers of " (gdb-get-target-string) "*"))) | |
2192 | |
2193 (defun gdb-display-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2194 "Display integer register contents." |
54538 | 2195 (interactive) |
2196 (gdb-display-buffer | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2197 (gdb-get-buffer-create 'gdb-registers-buffer))) |
54538 | 2198 |
2199 (defun gdb-frame-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2200 "Display integer register contents in a new frame." |
54538 | 2201 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2202 (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
|
2203 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2204 (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer)))) |
59808 | 2205 |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
2206 (defun gdb-all-registers () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2207 "Toggle the display of floating-point registers (pre GDB 6.4 only)." |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2208 (interactive) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2209 (when (string-equal gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2210 (if gdb-all-registers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2211 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2212 (setq gdb-all-registers nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2213 (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2214 (setq mode-name "Registers"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2215 (setq gdb-all-registers t) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2216 (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2217 (setq mode-name "Registers:All"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2218 (message (format "Display of floating-point registers %sabled" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2219 (if gdb-all-registers "en" "dis"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2220 (gdb-invalidate-registers))) |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2221 |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2222 |
59808 | 2223 ;; Memory buffer. |
2224 ;; | |
2225 (defcustom gdb-memory-repeat-count 32 | |
2226 "Number of data items in memory window." | |
2227 :type 'integer | |
2228 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2229 :version "22.1") |
59808 | 2230 |
2231 (defcustom gdb-memory-format "x" | |
2232 "Display format of data items in memory window." | |
2233 :type '(choice (const :tag "Hexadecimal" "x") | |
2234 (const :tag "Signed decimal" "d") | |
2235 (const :tag "Unsigned decimal" "u") | |
2236 (const :tag "Octal" "o") | |
2237 (const :tag "Binary" "t")) | |
2238 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2239 :version "22.1") |
59808 | 2240 |
2241 (defcustom gdb-memory-unit "w" | |
2242 "Unit size of data items in memory window." | |
2243 :type '(choice (const :tag "Byte" "b") | |
2244 (const :tag "Halfword" "h") | |
2245 (const :tag "Word" "w") | |
2246 (const :tag "Giant word" "g")) | |
2247 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2248 :version "22.1") |
59808 | 2249 |
2250 (gdb-set-buffer-rules 'gdb-memory-buffer | |
2251 'gdb-memory-buffer-name | |
2252 'gdb-memory-mode) | |
2253 | |
2254 (def-gdb-auto-updated-buffer gdb-memory-buffer | |
2255 gdb-invalidate-memory | |
2256 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count) | |
2257 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n") | |
2258 gdb-read-memory-handler | |
2259 gdb-read-memory-custom) | |
2260 | |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2261 (defun gdb-read-memory-custom () |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2262 (save-excursion |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2263 (goto-char (point-min)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2264 (if (looking-at "0x[[:xdigit:]]+") |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2265 (setq gdb-memory-address (match-string 0))))) |
59808 | 2266 |
2267 (defvar gdb-memory-mode-map | |
2268 (let ((map (make-sparse-keymap))) | |
2269 (suppress-keymap map) | |
2270 (define-key map "q" 'kill-this-buffer) | |
2271 map)) | |
2272 | |
2273 (defun gdb-memory-set-address (event) | |
2274 "Set the start memory address." | |
2275 (interactive "e") | |
2276 (save-selected-window | |
2277 (select-window (posn-window (event-start event))) | |
2278 (let ((arg (read-from-minibuffer "Memory address: "))) | |
2279 (setq gdb-memory-address arg)) | |
2280 (gdb-invalidate-memory))) | |
2281 | |
2282 (defun gdb-memory-set-repeat-count (event) | |
2283 "Set the number of data items in memory window." | |
2284 (interactive "e") | |
2285 (save-selected-window | |
2286 (select-window (posn-window (event-start event))) | |
2287 (let* ((arg (read-from-minibuffer "Repeat count: ")) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2288 (count (string-to-number arg))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2289 (if (<= count 0) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2290 (error "Positive numbers only") |
59808 | 2291 (customize-set-variable 'gdb-memory-repeat-count count) |
2292 (gdb-invalidate-memory))))) | |
2293 | |
2294 (defun gdb-memory-format-binary () | |
2295 "Set the display format to binary." | |
2296 (interactive) | |
2297 (customize-set-variable 'gdb-memory-format "t") | |
2298 (gdb-invalidate-memory)) | |
2299 | |
2300 (defun gdb-memory-format-octal () | |
2301 "Set the display format to octal." | |
2302 (interactive) | |
2303 (customize-set-variable 'gdb-memory-format "o") | |
2304 (gdb-invalidate-memory)) | |
2305 | |
2306 (defun gdb-memory-format-unsigned () | |
2307 "Set the display format to unsigned decimal." | |
2308 (interactive) | |
2309 (customize-set-variable 'gdb-memory-format "u") | |
2310 (gdb-invalidate-memory)) | |
2311 | |
2312 (defun gdb-memory-format-signed () | |
2313 "Set the display format to decimal." | |
2314 (interactive) | |
2315 (customize-set-variable 'gdb-memory-format "d") | |
2316 (gdb-invalidate-memory)) | |
2317 | |
2318 (defun gdb-memory-format-hexadecimal () | |
2319 "Set the display format to hexadecimal." | |
2320 (interactive) | |
2321 (customize-set-variable 'gdb-memory-format "x") | |
2322 (gdb-invalidate-memory)) | |
2323 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2324 (defvar gdb-memory-format-map |
59808 | 2325 (let ((map (make-sparse-keymap))) |
2326 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) | |
2327 map) | |
2328 "Keymap to select format in the header line.") | |
2329 | |
2330 (defvar gdb-memory-format-menu (make-sparse-keymap "Format") | |
2331 "Menu of display formats in the header line.") | |
2332 | |
2333 (define-key gdb-memory-format-menu [binary] | |
2334 '(menu-item "Binary" gdb-memory-format-binary | |
2335 :button (:radio . (equal gdb-memory-format "t")))) | |
2336 (define-key gdb-memory-format-menu [octal] | |
2337 '(menu-item "Octal" gdb-memory-format-octal | |
2338 :button (:radio . (equal gdb-memory-format "o")))) | |
2339 (define-key gdb-memory-format-menu [unsigned] | |
2340 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned | |
2341 :button (:radio . (equal gdb-memory-format "u")))) | |
2342 (define-key gdb-memory-format-menu [signed] | |
2343 '(menu-item "Signed Decimal" gdb-memory-format-signed | |
2344 :button (:radio . (equal gdb-memory-format "d")))) | |
2345 (define-key gdb-memory-format-menu [hexadecimal] | |
2346 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal | |
2347 :button (:radio . (equal gdb-memory-format "x")))) | |
2348 | |
2349 (defun gdb-memory-format-menu (event) | |
2350 (interactive "@e") | |
2351 (x-popup-menu event gdb-memory-format-menu)) | |
2352 | |
2353 (defun gdb-memory-format-menu-1 (event) | |
2354 (interactive "e") | |
2355 (save-selected-window | |
2356 (select-window (posn-window (event-start event))) | |
2357 (let* ((selection (gdb-memory-format-menu event)) | |
2358 (binding (and selection (lookup-key gdb-memory-format-menu | |
2359 (vector (car selection)))))) | |
2360 (if binding (call-interactively binding))))) | |
2361 | |
2362 (defun gdb-memory-unit-giant () | |
2363 "Set the unit size to giant words (eight bytes)." | |
2364 (interactive) | |
2365 (customize-set-variable 'gdb-memory-unit "g") | |
2366 (gdb-invalidate-memory)) | |
2367 | |
2368 (defun gdb-memory-unit-word () | |
2369 "Set the unit size to words (four bytes)." | |
2370 (interactive) | |
2371 (customize-set-variable 'gdb-memory-unit "w") | |
2372 (gdb-invalidate-memory)) | |
2373 | |
2374 (defun gdb-memory-unit-halfword () | |
2375 "Set the unit size to halfwords (two bytes)." | |
2376 (interactive) | |
2377 (customize-set-variable 'gdb-memory-unit "h") | |
2378 (gdb-invalidate-memory)) | |
2379 | |
2380 (defun gdb-memory-unit-byte () | |
2381 "Set the unit size to bytes." | |
2382 (interactive) | |
2383 (customize-set-variable 'gdb-memory-unit "b") | |
2384 (gdb-invalidate-memory)) | |
2385 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2386 (defvar gdb-memory-unit-map |
59808 | 2387 (let ((map (make-sparse-keymap))) |
2388 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) | |
2389 map) | |
2390 "Keymap to select units in the header line.") | |
2391 | |
2392 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit") | |
2393 "Menu of units in the header line.") | |
2394 | |
2395 (define-key gdb-memory-unit-menu [giantwords] | |
2396 '(menu-item "Giant words" gdb-memory-unit-giant | |
2397 :button (:radio . (equal gdb-memory-unit "g")))) | |
2398 (define-key gdb-memory-unit-menu [words] | |
2399 '(menu-item "Words" gdb-memory-unit-word | |
2400 :button (:radio . (equal gdb-memory-unit "w")))) | |
2401 (define-key gdb-memory-unit-menu [halfwords] | |
2402 '(menu-item "Halfwords" gdb-memory-unit-halfword | |
2403 :button (:radio . (equal gdb-memory-unit "h")))) | |
2404 (define-key gdb-memory-unit-menu [bytes] | |
2405 '(menu-item "Bytes" gdb-memory-unit-byte | |
2406 :button (:radio . (equal gdb-memory-unit "b")))) | |
2407 | |
2408 (defun gdb-memory-unit-menu (event) | |
2409 (interactive "@e") | |
2410 (x-popup-menu event gdb-memory-unit-menu)) | |
2411 | |
2412 (defun gdb-memory-unit-menu-1 (event) | |
2413 (interactive "e") | |
2414 (save-selected-window | |
2415 (select-window (posn-window (event-start event))) | |
2416 (let* ((selection (gdb-memory-unit-menu event)) | |
2417 (binding (and selection (lookup-key gdb-memory-unit-menu | |
2418 (vector (car selection)))))) | |
2419 (if binding (call-interactively binding))))) | |
2420 | |
2421 ;;from make-mode-line-mouse-map | |
2422 (defun gdb-make-header-line-mouse-map (mouse function) "\ | |
2423 Return a keymap with single entry for mouse key MOUSE on the header line. | |
2424 MOUSE is defined to run function FUNCTION with no args in the buffer | |
2425 corresponding to the mode line clicked." | |
2426 (let ((map (make-sparse-keymap))) | |
2427 (define-key map (vector 'header-line mouse) function) | |
2428 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) | |
2429 map)) | |
2430 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2431 (defvar gdb-memory-font-lock-keywords |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2432 '(;; <__function.name+n> |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2433 ("<\\(\\(\\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
|
2434 ) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2435 "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
|
2436 |
59808 | 2437 (defun gdb-memory-mode () |
2438 "Major mode for examining memory. | |
2439 | |
2440 \\{gdb-memory-mode-map}" | |
2441 (kill-all-local-variables) | |
2442 (setq major-mode 'gdb-memory-mode) | |
2443 (setq mode-name "Memory") | |
2444 (setq buffer-read-only t) | |
2445 (use-local-map gdb-memory-mode-map) | |
2446 (setq header-line-format | |
2447 '(:eval | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2448 (concat |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2449 "Read address[" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2450 (propertize |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2451 "-" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2452 'face font-lock-warning-face |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2453 'help-echo "mouse-1: Decrement address" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2454 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2455 'local-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2456 (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2457 'mouse-1 |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2458 #'(lambda () (interactive) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2459 (let ((gdb-memory-address |
64654 | 2460 ;; Let GDB do the arithmetic. |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2461 (concat |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2462 gdb-memory-address " - " |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2463 (number-to-string |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2464 (* gdb-memory-repeat-count |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2465 (cond ((string= gdb-memory-unit "b") 1) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2466 ((string= gdb-memory-unit "h") 2) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2467 ((string= gdb-memory-unit "w") 4) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2468 ((string= gdb-memory-unit "g") 8))))))) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2469 (gdb-invalidate-memory))))) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2470 "|" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2471 (propertize "+" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2472 'face font-lock-warning-face |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2473 'help-echo "mouse-1: Increment address" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2474 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2475 'local-map (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2476 'mouse-1 |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2477 #'(lambda () (interactive) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2478 (let ((gdb-memory-address nil)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2479 (gdb-invalidate-memory))))) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2480 "]: " |
59808 | 2481 (propertize gdb-memory-address |
2482 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2483 'help-echo "mouse-1: Set memory address" |
62716 | 2484 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2485 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2486 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2487 #'gdb-memory-set-address)) |
59808 | 2488 " Repeat Count: " |
2489 (propertize (number-to-string gdb-memory-repeat-count) | |
2490 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2491 'help-echo "mouse-1: Set repeat count" |
62716 | 2492 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2493 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2494 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2495 #'gdb-memory-set-repeat-count)) |
59808 | 2496 " Display Format: " |
2497 (propertize gdb-memory-format | |
2498 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2499 'help-echo "mouse-3: Select display format" |
62716 | 2500 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2501 'local-map gdb-memory-format-map) |
59808 | 2502 " Unit Size: " |
2503 (propertize gdb-memory-unit | |
2504 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2505 'help-echo "mouse-3: Select unit size" |
62716 | 2506 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2507 'local-map gdb-memory-unit-map)))) |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2508 (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
|
2509 '(gdb-memory-font-lock-keywords)) |
59808 | 2510 (run-mode-hooks 'gdb-memory-mode-hook) |
2511 'gdb-invalidate-memory) | |
2512 | |
2513 (defun gdb-memory-buffer-name () | |
2514 (with-current-buffer gud-comint-buffer | |
2515 (concat "*memory of " (gdb-get-target-string) "*"))) | |
2516 | |
2517 (defun gdb-display-memory-buffer () | |
2518 "Display memory contents." | |
2519 (interactive) | |
2520 (gdb-display-buffer | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2521 (gdb-get-buffer-create 'gdb-memory-buffer))) |
59808 | 2522 |
2523 (defun gdb-frame-memory-buffer () | |
2524 "Display memory contents in a new frame." | |
2525 (interactive) | |
2526 (let ((special-display-regexps (append special-display-regexps '(".*"))) | |
2527 (special-display-frame-alist gdb-frame-parameters)) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2528 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) |
54538 | 2529 |
59808 | 2530 |
54538 | 2531 ;; Locals buffer. |
2532 ;; | |
2533 (gdb-set-buffer-rules 'gdb-locals-buffer | |
2534 'gdb-locals-buffer-name | |
2535 'gdb-locals-mode) | |
2536 | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2537 (def-gdb-auto-update-trigger gdb-invalidate-locals |
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2538 (gdb-get-buffer 'gdb-locals-buffer) |
54538 | 2539 "server info locals\n" |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2540 gdb-info-locals-handler) |
54538 | 2541 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2542 (defvar gdb-locals-watch-map |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2543 (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
|
2544 (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
|
2545 (beginning-of-line) |
251a74c1f668
(gdb-locals-watch-keymap): Add "\r" binding to local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
67072
diff
changeset
|
2546 (gud-watch))) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2547 (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
|
2548 (mouse-set-point event) |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2549 (beginning-of-line) |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2550 (gud-watch))) |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2551 map) |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2552 "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
|
2553 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2554 (defconst gdb-struct-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2555 (concat (propertize "[struct/union]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2556 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2557 'help-echo "mouse-2: create watch expression" |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2558 'local-map gdb-locals-watch-map) "\n")) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2559 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2560 (defconst gdb-array-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2561 (concat " " (propertize "[array]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2562 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2563 'help-echo "mouse-2: create watch expression" |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2564 'local-map gdb-locals-watch-map) "\n")) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2565 |
54538 | 2566 ;; Abbreviate for arrays and structures. |
2567 ;; 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
|
2568 (defun gdb-info-locals-handler () |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2569 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2570 gdb-pending-triggers)) |
54538 | 2571 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer))) |
2572 (with-current-buffer buf | |
2573 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2574 (while (re-search-forward "^[ }].*\n" nil t) |
54538 | 2575 (replace-match "" nil nil)) |
2576 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2577 (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
|
2578 (replace-match gdb-struct-string nil nil)) |
54538 | 2579 (goto-char (point-min)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2580 (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
|
2581 (replace-match gdb-array-string nil nil)))) |
54538 | 2582 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2583 (and buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2584 (with-current-buffer buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2585 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2586 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2587 (p (window-point window)) |
54538 | 2588 (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
|
2589 (erase-buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2590 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 2591 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2592 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2593 (set-window-point window p)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2594 ))) |
54538 | 2595 (run-hooks 'gdb-info-locals-hook)) |
2596 | |
2597 (defvar gdb-locals-mode-map | |
2598 (let ((map (make-sparse-keymap))) | |
2599 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2600 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2601 map)) |
54538 | 2602 |
2603 (defun gdb-locals-mode () | |
2604 "Major mode for gdb locals. | |
2605 | |
2606 \\{gdb-locals-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2607 (kill-all-local-variables) |
54538 | 2608 (setq major-mode 'gdb-locals-mode) |
62716 | 2609 (setq mode-name (concat "Locals:" gdb-selected-frame)) |
54538 | 2610 (setq buffer-read-only t) |
2611 (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
|
2612 (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
|
2613 '(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
|
2614 (run-mode-hooks 'gdb-locals-mode-hook) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2615 (if (and (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2616 (string-equal gdb-version "pre-6.4")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2617 'gdb-invalidate-locals |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2618 'gdb-invalidate-locals-1)) |
54538 | 2619 |
2620 (defun gdb-locals-buffer-name () | |
2621 (with-current-buffer gud-comint-buffer | |
2622 (concat "*locals of " (gdb-get-target-string) "*"))) | |
2623 | |
2624 (defun gdb-display-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2625 "Display local variables of current stack and their values." |
54538 | 2626 (interactive) |
2627 (gdb-display-buffer | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2628 (gdb-get-buffer-create 'gdb-locals-buffer))) |
54538 | 2629 |
2630 (defun gdb-frame-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2631 "Display local variables of current stack and their values in a new frame." |
54538 | 2632 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2633 (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
|
2634 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2635 (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer)))) |
54538 | 2636 |
2637 | |
2638 ;;;; Window management | |
2639 (defun gdb-display-buffer (buf &optional size) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2640 (let ((answer (get-buffer-window buf 0)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2641 (must-split nil)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2642 (if answer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2643 (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
|
2644 ;; The buffer is not yet displayed. |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2645 (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
|
2646 (let ((window (get-lru-window))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2647 (if (and window |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2648 (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
|
2649 (progn |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2650 (set-window-buffer window buf) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2651 (setq answer window)) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2652 (setq must-split t))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2653 (if must-split |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2654 (let* ((largest (get-largest-window)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2655 (cur-size (window-height largest)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2656 (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
|
2657 (setq answer (split-window largest new-size)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2658 (set-window-buffer answer buf) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2659 (set-window-dedicated-p answer t))) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2660 answer))) |
54538 | 2661 |
2662 | |
2663 ;;; Shared keymap initialization: | |
2664 | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2665 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2666 (define-key gud-menu-map [displays] |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2667 `(menu-item "GDB-Windows" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2668 :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
|
2669 (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
|
2670 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2671 (define-key menu [inferior] |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2672 '(menu-item "Inferior IO" gdb-display-separate-io-buffer |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2673 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2674 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2675 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2676 (define-key menu [disassembly] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2677 '("Disassembly" . gdb-display-assembler-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2678 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2679 '("Breakpoints" . gdb-display-breakpoints-buffer)) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2680 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2681 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer))) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2682 |
54538 | 2683 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
2684 (define-key gud-menu-map [frames] | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2685 `(menu-item "GDB-Frames" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2686 :visible (memq gud-minor-mode '(gdbmi gdba)))) |
54538 | 2687 (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
|
2688 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
59808 | 2689 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2690 (define-key menu [inferior] |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2691 '(menu-item "Inferior IO" gdb-frame-separate-io-buffer |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2692 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2693 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2694 (define-key menu [disassembly] '("Disassembiy" . gdb-frame-assembler-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2695 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2696 '("Breakpoints" . gdb-frame-breakpoints-buffer)) |
54538 | 2697 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2698 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))) |
54538 | 2699 |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
2700 (let ((menu (make-sparse-keymap "GDB-UI/MI"))) |
54538 | 2701 (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
|
2702 `(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
|
2703 ,menu :visible (memq gud-minor-mode '(gdbmi gdba)))) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2704 (define-key menu [gdb-use-separate-io] |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2705 '(menu-item "Separate inferior IO" gdb-use-separate-io-buffer |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
2706 :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
|
2707 :help "Toggle separate IO for inferior." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2708 :button (:toggle . gdb-use-separate-io-buffer))) |
54538 | 2709 (define-key menu [gdb-many-windows] |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2710 '(menu-item "Display Other Windows" gdb-many-windows |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2711 :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
|
2712 :button (:toggle . gdb-many-windows))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2713 (define-key menu [gdb-restore-windows] |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2714 '(menu-item "Restore Window Layout" gdb-restore-windows |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2715 :help "Restore standard layout for debug session."))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2716 |
54538 | 2717 (defun gdb-frame-gdb-buffer () |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2718 "Display GUD buffer in a new frame." |
54538 | 2719 (interactive) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2720 (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
|
2721 (special-display-frame-alist gdb-frame-parameters) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2722 (same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2723 (display-buffer gud-comint-buffer))) |
54538 | 2724 |
2725 (defun gdb-display-gdb-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2726 "Display GUD buffer." |
54538 | 2727 (interactive) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2728 (let ((same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2729 (pop-to-buffer gud-comint-buffer))) |
54538 | 2730 |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2731 (defun gdb-set-window-buffer (name) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2732 (set-window-buffer (selected-window) (get-buffer name)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2733 (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
|
2734 |
54538 | 2735 (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
|
2736 "Layout the window pattern for `gdb-many-windows'." |
54538 | 2737 (gdb-display-locals-buffer) |
2738 (gdb-display-stack-buffer) | |
2739 (delete-other-windows) | |
2740 (gdb-display-breakpoints-buffer) | |
2741 (delete-other-windows) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2742 ; Don't dedicate. |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2743 (pop-to-buffer gud-comint-buffer) |
54538 | 2744 (split-window nil ( / ( * (window-height) 3) 4)) |
2745 (split-window nil ( / (window-height) 3)) | |
2746 (split-window-horizontally) | |
2747 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2748 (gdb-set-window-buffer (gdb-locals-buffer-name)) |
54538 | 2749 (other-window 1) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2750 (switch-to-buffer |
54538 | 2751 (if gud-last-last-frame |
2752 (gud-find-file (car gud-last-last-frame)) | |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
2753 (if gdb-main-file |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
2754 (gud-find-file gdb-main-file) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
2755 ;; Put buffer list in window if we |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
2756 ;; can't find a source file. |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
2757 (list-buffers-noselect)))) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2758 (when gdb-use-separate-io-buffer |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
2759 (split-window-horizontally) |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
2760 (other-window 1) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2761 (gdb-set-window-buffer |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2762 (gdb-get-buffer-create 'gdb-inferior-io))) |
54538 | 2763 (other-window 1) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2764 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
54538 | 2765 (split-window-horizontally) |
2766 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2767 (gdb-set-window-buffer (gdb-breakpoints-buffer-name)) |
54538 | 2768 (other-window 1)) |
2769 | |
2770 (defun gdb-restore-windows () | |
2771 "Restore the basic arrangement of windows used by gdba. | |
2772 This arrangement depends on the value of `gdb-many-windows'." | |
2773 (interactive) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2774 (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
|
2775 (delete-other-windows) |
54538 | 2776 (if gdb-many-windows |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2777 (gdb-setup-windows) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2778 (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
|
2779 (split-window) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2780 (other-window 1) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2781 (switch-to-buffer |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2782 (if gud-last-last-frame |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2783 (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
|
2784 (gud-find-file gdb-main-file))) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2785 (other-window 1)))) |
54538 | 2786 |
2787 (defun gdb-reset () | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2788 "Exit a debugging session cleanly. |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
2789 Kills the gdb buffers, and resets variables and the source buffers." |
54538 | 2790 (dolist (buffer (buffer-list)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2791 (unless (eq buffer gud-comint-buffer) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2792 (with-current-buffer buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2793 (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
|
2794 (if (string-match "\\`\\*.+\\*\\'" (buffer-name)) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2795 (kill-buffer nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2796 (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
|
2797 (setq gud-minor-mode nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2798 (kill-local-variable 'tool-bar-map) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2799 (kill-local-variable 'gdb-define-alist)))))) |
54538 | 2800 (when (markerp gdb-overlay-arrow-position) |
2801 (move-marker gdb-overlay-arrow-position nil) | |
2802 (setq gdb-overlay-arrow-position nil)) | |
2803 (setq overlay-arrow-variable-list | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2804 (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list)) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
2805 (setq fringe-indicator-alist '((overlay-arrow . right-triangle))) |
69000
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
2806 (if (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
2807 (speedbar-refresh)) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2808 (setq gud-running nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2809 (setq gdb-active-process nil) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2810 (setq gdb-var-list nil) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2811 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) |
54538 | 2812 |
2813 (defun gdb-source-info () | |
2814 "Find the source file where the program starts and displays it with related | |
2815 buffers." | |
2816 (goto-char (point-min)) | |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2817 (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
|
2818 (looking-at "\\S-+")) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2819 (setq gdb-main-file (match-string 0))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2820 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2821 (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
|
2822 (setq gdb-macro-info t)) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2823 (if gdb-many-windows |
54538 | 2824 (gdb-setup-windows) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2825 (gdb-get-buffer-create 'gdb-breakpoints-buffer) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2826 (if gdb-show-main |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2827 (let ((pop-up-windows t)) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2828 (display-buffer (gud-find-file gdb-main-file)))))) |
54538 | 2829 |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2830 (defun gdb-get-location (bptno line flag) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2831 "Find the directory containing the relevant source file. |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2832 Put in buffer and place breakpoint icon." |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2833 (goto-char (point-min)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2834 (catch 'file-not-found |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2835 (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
|
2836 (when (looking-at "\\S-+") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2837 (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
|
2838 (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
|
2839 (gdb-resync) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2840 (unless (assoc bptno gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2841 (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
|
2842 (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
|
2843 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
|
2844 (throw 'file-not-found nil)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2845 (with-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2846 (find-file-noselect (match-string 0)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2847 (save-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2848 (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
|
2849 (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
|
2850 ;; 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
|
2851 (save-excursion |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2852 (goto-line (string-to-number line)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2853 (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
|
2854 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2855 (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
|
2856 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2857 (defun gdb-find-file-hook () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2858 "Set up buffer for debugging if file is part of the source code |
63033
bd3ecd5ebdff
(gdb-info-locals-handler): Use window point to preserve point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62936
diff
changeset
|
2859 of the current session." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2860 (if (and (buffer-name gud-comint-buffer) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2861 ;; 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
|
2862 gud-comint-buffer |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2863 (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2864 '(gdba gdbmi))) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
2865 (if (member buffer-file-name gdb-source-file-list) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
2866 (with-current-buffer (find-buffer-visiting buffer-file-name) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2867 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2868 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
2869 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map))))) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2870 |
54538 | 2871 ;;from put-image |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2872 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) |
54538 | 2873 "Put string PUTSTRING in front of POS in the current buffer. |
2874 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
|
2875 `before-string' string that has a `display' property whose value is |
54538 | 2876 PUTSTRING." |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2877 (let ((string (make-string 1 ?x)) |
54538 | 2878 (buffer (current-buffer))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2879 (setq putstring (copy-sequence putstring)) |
54538 | 2880 (let ((overlay (make-overlay pos pos buffer)) |
2881 (prop (or dprop | |
2882 (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
|
2883 (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
|
2884 (if sprops |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2885 (add-text-properties 0 1 sprops string)) |
54538 | 2886 (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
|
2887 (overlay-put overlay 'before-string string)))) |
54538 | 2888 |
2889 ;;from remove-images | |
2890 (defun gdb-remove-strings (start end &optional buffer) | |
2891 "Remove strings between START and END in BUFFER. | |
2892 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. | |
2893 BUFFER nil or omitted means use the current buffer." | |
2894 (unless buffer | |
2895 (setq buffer (current-buffer))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2896 (dolist (overlay (overlays-in start end)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2897 (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
|
2898 (delete-overlay overlay)))) |
54538 | 2899 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2900 (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
|
2901 (let ((start (- (line-beginning-position) 1)) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2902 (end (+ (line-end-position) 1)) |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
2903 (putstring (if enabled "B" "b")) |
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
2904 (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
|
2905 (add-text-properties |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
2906 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
|
2907 putstring) |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2908 (if enabled |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2909 (add-text-properties |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2910 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
|
2911 (add-text-properties |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2912 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) |
54538 | 2913 (gdb-remove-breakpoint-icons start end) |
2914 (if (display-images-p) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
2915 (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
|
2916 (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
|
2917 gdb-buffer-fringe-width) 8) |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
2918 (gdb-put-string |
54538 | 2919 nil (1+ start) |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
2920 `(left-fringe breakpoint |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2921 ,(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
|
2922 'breakpoint-enabled |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2923 'breakpoint-disabled)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2924 'gdb-bptno bptno |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2925 'gdb-enabled enabled) |
54538 | 2926 (when (< left-margin-width 2) |
2927 (save-current-buffer | |
2928 (setq left-margin-width 2) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
2929 (if source-window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
2930 (set-window-margins |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
2931 source-window |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
2932 left-margin-width right-margin-width)))) |
54538 | 2933 (put-image |
2934 (if enabled | |
2935 (or breakpoint-enabled-icon | |
2936 (setq breakpoint-enabled-icon | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
2937 (find-image `((:type xpm :data |
54538 | 2938 ,breakpoint-xpm-data |
2939 :ascent 100 :pointer hand) | |
2940 (:type pbm :data | |
2941 ,breakpoint-enabled-pbm-data | |
2942 :ascent 100 :pointer hand))))) | |
2943 (or breakpoint-disabled-icon | |
2944 (setq breakpoint-disabled-icon | |
2945 (find-image `((:type xpm :data | |
2946 ,breakpoint-xpm-data | |
2947 :conversion disabled | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
2948 :ascent 100 :pointer hand) |
54538 | 2949 (:type pbm :data |
2950 ,breakpoint-disabled-pbm-data | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
2951 :ascent 100 :pointer hand)))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2952 (+ start 1) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2953 putstring |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2954 'left-margin)) |
54538 | 2955 (when (< left-margin-width 2) |
2956 (save-current-buffer | |
2957 (setq left-margin-width 2) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2958 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2959 (if window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
2960 (set-window-margins |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2961 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
|
2962 (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
|
2963 (propertize putstring |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
2964 '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
|
2965 (1+ start))))) |
54538 | 2966 |
2967 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin) | |
2968 (gdb-remove-strings start end) | |
2969 (if (display-images-p) | |
2970 (remove-images start end)) | |
2971 (when remove-margin | |
2972 (setq left-margin-width 0) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2973 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2974 (if window |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2975 (set-window-margins |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2976 window left-margin-width right-margin-width))))) |
54538 | 2977 |
2978 | |
2979 ;; | |
2980 ;; Assembler buffer. | |
2981 ;; | |
2982 (gdb-set-buffer-rules 'gdb-assembler-buffer | |
2983 'gdb-assembler-buffer-name | |
2984 'gdb-assembler-mode) | |
2985 | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2986 ;; We can't use def-gdb-auto-update-handler because we don't want to use |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2987 ;; window-start but keep the overlay arrow/current line visible. |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2988 (defun gdb-assembler-handler () |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2989 (setq gdb-pending-triggers |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2990 (delq 'gdb-invalidate-assembler |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2991 gdb-pending-triggers)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2992 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2993 (and buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2994 (with-current-buffer buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2995 (let* ((window (get-buffer-window buf 0)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2996 (p (window-point window)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2997 (buffer-read-only nil)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2998 (erase-buffer) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
2999 (insert-buffer-substring (gdb-get-buffer-create |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3000 'gdb-partial-output-buffer)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3001 (set-window-point window p))))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3002 ;; put customisation here |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3003 (gdb-assembler-custom)) |
54538 | 3004 |
3005 (defun gdb-assembler-custom () | |
3006 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) | |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3007 (pos 1) (address) (flag) (bptno)) |
54538 | 3008 (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
|
3009 (save-excursion |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3010 (if (not (equal gdb-pc-address "main")) |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3011 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3012 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3013 (if (and gdb-pc-address |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3014 (search-forward gdb-pc-address nil t)) |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3015 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3016 (setq pos (point)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3017 (beginning-of-line) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3018 (setq fringe-indicator-alist |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3019 (if (string-equal gdb-frame-number "0") |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3020 nil |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3021 '((overlay-arrow . hollow-right-triangle)))) |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3022 (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
|
3023 (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
|
3024 (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
|
3025 (point) (current-buffer)))))) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3026 ;; 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
|
3027 (gdb-remove-breakpoint-icons (point-min) (point-max)))) |
54538 | 3028 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
3029 (goto-char (point-min)) | |
3030 (while (< (point) (- (point-max) 1)) | |
3031 (forward-line 1) | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
3032 (if (looking-at "[^\t].*?breakpoint") |
54538 | 3033 (progn |
3034 (looking-at | |
62716 | 3035 "\\([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
|
3036 (setq bptno (match-string 1)) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3037 (setq flag (char-after (match-beginning 2))) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3038 (setq address (match-string 3)) |
54538 | 3039 (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
|
3040 (save-excursion |
54538 | 3041 (goto-char (point-min)) |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
3042 (if (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
|
3043 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))))))) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3044 (if (not (equal gdb-pc-address "main")) |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
3045 (with-current-buffer buffer |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
3046 (set-window-point (get-buffer-window buffer 0) pos))))) |
54538 | 3047 |
3048 (defvar gdb-assembler-mode-map | |
3049 (let ((map (make-sparse-keymap))) | |
3050 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3051 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3052 map)) |
54538 | 3053 |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3054 (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
|
3055 '(;; <__function.name+n> |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3056 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3057 (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
|
3058 ;; 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
|
3059 ("^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
|
3060 (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
|
3061 ;; %register(at least i386) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3062 ("%\\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
|
3063 ("^\\(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
|
3064 (1 font-lock-comment-face) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3065 (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
|
3066 ("^\\(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
|
3067 "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
|
3068 |
54538 | 3069 (defun gdb-assembler-mode () |
3070 "Major mode for viewing code assembler. | |
3071 | |
3072 \\{gdb-assembler-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3073 (kill-all-local-variables) |
54538 | 3074 (setq major-mode 'gdb-assembler-mode) |
62716 | 3075 (setq mode-name (concat "Machine:" gdb-selected-frame)) |
54538 | 3076 (setq gdb-overlay-arrow-position nil) |
3077 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position) | |
3078 (setq fringes-outside-margins t) | |
3079 (setq buffer-read-only t) | |
3080 (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
|
3081 (gdb-invalidate-assembler) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3082 (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
|
3083 '(gdb-assembler-font-lock-keywords)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3084 (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
|
3085 'gdb-invalidate-assembler) |
54538 | 3086 |
3087 (defun gdb-assembler-buffer-name () | |
3088 (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
|
3089 (concat "*disassembly of " (gdb-get-target-string) "*"))) |
54538 | 3090 |
3091 (defun gdb-display-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3092 "Display disassembly view." |
54538 | 3093 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3094 (setq gdb-previous-frame nil) |
54538 | 3095 (gdb-display-buffer |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3096 (gdb-get-buffer-create 'gdb-assembler-buffer))) |
54538 | 3097 |
3098 (defun gdb-frame-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3099 "Display disassembly view in a new frame." |
54538 | 3100 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3101 (setq gdb-previous-frame nil) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
3102 (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
|
3103 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3104 (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer)))) |
54538 | 3105 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3106 ;; modified because if gdb-pc-address has changed value a new command |
54538 | 3107 ;; must be enqueued to update the buffer with the new output |
3108 (defun gdb-invalidate-assembler (&optional ignored) | |
3109 (if (gdb-get-buffer 'gdb-assembler-buffer) | |
3110 (progn | |
62716 | 3111 (unless (and gdb-selected-frame |
3112 (string-equal gdb-selected-frame gdb-previous-frame)) | |
54538 | 3113 (if (or (not (member 'gdb-invalidate-assembler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3114 gdb-pending-triggers)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3115 (not (string-equal gdb-pc-address |
62716 | 3116 gdb-previous-frame-address))) |
54538 | 3117 (progn |
62716 | 3118 ;; take previous disassemble command, if any, off the queue |
54538 | 3119 (with-current-buffer gud-comint-buffer |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3120 (let ((queue gdb-input-queue)) |
54538 | 3121 (dolist (item queue) |
3122 (if (equal (cdr item) '(gdb-assembler-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3123 (setq gdb-input-queue |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3124 (delete item gdb-input-queue)))))) |
54538 | 3125 (gdb-enqueue-input |
62716 | 3126 (list |
3127 (concat gdb-server-prefix "disassemble " | |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3128 (if (member gdb-pc-address '(nil "main")) nil "0x") |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3129 gdb-pc-address "\n") |
54538 | 3130 'gdb-assembler-handler)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3131 (push 'gdb-invalidate-assembler gdb-pending-triggers) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3132 (setq gdb-previous-frame-address gdb-pc-address) |
62716 | 3133 (setq gdb-previous-frame gdb-selected-frame))))))) |
54538 | 3134 |
62716 | 3135 (defun gdb-get-selected-frame () |
3136 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers)) | |
54538 | 3137 (progn |
3138 (gdb-enqueue-input | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3139 (list (concat gdb-server-prefix "info frame\n") 'gdb-frame-handler)) |
62716 | 3140 (push 'gdb-get-selected-frame |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3141 gdb-pending-triggers)))) |
54538 | 3142 |
3143 (defun gdb-frame-handler () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3144 (setq gdb-pending-triggers |
62716 | 3145 (delq 'gdb-get-selected-frame gdb-pending-triggers)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3146 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3147 (when (re-search-forward |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3148 "Stack level \\([0-9]+\\), frame at \\(0x[[:xdigit:]]+\\)" nil t) |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3149 (setq gdb-frame-number (match-string 1)) |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3150 (setq gdb-frame-address (match-string 2))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3151 (goto-char (point-min)) |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3152 (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-+?\\)\ |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3153 \\(?: (\\(\\S-+?\\):[0-9]+?)\\)*;? " |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3154 nil t) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3155 (setq gdb-selected-frame (match-string 2)) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3156 (if (gdb-get-buffer 'gdb-locals-buffer) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3157 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3158 (setq mode-name (concat "Locals:" gdb-selected-frame)))) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3159 (if (gdb-get-buffer 'gdb-assembler-buffer) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3160 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3161 (setq mode-name (concat "Machine:" gdb-selected-frame)))) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3162 (setq gdb-pc-address (match-string 1)) |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3163 (if (and (match-string 3) gud-overlay-arrow-position) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3164 (let ((buffer (marker-buffer gud-overlay-arrow-position)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3165 (position (marker-position gud-overlay-arrow-position))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3166 (when (and buffer (string-equal (buffer-name buffer) (match-string 3))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3167 (with-current-buffer buffer |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3168 (setq fringe-indicator-alist |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3169 (if (string-equal gdb-frame-number "0") |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3170 nil |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3171 '((overlay-arrow . hollow-right-triangle)))) |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3172 (set-marker gud-overlay-arrow-position position)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3173 (goto-char (point-min)) |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3174 (if (re-search-forward " source language \\(\\S-+\\)\." nil t) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3175 (setq gdb-current-language (match-string 1))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3176 (gdb-invalidate-assembler)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3177 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3178 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3179 ;; Code specific to GDB 6.4 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3180 (defconst gdb-source-file-regexp-1 "fullname=\"\\(.*?\\)\"") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3181 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3182 (defun gdb-set-gud-minor-mode-existing-buffers-1 () |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3183 "Create list of source files for current GDB session. |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3184 If buffers already exist for any of these files, gud-minor-mode |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3185 is set in them." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3186 (goto-char (point-min)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3187 (while (re-search-forward gdb-source-file-regexp-1 nil t) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3188 (push (match-string 1) gdb-source-file-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3189 (dolist (buffer (buffer-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3190 (with-current-buffer buffer |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3191 (when (member buffer-file-name gdb-source-file-list) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3192 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3193 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3194 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3195 (when gud-tooltip-mode |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3196 (make-local-variable 'gdb-define-alist) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3197 (gdb-create-define-alist) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3198 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3199 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3200 ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3201 (defun gdb-var-list-children-1 (varnum) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3202 (gdb-enqueue-input |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3203 (list |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3204 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3205 (concat "server interpreter mi \"-var-list-children --all-values " |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3206 varnum "\"\n") |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3207 (concat "-var-list-children --all-values " varnum "\n")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3208 `(lambda () (gdb-var-list-children-handler-1 ,varnum))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3209 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3210 (defconst gdb-var-list-children-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3211 "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3212 numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\),.*?type=\"\\(.+?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3213 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3214 (defun gdb-var-list-children-handler-1 (varnum) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3215 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3216 (let ((var-list nil)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3217 (catch 'child-already-watched |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3218 (dolist (var gdb-var-list) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3219 (if (string-equal varnum (car var)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3220 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3221 (push var var-list) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3222 (while (re-search-forward gdb-var-list-children-regexp-1 nil t) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3223 (let ((varchild (list (match-string 1) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3224 (match-string 2) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3225 (match-string 3) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3226 (match-string 5) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3227 (read (match-string 4)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3228 nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3229 (if (assoc (car varchild) gdb-var-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3230 (throw 'child-already-watched nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3231 (push varchild var-list)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3232 (push var var-list))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3233 (setq gdb-var-list (nreverse var-list))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3234 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3235 ; Uses "-var-update --all-values". Needs GDB 6.4 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3236 (defun gdb-var-update-1 () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3237 (if (not (member 'gdb-var-update gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3238 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3239 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3240 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3241 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3242 "server interpreter mi \"-var-update --all-values *\"\n" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3243 "-var-update --all-values *\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3244 'gdb-var-update-handler-1)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3245 (push 'gdb-var-update gdb-pending-triggers)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3246 |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
3247 (defconst gdb-var-update-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3248 "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3249 in_scope=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3250 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3251 (defun gdb-var-update-handler-1 () |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3252 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3253 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3254 (goto-char (point-min)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3255 (while (re-search-forward gdb-var-update-regexp-1 nil t) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3256 (let* ((varnum (match-string 1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3257 (var (assoc varnum gdb-var-list))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3258 (when var |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3259 (if (string-equal (match-string 3) "false") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3260 (setcar (nthcdr 5 var) 'out-of-scope) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3261 (setcar (nthcdr 5 var) 'changed) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3262 (setcar (nthcdr 4 var) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3263 (read (match-string 2))))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3264 (setq gdb-pending-triggers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3265 (delq 'gdb-var-update gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3266 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3267 ;; dummy command to update speedbar at right time |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
3268 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3269 ;; keep gdb-pending-triggers non-nil till end |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
3270 (push 'gdb-speedbar-refresh gdb-pending-triggers))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3271 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3272 ;; Registers buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3273 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3274 (gdb-set-buffer-rules 'gdb-registers-buffer |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3275 'gdb-registers-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3276 'gdb-registers-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3277 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3278 (def-gdb-auto-update-trigger gdb-invalidate-registers-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3279 (gdb-get-buffer 'gdb-registers-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3280 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3281 "server interpreter mi \"-data-list-register-values x\"\n" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3282 "-data-list-register-values x\n") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3283 gdb-data-list-register-values-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3284 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3285 (defconst gdb-data-list-register-values-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3286 "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3287 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3288 (defun gdb-data-list-register-values-handler () |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3289 (setq gdb-pending-triggers (delq 'gdb-invalidate-registers-1 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3290 gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3291 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3292 (if (re-search-forward gdb-error-regexp nil t) |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3293 (let ((err (match-string 1))) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3294 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3295 (let ((buffer-read-only nil)) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3296 (erase-buffer) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3297 (insert err) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3298 (goto-char (point-min))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3299 (let ((register-list (reverse gdb-register-names)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3300 (register nil) (register-string nil) (register-values nil)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3301 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3302 (while (re-search-forward gdb-data-list-register-values-regexp nil t) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3303 (setq register (pop register-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3304 (setq register-string (concat register "\t" (match-string 2) "\n")) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3305 (if (member (match-string 1) gdb-changed-registers) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3306 (put-text-property 0 (length register-string) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3307 'face 'font-lock-warning-face |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3308 register-string)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3309 (setq register-values |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3310 (concat register-values register-string))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3311 (let ((buf (gdb-get-buffer 'gdb-registers-buffer))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3312 (with-current-buffer buf |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3313 (let* ((window (get-buffer-window buf 0)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3314 (start (window-start window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3315 (p (window-point window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3316 (buffer-read-only nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3317 (erase-buffer) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3318 (insert register-values) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3319 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3320 (set-window-point window p)))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3321 (gdb-data-list-register-values-custom)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3322 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3323 (defun gdb-data-list-register-values-custom () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3324 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3325 (save-excursion |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3326 (let ((buffer-read-only nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3327 start end) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3328 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3329 (while (< (point) (point-max)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3330 (setq start (line-beginning-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3331 (setq end (line-end-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3332 (when (looking-at "^[^\t]+") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3333 (unless (string-equal (match-string 0) "No registers.") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3334 (put-text-property start (match-end 0) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3335 'face font-lock-variable-name-face) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3336 (add-text-properties start end |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3337 '(help-echo "mouse-2: edit value" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3338 mouse-face highlight)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3339 (forward-line 1)))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3340 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3341 ;; Needs GDB 6.4 onwards (used to fail with no stack). |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3342 (defun gdb-get-changed-registers () |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3343 (if (and (gdb-get-buffer 'gdb-registers-buffer) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3344 (not (member 'gdb-get-changed-registers gdb-pending-triggers))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3345 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3346 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3347 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3348 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3349 "server interpreter mi -data-list-changed-registers\n" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3350 "-data-list-changed-registers\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3351 'gdb-get-changed-registers-handler)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3352 (push 'gdb-get-changed-registers gdb-pending-triggers)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3353 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3354 (defconst gdb-data-list-register-names-regexp "\"\\(.*?\\)\"") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3355 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3356 (defun gdb-get-changed-registers-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3357 (setq gdb-pending-triggers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3358 (delq 'gdb-get-changed-registers gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3359 (setq gdb-changed-registers nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3360 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3361 (while (re-search-forward gdb-data-list-register-names-regexp nil t) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3362 (push (match-string 1) gdb-changed-registers))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3363 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3364 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3365 ;; Locals buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3366 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3367 ;; uses "-stack-list-locals --simple-values". Needs GDB 6.1 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3368 (gdb-set-buffer-rules 'gdb-locals-buffer |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3369 'gdb-locals-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3370 'gdb-locals-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3371 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3372 (def-gdb-auto-update-trigger gdb-invalidate-locals-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3373 (gdb-get-buffer 'gdb-locals-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3374 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3375 "server interpreter mi -\"stack-list-locals --simple-values\"\n" |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3376 "-stack-list-locals --simple-values\n") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3377 gdb-stack-list-locals-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3378 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3379 (defconst gdb-stack-list-locals-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3380 "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3381 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3382 (defvar gdb-locals-watch-map-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3383 (let ((map (make-sparse-keymap))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3384 (define-key map [mouse-2] 'gud-watch) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3385 map) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3386 "Keymap to create watch expression of a complex data type local variable.") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3387 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3388 ;; Dont display values of arrays or structures. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3389 ;; These can be expanded using gud-watch. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3390 (defun gdb-stack-list-locals-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3391 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3392 gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3393 (let (local locals-list) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3394 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3395 (while (re-search-forward gdb-stack-list-locals-regexp nil t) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3396 (let ((local (list (match-string 1) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3397 (match-string 2) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3398 nil))) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3399 (if (looking-at ",value=\\(\".*\"\\).*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3400 (setcar (nthcdr 2 local) (read (match-string 1)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3401 (push local locals-list))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3402 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3403 (and buf (with-current-buffer buf |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3404 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3405 (start (window-start window)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3406 (p (window-point window)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3407 (buffer-read-only nil)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3408 (erase-buffer) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3409 (dolist (local locals-list) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3410 (setq name (car local)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3411 (if (or (not (nth 2 local)) |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
3412 (string-match "\\0x" (nth 2 local))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3413 (add-text-properties 0 (length name) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3414 `(mouse-face highlight |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3415 help-echo "mouse-2: create watch expression" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3416 local-map ,gdb-locals-watch-map-1) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3417 name)) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3418 (insert |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3419 (concat name "\t" (nth 1 local) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3420 "\t" (nth 2 local) "\n"))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3421 (set-window-start window start) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3422 (set-window-point window p))))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3423 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3424 (defun gdb-get-register-names () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3425 "Create a list of register names." |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3426 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3427 (setq gdb-register-names nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3428 (while (re-search-forward gdb-data-list-register-names-regexp nil t) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3429 (push (match-string 1) gdb-register-names))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3430 |
54538 | 3431 (provide 'gdb-ui) |
3432 | |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3433 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
54538 | 3434 ;;; gdb-ui.el ends here |