Mercurial > emacs
annotate lisp/progmodes/gdb-ui.el @ 95093:e3632d427a21
*** empty log message ***
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Mon, 19 May 2008 01:54:10 +0000 |
parents | 52b7a8c22af5 |
children | 7fc95e208907 |
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 | |
79717 | 7 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
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 | |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94555
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
54538 | 13 ;; it under the terms of the GNU General Public License as published by |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94555
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94555
diff
changeset
|
15 ;; (at your option) any later version. |
54538 | 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 | |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94555
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
54538 | 24 |
25 ;;; Commentary: | |
26 | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
27 ;; This mode acts as a graphical user interface to GDB. You can interact with |
54538 | 28 ;; GDB through the GUD buffer in the usual way, but there are also further |
29 ;; 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
|
30 ;; 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
|
31 ;; 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
|
32 ;; 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
|
33 ;; (see the GDB Graphical Interface section in the Emacs info manual). |
54538 | 34 |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
35 ;; By default, M-x gdb will start the debugger. |
54538 | 36 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
37 ;; 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
|
38 ;; 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
|
39 ;; You don't need to know about annotations to use this mode as a debugger, |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
40 ;; but if you are interested developing the mode itself, see the Annotations |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
41 ;; 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
|
42 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
43 ;; GDB developers plan to make the annotation interface obsolete. A new |
79446 | 44 ;; interface called GDB/MI (machine interface) has been designed to replace it. |
45 ;; Some GDB/MI commands are used in this file through the CLI command | |
46 ;; 'interpreter mi <mi-command>'. To help with the process of fully migrating | |
47 ;; Emacs from annotations to GDB/MI, there is an experimental package called | |
48 ;; gdb-mi in the Emacs Lisp Package Archive ("http://tromey.com/elpa/"). It | |
49 ;; comprises of modified gud.el and a file called gdb-mi.el which replaces | |
50 ;; gdb-ui.el. When installed, this overrides the current files and invoking | |
51 ;; M-x gdb will use GDB/MI directly (starts with "gdb -i=mi"). When deleted | |
52 ;; ('d' followed by 'x' in Package Menu mode), the files are deleted and old | |
53 ;; functionality restored. This provides a convenient way to review the | |
54 ;; current status/contribute to its improvement. For someone who just wants to | |
55 ;; use GDB, however, the current mode in Emacs 22 is a much better option. | |
56 ;; There is also a file, also called gdb-mi.el, a version of which is included | |
57 ;; the GDB distribution. This will probably only work with versions | |
58 ;; distributed with GDB 6.5 or later. Unlike the version in ELPA it works on | |
59 ;; top of gdb-ui.el and you can only start it with M-x gdbmi. | |
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
|
60 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
61 ;; This mode SHOULD WORK WITH GDB 5.0 or later but you will NEED AT LEAST |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
62 ;; GDB 6.0 to use watch expressions. It works best with GDB 6.4 or later |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
63 ;; where 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
|
64 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
65 ;;; 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
|
66 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
67 ;; 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
|
68 ;; 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
|
69 ;; 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
|
70 ;; 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
|
71 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
72 ;; #ifdef UNBUFFERED |
64999
e1cdc6178b3e
(toggle-gdb-use-inferior-io-buffer):
Nick Roberts <nickrob@snap.net.nz>
parents:
64993
diff
changeset
|
73 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0); |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
74 ;; #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
|
75 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
76 ;; 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
|
77 |
80315
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
78 ;; If you are using Cygwin GDB and find that the source is not being displayed |
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
79 ;; in Emacs when you step through it, possible solutions are to: |
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
80 |
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
81 ;; 1) Use Cygwin X Windows and Cygwin Emacs. |
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
82 ;; (Since 22.1 Emacs builds under Cygwin.) |
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
83 ;; 2) Use MinGW GDB instead. |
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
84 ;; 3) Use cygwin-mount.el |
84f75770f0f3
Add advice about using Cygwin GDB (from a
Nick Roberts <nickrob@snap.net.nz>
parents:
80214
diff
changeset
|
85 |
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
|
86 ;;; 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
|
87 |
79446 | 88 ;; 1) Cannot handle multiple debug sessions. |
89 ;; 2) If you wish to call procedures from your program in GDB | |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
90 ;; e.g "call myproc ()", "p mysquare (5)" then use level 2 annotations |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
91 ;; "gdb --annotate=2 myprog" to keep source buffer/selected frame fixed. |
79446 | 92 ;; 3) After detaching from a process, clicking on the "GO" icon on toolbar |
74765
3cedab34a4b6
(gdb-stopped): After attaching to a process
Nick Roberts <nickrob@snap.net.nz>
parents:
74390
diff
changeset
|
93 ;; (gud-go) sends "continue" to GDB (should be "run"). |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
94 |
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
|
95 ;;; TODO: |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
96 |
59808 | 97 ;; 1) Use MI command -data-read-memory for memory window. |
94445
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
98 ;; 2) Use tree-buffer.el (from ECB) instead of the speedbar for |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
99 ;; watch-expressions? Handling of watch-expressions needs to be |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
100 ;; overhauled to work for large arrays/structures by creating variable |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
101 ;; objects for visible watch-expressions only. |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
102 ;; 3) Mark breakpoint locations on scroll-bar of source buffer? |
54538 | 103 |
104 ;;; Code: | |
105 | |
106 (require 'gud) | |
107 | |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
108 (defvar tool-bar-map) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
109 (defvar speedbar-initial-expansion-list-name) |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
110 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
111 (defvar gdb-pc-address nil "Initialization for Assembler buffer. |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
112 Set to \"main\" at start if `gdb-show-main' is t.") |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
113 (defvar gdb-frame-address nil "Identity of frame for watch expression.") |
94273
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
114 (defvar gdb-previous-frame-pc-address nil) |
59808 | 115 (defvar gdb-memory-address "main") |
54538 | 116 (defvar gdb-previous-frame nil) |
62716 | 117 (defvar gdb-selected-frame nil) |
118 (defvar gdb-frame-number nil) | |
54538 | 119 (defvar gdb-current-language nil) |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
120 (defvar gdb-var-list nil |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
121 "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
|
122 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP) |
75589
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
123 where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
124 address for root variables.") |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
125 (defvar gdb-main-file nil "Source file from which program execution begins.") |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
126 (defvar gud-old-arrow nil) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
127 (defvar gdb-thread-indicator nil) |
54538 | 128 (defvar gdb-overlay-arrow-position nil) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
129 (defvar gdb-stack-position nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
130 (defvar gdb-server-prefix nil) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
131 (defvar gdb-flush-pending-output nil) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
132 (defvar gdb-location-alist nil |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
133 "Alist of breakpoint numbers and full filenames. Only used for files that |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
134 Emacs can't find.") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
135 (defvar gdb-active-process nil |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
136 "GUD tooltips display variable values when t, and macro definitions otherwise.") |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
137 (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
|
138 (defvar gdb-macro-info nil |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
139 "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
|
140 (defvar gdb-buffer-fringe-width nil) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
141 (defvar gdb-signalled nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
142 (defvar gdb-source-window nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
143 (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
|
144 (defvar gdb-continuation nil) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
145 (defvar gdb-look-up-stack nil) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
146 (defvar gdb-frame-begin nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
147 "Non-nil when GDB generates frame-begin annotation.") |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
148 (defvar gdb-printing t) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
149 (defvar gdb-parent-bptno-enabled nil) |
91867
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
150 (defvar gdb-ready nil) |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
151 (defvar gdb-stack-update nil) |
91867
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
152 (defvar gdb-early-user-input nil) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
153 |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
154 (defvar gdb-buffer-type nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
155 "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
|
156 (make-variable-buffer-local 'gdb-buffer-type) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
157 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
158 (defvar gdb-input-queue () |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
159 "A list of gdb command objects.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
160 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
161 (defvar gdb-prompting nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
162 "True when gdb is idle with no pending input.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
163 |
91950
d758efc0f23f
(gdb-output-sink): Define with an invalid value.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91867
diff
changeset
|
164 (defvar gdb-output-sink nil |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
165 "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
|
166 Possible values are these symbols: |
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 `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
|
169 for the user to see. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
170 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
171 `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
|
172 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
173 `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
|
174 annotation is received. Then the output-sink |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
175 becomes:... |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
176 `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
|
177 for subsequent processing by a command. This is the |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
178 disposition of output generated by commands that |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
179 gdb mode sends to gdb on its own behalf. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
180 `post-emacs' -- ignore output until the prompt annotation is |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
181 received, then go to USER disposition. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
182 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
183 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
|
184 \(`user' and `emacs').") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
185 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
186 (defvar gdb-current-item nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
187 "The most recent command item sent to gdb.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
188 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
189 (defvar gdb-pending-triggers '() |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
190 "A list of trigger functions that have run later than their output handlers.") |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
191 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
192 (defvar gdb-first-post-prompt nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
193 (defvar gdb-version nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
194 (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
|
195 (defvar gdb-source-file-list nil |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
196 "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
|
197 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"") |
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-1 |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
200 '(;; var = (struct struct_tag) value |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
201 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
202 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
203 (3 font-lock-keyword-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
204 (4 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
205 ;; var = (type) value |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
206 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
207 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
208 (3 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
209 ;; var = val |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
210 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]" |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
211 (1 font-lock-variable-name-face))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
212 "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
|
213 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
214 (defvar gdb-locals-font-lock-keywords-2 |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
215 '(;; var = type value |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
216 ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
217 (1 font-lock-variable-name-face) |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
218 (3 font-lock-type-face))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
219 "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
|
220 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
221 ;; Variables for GDB 6.4+ |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
222 (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
|
223 (defvar gdb-changed-registers nil |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
224 "List of changed register numbers (strings).") |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
225 |
54538 | 226 ;;;###autoload |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
227 (defun gdb (command-line) |
54538 | 228 "Run gdb on program FILE in buffer *gud-FILE*. |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
229 The directory containing FILE becomes the initial working |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
230 directory and source-file directory for your debugger. |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
231 |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 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
|
236 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
237 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
|
238 `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
|
239 `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
|
240 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
|
241 some of the buffers. |
54538 | 242 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
243 Watch expressions appear in the speedbar/slowbar. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
244 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
245 The following commands help control operation : |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
246 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
247 `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
|
248 `gdb-restore-windows' - To restore the window layout. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
249 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
250 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
|
251 detailed description of this mode. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
252 |
68938
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 | GDB Toolbar | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
255 +-----------------------------------+----------------------------------+ |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
256 | GUD buffer (I/O of GDB) | Locals buffer | |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
257 |-----------------------------------+----------------------------------+ |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
258 | | | |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
259 | Source buffer | I/O buffer for debugged program | |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
260 | | | |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
261 |-----------------------------------+----------------------------------+ |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
262 | Stack buffer | Breakpoints/threads buffer | |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
263 +-----------------------------------+----------------------------------+ |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
264 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
265 To run GDB in text command mode, replace the GDB \"--annotate=3\" |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
266 option with \"--fullname\" either in the minibuffer for the |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
267 current Emacs session, or the custom variable |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
268 `gud-gdb-command-name' for all future sessions. You need to use |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
269 text command mode to debug multiple programs within one Emacs |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
270 session." |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
271 (interactive (list (gud-query-cmdline 'gdb))) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
272 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
273 (when (and gud-comint-buffer |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
274 (buffer-name gud-comint-buffer) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
275 (get-buffer-process gud-comint-buffer) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
276 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
277 (gdb-restore-windows) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
278 (error |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
279 "Multiple debugging requires restarting in text command mode")) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
280 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
281 (gud-common-init command-line nil 'gud-gdba-marker-filter) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
282 (set (make-local-variable 'gud-minor-mode) 'gdba) |
91867
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
283 (setq comint-input-sender 'gdb-send) |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
284 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
285 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
286 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
287 "Set temporary breakpoint at current line.") |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
288 (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line.") |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
289 (gud-def gud-step "step %p" "\C-s" "Step one source line with display.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
290 (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
291 (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
292 (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
293 (gud-def gud-cont "cont" "\C-r" "Continue with display.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
294 (gud-def gud-finish "finish" "\C-f" "Finish executing current function.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
295 (gud-def gud-jump |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
296 (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l")) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
297 "\C-j" "Set execution address to current line.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
298 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
299 (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
300 (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
301 (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
302 (gud-def gud-pstar "print* %e" nil |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
303 "Evaluate C dereferenced pointer expression at point.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
304 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
305 ;; For debugging Emacs only. |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
306 (gud-def gud-pv "pv1 %e" "\C-v" "Print the value of the lisp variable.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
307 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
308 (gud-def gud-until "until %l" "\C-u" "Continue to current line.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
309 (gud-def gud-run "run" nil "Run the program.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
310 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
311 (local-set-key "\C-i" 'gud-gdb-complete-command) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
312 (setq comint-prompt-regexp "^(.*gdb[+]?) *") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
313 (setq paragraph-start comint-prompt-regexp) |
91950
d758efc0f23f
(gdb-output-sink): Define with an invalid value.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91867
diff
changeset
|
314 (setq gdb-output-sink 'user) |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
315 (setq gdb-first-prompt t) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
316 (setq gud-running nil) |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
317 (setq gdb-ready nil) |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
318 (setq gdb-stack-update nil) |
80146
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
319 (setq gdb-flush-pending-output nil) |
91867
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
320 (setq gdb-early-user-input nil) |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
321 (setq gud-filter-pending-text nil) |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
322 (gdb-thread-identification) |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
323 (run-hooks 'gdb-mode-hook)) |
54538 | 324 |
80146
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
325 ;; Keep as an alias for compatibility with Emacs 22.1. |
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
326 ;;;###autoload |
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
327 (defalias 'gdba 'gdb) |
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
328 |
93765 | 329 (defgroup gdb nil |
330 "Gdb Graphical Mode options specifically for running Gdb in Emacs." | |
331 :group 'processes | |
332 :group 'tools) | |
333 | |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
334 (defcustom gdb-debug-log-max 128 |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
335 "Maximum size of `gdb-debug-log'. If nil, size is unlimited." |
93765 | 336 :group 'gdb |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
337 :type '(choice (integer :tag "Number of elements") |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
338 (const :tag "Unlimited" nil)) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
339 :version "22.1") |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
340 |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
341 (defvar gdb-debug-log nil |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
342 "List of commands sent to and replies received from GDB. |
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
343 Most recent commands are listed first. This list stores only the last |
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
344 `gdb-debug-log-max' values. 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
|
345 |
64697
7767f4fb012a
* progmodes/gdb-ui.el (gdb-enable-debug-log): Add autoload cookie.
Nick Roberts <nickrob@snap.net.nz>
parents:
64654
diff
changeset
|
346 ;;;###autoload |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
347 (defcustom gdb-enable-debug nil |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
348 "Non-nil means record the process input and output in `gdb-debug-log'." |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
349 :type 'boolean |
93765 | 350 :group 'gdb |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
351 :version "22.1") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
352 |
62115
515e18600ed2
(gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
62065
diff
changeset
|
353 (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
|
354 "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
|
355 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
|
356 with an identifier as a tooltip. It works in a debug session with |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
357 GDB, when `gud-tooltip-mode' is t. |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
358 |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
359 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
|
360 predefined macros." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
361 :type 'string |
93765 | 362 :group 'gdb |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
363 :version "22.1") |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
364 |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
365 (defcustom gdb-cpp-define-alist-flags "" |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
366 "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
|
367 :type 'string |
93765 | 368 :group 'gdb |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
369 :version "22.1") |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
370 |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
371 (defcustom gdb-show-main nil |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
372 "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
|
373 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
|
374 :type 'boolean |
93765 | 375 :group 'gdb |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
376 :version "22.1") |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
377 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
378 (defcustom gdb-many-windows nil |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
379 "If nil, just pop up the GUD buffer unless `gdb-show-main' is t. |
73890
2896142f6964
(gdb-many-windows): Start doc string
Nick Roberts <nickrob@snap.net.nz>
parents:
73883
diff
changeset
|
380 In this case start with two windows: one displaying the GUD |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
381 buffer and the other with the source file with the main routine |
73890
2896142f6964
(gdb-many-windows): Start doc string
Nick Roberts <nickrob@snap.net.nz>
parents:
73883
diff
changeset
|
382 of the debugged program. Non-nil means display the layout shown |
2896142f6964
(gdb-many-windows): Start doc string
Nick Roberts <nickrob@snap.net.nz>
parents:
73883
diff
changeset
|
383 for `gdba'." |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
384 :type 'boolean |
93765 | 385 :group 'gdb |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
386 :version "22.1") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
387 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
388 (defcustom gdb-use-separate-io-buffer nil |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
389 "Non-nil means display output from the debugged program in a separate buffer." |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
390 :type 'boolean |
93765 | 391 :group 'gdb |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
392 :version "22.1") |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
393 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
394 (defun gdb-force-mode-line-update (status) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
395 (let ((buffer gud-comint-buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
396 (if (and buffer (buffer-name buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
397 (with-current-buffer buffer |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
398 (setq mode-line-process |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
399 (format ":%s [%s]" |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
400 (process-status (get-buffer-process buffer)) status)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
401 ;; Force mode line redisplay soon. |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
402 (force-mode-line-update))))) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
403 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
404 (defun gdb-many-windows (arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
405 "Toggle the number of windows in the basic arrangement. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
406 With prefix argument ARG, display additional buffers if ARG is positive, |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
407 otherwise use a single window." |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
408 (interactive "P") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
409 (setq gdb-many-windows |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
410 (if (null arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
411 (not gdb-many-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
412 (> (prefix-numeric-value arg) 0))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
413 (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
|
414 (if gdb-many-windows "en" "dis"))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
415 (if (and gud-comint-buffer |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
416 (buffer-name gud-comint-buffer)) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
417 (condition-case nil |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
418 (gdb-restore-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
419 (error nil)))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
420 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
421 (defun gdb-use-separate-io-buffer (arg) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
422 "Toggle separate IO for debugged program. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
423 With prefix argument ARG, use separate IO if ARG is positive, |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
424 otherwise do not." |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
425 (interactive "P") |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
426 (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
|
427 (if (null arg) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
428 (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
|
429 (> (prefix-numeric-value arg) 0))) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
430 (message (format "Separate IO %sabled" |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
431 (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
|
432 (if (and gud-comint-buffer |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
433 (buffer-name gud-comint-buffer)) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
434 (condition-case nil |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
435 (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
|
436 (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
|
437 (kill-buffer (gdb-inferior-io-name))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
438 (error nil)))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
439 |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
440 (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
|
441 |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
442 (defun gdb-create-define-alist () |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
443 "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
|
444 (let* ((file (buffer-file-name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
445 (output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
446 (with-output-to-string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
447 (with-current-buffer standard-output |
79945
d1a91cfdb94c
(gdb-create-define-alist): Don't call
Nick Roberts <nickrob@snap.net.nz>
parents:
79812
diff
changeset
|
448 (and file (file-exists-p file) |
d1a91cfdb94c
(gdb-create-define-alist): Don't call
Nick Roberts <nickrob@snap.net.nz>
parents:
79812
diff
changeset
|
449 (call-process shell-file-name file |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
450 (list t nil) nil "-c" |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
451 (concat gdb-cpp-define-alist-program " " |
79945
d1a91cfdb94c
(gdb-create-define-alist): Don't call
Nick Roberts <nickrob@snap.net.nz>
parents:
79812
diff
changeset
|
452 gdb-cpp-define-alist-flags)))))) |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
453 (define-list (split-string output "\n" t)) (name)) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
454 (setq gdb-define-alist nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
455 (dolist (define define-list) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
456 (setq name (nth 1 (split-string define "[( ]"))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
457 (push (cons name define) gdb-define-alist)))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
458 |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
459 (defun gdb-tooltip-print (expr) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
460 (tooltip-show |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
461 (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
|
462 (goto-char (point-min)) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
463 (let ((string |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
464 (if (search-forward "=" nil t) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
465 (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
|
466 (buffer-string)))) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
467 ;; 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
|
468 (substring string 0 (- (length string) 1)))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
469 (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
|
470 |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
471 ;; 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
|
472 ;; 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
|
473 ;; unexpected starting annotation (phase error). |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
474 (defun gdb-tooltip-print-1 (expr) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
475 (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
|
476 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
477 (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
|
478 (unless (looking-at "\\S-+.*(.*).*") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
479 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
480 (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
|
481 `(lambda () (gdb-tooltip-print ,expr)))))))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
482 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
483 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)") |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
484 |
80510
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
485 (defun gdb-init-buffer () |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
486 (set (make-local-variable 'gud-minor-mode) |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
487 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
488 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
489 (when gud-tooltip-mode |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
490 (make-local-variable 'gdb-define-alist) |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
491 (gdb-create-define-alist) |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
492 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))) |
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
493 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
494 (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
|
495 "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
|
496 (goto-char (point-min)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
497 (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
|
498 (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
|
499 (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
|
500 gdb-source-file-list)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
501 (dolist (buffer (buffer-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
502 (with-current-buffer buffer |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
503 (when (and buffer-file-name |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
504 (member (file-name-nondirectory buffer-file-name) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
505 gdb-source-file-list)) |
80510
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
506 (gdb-init-buffer))))) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
507 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
508 (propertize "ready" 'face font-lock-variable-name-face))) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
509 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
510 (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
|
511 (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
|
512 (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
|
513 (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
|
514 (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
|
515 (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
|
516 (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
|
517 (setq varnumlet (car var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
518 (dolist (component component-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
519 (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
|
520 (setq expr (concat expr |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
521 (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
|
522 (concat "[" component "]") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
523 (concat "." component)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
524 (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
|
525 expr))) |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
526 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
527 (defun gdb-init-1 () |
62716 | 528 (gud-def gud-break (if (not (string-match "Machine" mode-name)) |
54538 | 529 (gud-call "break %f:%l" arg) |
530 (save-excursion | |
531 (beginning-of-line) | |
532 (forward-char 2) | |
533 (gud-call "break *%a" arg))) | |
534 "\C-b" "Set breakpoint at current line or address.") | |
535 ;; | |
62716 | 536 (gud-def gud-remove (if (not (string-match "Machine" mode-name)) |
54538 | 537 (gud-call "clear %f:%l" arg) |
538 (save-excursion | |
539 (beginning-of-line) | |
540 (forward-char 2) | |
541 (gud-call "clear *%a" arg))) | |
542 "\C-d" "Remove breakpoint at current line or address.") | |
543 ;; | |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
544 (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
|
545 (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
|
546 (save-excursion |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
547 (beginning-of-line) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
548 (forward-char 2) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
549 (gud-call "until *%a" arg))) |
54538 | 550 "\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
|
551 ;; |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
552 (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
|
553 nil "Start or continue execution.") |
54538 | 554 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
555 ;; For debugging Emacs only. |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
556 (gud-def gud-pp |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
557 (gud-call |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
558 (concat |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
559 "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
|
560 '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
|
561 (gdb-find-watch-expression) "%e")) arg) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
562 nil "Print the Emacs s-expression.") |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
563 |
54538 | 564 (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
|
565 'gdb-mouse-set-clear-breakpoint) |
54538 | 566 (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
|
567 'gdb-mouse-set-clear-breakpoint) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
568 (define-key gud-minor-mode-map [left-margin C-mouse-1] |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
569 'gdb-mouse-toggle-breakpoint-margin) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
570 (define-key gud-minor-mode-map [left-fringe C-mouse-1] |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
571 'gdb-mouse-toggle-breakpoint-fringe) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
572 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
573 (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
|
574 'gdb-mouse-until) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
575 (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
|
576 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
577 (define-key gud-minor-mode-map [left-margin mouse-3] |
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
|
578 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
579 (define-key gud-minor-mode-map [left-fringe mouse-3] |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
580 'gdb-mouse-until) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
581 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
582 (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
|
583 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
584 (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
|
585 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
586 (define-key gud-minor-mode-map [left-fringe C-mouse-3] |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
587 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
588 (define-key gud-minor-mode-map [left-margin C-mouse-3] |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
589 'gdb-mouse-jump) |
54538 | 590 |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
591 ;; (re-)initialize |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
592 (setq gdb-pc-address (if gdb-show-main "main" nil)) |
94273
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
593 (setq gdb-previous-frame-pc-address nil |
62716 | 594 gdb-memory-address "main" |
595 gdb-previous-frame nil | |
596 gdb-selected-frame nil | |
597 gdb-current-language nil | |
598 gdb-frame-number nil | |
599 gdb-var-list nil | |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
600 gdb-main-file nil |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
601 gdb-first-post-prompt t |
62716 | 602 gdb-prompting nil |
603 gdb-input-queue nil | |
604 gdb-current-item nil | |
605 gdb-pending-triggers nil | |
606 gdb-output-sink 'user | |
607 gdb-server-prefix "server " | |
608 gdb-location-alist nil | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
609 gdb-source-file-list nil |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
610 gdb-error nil |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
611 gdb-macro-info nil |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
612 gdb-buffer-fringe-width (car (window-fringes)) |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
613 gdb-debug-log nil |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
614 gdb-signalled nil |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
615 gdb-source-window nil |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
616 gdb-inferior-status nil |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
617 gdb-continuation nil |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
618 gdb-look-up-stack nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
619 gdb-frame-begin nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
620 gdb-printing t |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
621 gud-old-arrow nil |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
622 gdb-thread-indicator nil) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
623 |
54538 | 624 (setq gdb-buffer-type 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
625 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
626 (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
|
627 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
628 ;; 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
|
629 (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
|
630 'gdb-get-version))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
631 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
632 (defun gdb-init-2 () |
54538 | 633 (if (eq window-system 'w32) |
634 (gdb-enqueue-input (list "set new-console off\n" 'ignore))) | |
635 (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
|
636 (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
|
637 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
638 (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
|
639 (progn |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
640 (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
|
641 '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
|
642 (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
|
643 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
644 (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
|
645 'gdb-get-register-names)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
646 ; Needs GDB 6.2 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
647 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
648 (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
|
649 '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
|
650 (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
|
651 |
69839
f91451ffdab7
(gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents:
69666
diff
changeset
|
652 ;; 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
|
653 ;; 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
|
654 (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
|
655 (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
|
656 |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
657 (run-hooks 'gdb-mode-hook)) |
54538 | 658 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
659 (defun gdb-get-version () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
660 (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
|
661 (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
|
662 (setq gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
663 (setq gdb-version "6.4+")) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
664 (gdb-init-2)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
665 |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
666 (defmacro gdb-if-arrow (arrow-position &rest body) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
667 `(if ,arrow-position |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
668 (let ((buffer (marker-buffer ,arrow-position)) (line)) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
669 (if (equal buffer (window-buffer (posn-window end))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
670 (with-current-buffer buffer |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
671 (when (or (equal start end) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
672 (equal (posn-point start) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
673 (marker-position ,arrow-position))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
674 ,@body)))))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
675 |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
676 (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
|
677 "Continue running until a source line past the current line. |
76238
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
678 The destination source line can be selected either by clicking |
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
679 with mouse-3 on the fringe/margin or dragging the arrow |
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
680 with mouse-1 (default bindings)." |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
681 (interactive "e") |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
682 (let ((start (event-start event)) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
683 (end (event-end event))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
684 (gdb-if-arrow gud-overlay-arrow-position |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
685 (setq line (line-number-at-pos (posn-point end))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
686 (gud-call (concat "until " (number-to-string line)))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
687 (gdb-if-arrow gdb-overlay-arrow-position |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
688 (save-excursion |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
689 (goto-line (line-number-at-pos (posn-point end))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
690 (forward-char 2) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
691 (gud-call (concat "until *%a")))))) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
692 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
693 (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
|
694 "Set execution address/line. |
76238
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
695 The destination source line can be selected either by clicking with C-mouse-3 |
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
696 on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings). |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
697 Unlike `gdb-mouse-until' the destination address can be before the current |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
698 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
|
699 (interactive "e") |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
700 (let ((start (event-start event)) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
701 (end (event-end event))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
702 (gdb-if-arrow gud-overlay-arrow-position |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
703 (setq line (line-number-at-pos (posn-point end))) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
704 (progn |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
705 (gud-call (concat "tbreak " (number-to-string line))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
706 (gud-call (concat "jump " (number-to-string line))))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
707 (gdb-if-arrow gdb-overlay-arrow-position |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
708 (save-excursion |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
709 (goto-line (line-number-at-pos (posn-point end))) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
710 (forward-char 2) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
711 (progn |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
712 (gud-call (concat "tbreak *%a")) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
713 (gud-call (concat "jump *%a"))))))) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
714 |
69042
01ec984a6ce6
(gdb-speedbar-auto-raise): Don't enable by default.
Nick Roberts <nickrob@snap.net.nz>
parents:
69023
diff
changeset
|
715 (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
|
716 "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
|
717 updated." |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
718 :type 'boolean |
93765 | 719 :group 'gdb |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
720 :version "22.1") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
721 |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
722 (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
|
723 "Toggle automatic raising of the speedbar for watch expressions. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
724 With prefix argument ARG, automatically raise speedbar if ARG is |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
725 positive, otherwise don't automatically raise it." |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
726 (interactive "P") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
727 (setq gdb-speedbar-auto-raise |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
728 (if (null arg) |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
729 (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
|
730 (> (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
|
731 (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
|
732 (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
|
733 |
54538 | 734 (defcustom gdb-use-colon-colon-notation nil |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
735 "If non-nil use FUN::VAR format to display variables in the speedbar." |
54538 | 736 :type 'boolean |
93765 | 737 :group 'gdb |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
738 :version "22.1") |
54538 | 739 |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
740 (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
|
741 (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
|
742 |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
743 (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
|
744 "Watch expression at point. |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
745 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
|
746 (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
|
747 (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
|
748 (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
|
749 (progn |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
750 (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
|
751 (require 'tooltip) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
752 (save-selected-window |
70351
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
753 (let ((expr |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
754 (if arg |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
755 (completing-read "Name of variable: " |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
756 'gud-gdb-complete-command) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
757 (if (and transient-mark-mode mark-active) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
758 (buffer-substring (region-beginning) (region-end)) |
94235
37605d9673f1
(gud-watch): Add "$" prefix when in registers buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94231
diff
changeset
|
759 (concat (if (eq major-mode 'gdb-registers-mode) "$") |
37605d9673f1
(gud-watch): Add "$" prefix when in registers buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94231
diff
changeset
|
760 (tooltip-identifier-from-point (point))))))) |
94348
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
761 (set-text-properties 0 (length expr) nil expr) |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
762 (gdb-enqueue-input |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
763 (list |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
764 (if (eq minor-mode 'gdba) |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
765 (concat |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
766 "server interpreter mi \"-var-create - * " expr "\"\n") |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
767 (concat"-var-create - * " expr "\n")) |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
768 `(lambda () (gdb-var-create-handler ,expr))))))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
769 (message "gud-watch is a no-op in this mode.")))) |
54538 | 770 |
771 (defconst gdb-var-create-regexp | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
772 "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",\\(?:.*value=\\(\".*\"\\),\\)?.*type=\"\\(.*?\\)\"") |
54538 | 773 |
774 (defun gdb-var-create-handler (expr) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
775 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
776 (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
|
777 (let ((var (list |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
778 (match-string 1) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
779 (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
|
780 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
|
781 (setq expr (concat gdb-selected-frame "::" expr)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
782 expr) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
783 (match-string 2) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
784 (match-string 4) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
785 (if (match-string 3) (read (match-string 3))) |
75589
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
786 nil gdb-frame-address))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
787 (push var gdb-var-list) |
94348
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
788 (speedbar 1) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
789 (unless (string-equal |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
790 speedbar-initial-expansion-list-name "GUD") |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
791 (speedbar-change-initial-expansion-list "GUD")) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
792 (unless (nth 4 var) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
793 (gdb-enqueue-input |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
794 (list |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
795 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
796 'gdba) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
797 (concat "server interpreter mi \"0-var-evaluate-expression " |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
798 (car var) "\"\n") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
799 (concat "0-var-evaluate-expression " (car var) "\n")) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
800 `(lambda () (gdb-var-evaluate-expression-handler |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
801 ,(car var) nil)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
802 (if (search-forward "Undefined command" nil t) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
803 (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
|
804 (message-box "No symbol \"%s\" in current context." expr)))) |
54538 | 805 |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
806 (defun gdb-speedbar-update () |
75589
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
807 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame) |
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
808 (not (member 'gdb-speedbar-timer gdb-pending-triggers))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
809 ;; Dummy command to update speedbar even when idle. |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
810 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
811 ;; Keep gdb-pending-triggers non-nil till end. |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
812 (push 'gdb-speedbar-timer gdb-pending-triggers))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
813 |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
814 (defun gdb-speedbar-timer-fn () |
94476
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
815 (if gdb-speedbar-auto-raise |
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
816 (raise-frame speedbar-frame)) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
817 (setq gdb-pending-triggers |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
818 (delq 'gdb-speedbar-timer gdb-pending-triggers)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
819 (speedbar-timer-fn)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
820 |
54538 | 821 (defun gdb-var-evaluate-expression-handler (varnum changed) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
822 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
823 (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
824 (setq gdb-pending-triggers |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
825 (delq (string-to-number (match-string 1)) gdb-pending-triggers)) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
826 (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
|
827 (when var |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
828 (if changed (setcar (nthcdr 5 var) 'changed)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
829 (setcar (nthcdr 4 var) (read (match-string 2))))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
830 (gdb-speedbar-update)) |
54538 | 831 |
832 (defun gdb-var-list-children (varnum) | |
833 (gdb-enqueue-input | |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
834 (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
|
835 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
54538 | 836 |
837 (defconst gdb-var-list-children-regexp | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
838 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
839 numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)") |
54538 | 840 |
841 (defun gdb-var-list-children-handler (varnum) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
842 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
843 (let ((var-list nil)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
844 (catch 'child-already-watched |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
845 (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
|
846 (if (string-equal varnum (car var)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
847 (progn |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
848 (push var var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
849 (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
|
850 (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
|
851 (match-string 2) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
852 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
853 (match-string 6) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
854 nil nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
855 (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
|
856 (throw 'child-already-watched nil)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
857 (push varchild var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
858 (gdb-enqueue-input |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
859 (list |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
860 (concat |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
861 "server interpreter mi \"0-var-evaluate-expression " |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
862 (car varchild) "\"\n") |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
863 `(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
|
864 ,(car varchild) nil))))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
865 (push var var-list))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
866 (setq gdb-var-list (nreverse var-list))))) |
54538 | 867 |
868 (defun gdb-var-update () | |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
869 (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
|
870 (gdb-enqueue-input |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
871 (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
|
872 'gdb-var-update-handler)) |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
873 (push 'gdb-var-update gdb-pending-triggers))) |
54538 | 874 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
875 (defconst gdb-var-update-regexp |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
876 "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
877 type_changed=\".*?\".*?}") |
54538 | 878 |
879 (defun gdb-var-update-handler () | |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
880 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
881 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
882 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
883 (let ((n 0)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
884 (while (re-search-forward gdb-var-update-regexp nil t) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
885 (let ((varnum (match-string 1))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
886 (if (string-equal (match-string 2) "false") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
887 (let ((var (assoc varnum gdb-var-list))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
888 (if var (setcar (nthcdr 5 var) 'out-of-scope))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
889 (setq n (1+ n)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
890 (push n gdb-pending-triggers) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
891 (gdb-enqueue-input |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
892 (list |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
893 (concat "server interpreter mi \"" (number-to-string n) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
894 "-var-evaluate-expression " varnum "\"\n") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
895 `(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
|
896 (setq gdb-pending-triggers |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
897 (delq 'gdb-var-update gdb-pending-triggers))) |
54538 | 898 |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
899 (defun gdb-var-set-format (format) |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
900 "Set the output format for a variable displayed in the speedbar." |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
901 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
902 (varnum (car var))) |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
903 (gdb-enqueue-input |
79965
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
904 (list |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
905 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
906 (concat "server interpreter mi \"-var-set-format " |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
907 varnum " " format "\"\n") |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
908 (concat "-var-set-format " varnum " " format "\n")) |
79965
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
909 `(lambda () (gdb-var-set-format-handler ,varnum)))))) |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
910 |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
911 (defconst gdb-var-set-format-regexp |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
912 "format=\"\\(.*?\\)\",.*value=\"\\(.*?\\)\"") |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
913 |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
914 (defun gdb-var-set-format-handler (varnum) |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
915 (goto-char (point-min)) |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
916 (if (re-search-forward gdb-var-set-format-regexp nil t) |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
917 (let ((var (assoc varnum gdb-var-list))) |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
918 (setcar (nthcdr 4 var) (match-string 2)) |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
919 (gdb-var-update-1)))) |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
920 |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
921 (defun gdb-var-delete-1 (varnum) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
922 (gdb-enqueue-input |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
923 (list |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
924 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
925 (concat "server interpreter mi \"-var-delete " varnum "\"\n") |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
926 (concat "-var-delete " varnum "\n")) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
927 'ignore)) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
928 (setq gdb-var-list (delq var gdb-var-list)) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
929 (dolist (varchild gdb-var-list) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
930 (if (string-match (concat (car var) "\\.") (car varchild)) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
931 (setq gdb-var-list (delq varchild gdb-var-list))))) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
932 |
54538 | 933 (defun gdb-var-delete () |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
934 "Delete watch expression at point from the speedbar." |
54538 | 935 (interactive) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
936 (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
|
937 '(gdbmi gdba)) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
938 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
939 (varnum (car var))) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
940 (if (string-match "\\." (car var)) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
941 (message-box "Can only delete a root expression") |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
942 (gdb-var-delete-1 varnum))))) |
54538 | 943 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
944 (defun gdb-var-delete-children (varnum) |
74765
3cedab34a4b6
(gdb-stopped): After attaching to a process
Nick Roberts <nickrob@snap.net.nz>
parents:
74390
diff
changeset
|
945 "Delete children of variable object at point from the speedbar." |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
946 (gdb-enqueue-input |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
947 (list |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
948 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
949 (concat "server interpreter mi \"-var-delete -c " varnum "\"\n") |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
950 (concat "-var-delete -c " varnum "\n")) 'ignore))) |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
951 |
54538 | 952 (defun gdb-edit-value (text token indent) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
953 "Assign a value to a variable displayed in the speedbar." |
54538 | 954 (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
|
955 (varnum (car var)) (value)) |
54538 | 956 (setq value (read-string "New value: ")) |
957 (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
|
958 (list |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
959 (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
|
960 (concat "server interpreter mi \"-var-assign " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
961 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
|
962 (concat "-var-assign " varnum " " value "\n")) |
69325
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
963 `(lambda () (gdb-edit-value-handler ,value)))))) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
964 |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
965 (defun gdb-edit-value-handler (value) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
966 (goto-char (point-min)) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
967 (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
|
968 (message-box "Invalid number or expression (%s)" value))) |
54538 | 969 |
970 (defcustom gdb-show-changed-values t | |
68967
87bf1f965a0f
(gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68941
diff
changeset
|
971 "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
|
972 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
|
973 Changed values are highlighted with the face `font-lock-warning-face'." |
54538 | 974 :type 'boolean |
93765 | 975 :group 'gdb |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
976 :version "22.1") |
54538 | 977 |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
978 (defcustom gdb-max-children 40 |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
979 "Maximum number of children before expansion requires confirmation." |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
980 :type 'integer |
93765 | 981 :group 'gdb |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
982 :version "22.1") |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
983 |
79261
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
984 (defcustom gdb-delete-out-of-scope t |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
985 "If non-nil delete watch expressions automatically when they go out of scope." |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
986 :type 'boolean |
93765 | 987 :group 'gdb |
79261
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
988 :version "22.2") |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
989 |
54538 | 990 (defun gdb-speedbar-expand-node (text token indent) |
991 "Expand the node the user clicked on. | |
992 TEXT is the text of the button we clicked on, a + or - item. | |
993 TOKEN is data related to this node. | |
994 INDENT is the current indentation depth." | |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
995 (if (and gud-comint-buffer (buffer-name gud-comint-buffer)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
996 (progn |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
997 (cond ((string-match "+" text) ;expand this node |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
998 (let* ((var (assoc token gdb-var-list)) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
999 (expr (nth 1 var)) (children (nth 2 var))) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1000 (if (or (<= (string-to-number children) gdb-max-children) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1001 (y-or-n-p |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1002 (format |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1003 "%s has %s children. Continue? " expr children))) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1004 (if (and (eq (buffer-local-value |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1005 'gud-minor-mode gud-comint-buffer) 'gdba) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1006 (string-equal gdb-version "pre-6.4")) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1007 (gdb-var-list-children token) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
1008 (gdb-var-list-children-1 token))))) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1009 ((string-match "-" text) ;contract this node |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1010 (dolist (var gdb-var-list) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1011 (if (string-match (concat token "\\.") (car var)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1012 (setq gdb-var-list (delq var gdb-var-list)))) |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
1013 (gdb-var-delete-children token) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1014 (speedbar-change-expand-button-char ?+) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1015 (speedbar-delete-subblock indent)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1016 (t (error "Ooops... not sure what to do"))) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1017 (speedbar-center-buffer-smartly)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1018 (message-box "GUD session has been killed"))) |
54538 | 1019 |
1020 (defun gdb-get-target-string () | |
1021 (with-current-buffer gud-comint-buffer | |
1022 gud-target-name)) | |
1023 | |
1024 | |
1025 ;; | |
1026 ;; gdb buffers. | |
1027 ;; | |
1028 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
1029 ;; of that particular buffer. | |
1030 ;; | |
1031 ;; The usual gdb interaction buffer is given the type `gdba' and | |
1032 ;; is constructed specially. | |
1033 ;; | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1034 ;; Others are constructed by gdb-get-buffer-create and |
54538 | 1035 ;; named according to the rules set forth in the gdb-buffer-rules-assoc |
1036 | |
1037 (defvar gdb-buffer-rules-assoc '()) | |
1038 | |
1039 (defun gdb-get-buffer (key) | |
1040 "Return the gdb buffer tagged with type KEY. | |
1041 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
1042 (save-excursion | |
1043 (gdb-look-for-tagged-buffer key (buffer-list)))) | |
1044 | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1045 (defun gdb-get-buffer-create (key) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
1046 "Create a new gdb buffer of the type specified by KEY. |
54538 | 1047 The key should be one of the cars in `gdb-buffer-rules-assoc'." |
1048 (or (gdb-get-buffer key) | |
1049 (let* ((rules (assoc key gdb-buffer-rules-assoc)) | |
1050 (name (funcall (gdb-rules-name-maker rules))) | |
1051 (new (get-buffer-create name))) | |
1052 (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
|
1053 (let ((trigger)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1054 (if (cdr (cdr rules)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1055 (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
|
1056 (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
|
1057 (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
|
1058 (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
|
1059 (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
|
1060 (if trigger (funcall trigger))) |
54538 | 1061 new)))) |
1062 | |
1063 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
1064 | |
1065 (defun gdb-look-for-tagged-buffer (key bufs) | |
1066 (let ((retval nil)) | |
1067 (while (and (not retval) bufs) | |
1068 (set-buffer (car bufs)) | |
1069 (if (eq gdb-buffer-type key) | |
1070 (setq retval (car bufs))) | |
1071 (setq bufs (cdr bufs))) | |
1072 retval)) | |
1073 | |
1074 ;; | |
1075 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
1076 ;; at least one and possible more functions. The functions have these | |
1077 ;; roles in defining a buffer type: | |
1078 ;; | |
1079 ;; NAME - Return a name for this buffer type. | |
1080 ;; | |
1081 ;; The remaining function(s) are optional: | |
1082 ;; | |
1083 ;; MODE - called in a new buffer with no arguments, should establish | |
1084 ;; the proper mode for the buffer. | |
1085 ;; | |
1086 | |
1087 (defun gdb-set-buffer-rules (buffer-type &rest rules) | |
1088 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) | |
1089 (if binding | |
1090 (setcdr binding rules) | |
1091 (push (cons buffer-type rules) | |
1092 gdb-buffer-rules-assoc)))) | |
1093 | |
1094 ;; GUD buffers are an exception to the rules | |
1095 (gdb-set-buffer-rules 'gdba 'error) | |
1096 | |
1097 ;; Partial-output buffer : This accumulates output from a command executed on | |
1098 ;; behalf of emacs (rather than the user). | |
1099 ;; | |
1100 (gdb-set-buffer-rules 'gdb-partial-output-buffer | |
1101 'gdb-partial-output-name) | |
1102 | |
1103 (defun gdb-partial-output-name () | |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
1104 (concat " *partial-output-" |
54538 | 1105 (gdb-get-target-string) |
1106 "*")) | |
1107 | |
1108 | |
1109 (gdb-set-buffer-rules 'gdb-inferior-io | |
1110 'gdb-inferior-io-name | |
1111 'gdb-inferior-io-mode) | |
1112 | |
1113 (defun gdb-inferior-io-name () | |
1114 (concat "*input/output of " | |
1115 (gdb-get-target-string) | |
1116 "*")) | |
1117 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1118 (defun gdb-display-separate-io-buffer () |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1119 "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
|
1120 (interactive) |
68903
57fa3643220b
(gdb-display-separate-io-buffer): Change use of
Nick Roberts <nickrob@snap.net.nz>
parents:
68902
diff
changeset
|
1121 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1122 (gdb-display-buffer |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
1123 (gdb-get-buffer-create 'gdb-inferior-io) t))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1124 |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1125 (defconst gdb-frame-parameters |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1126 '((height . 14) (width . 80) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1127 (unsplittable . t) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1128 (tool-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1129 (menu-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1130 (minibuffer . nil))) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1131 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1132 (defun gdb-frame-separate-io-buffer () |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1133 "Display IO of debugged program in a new frame." |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1134 (interactive) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1135 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1136 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1137 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1138 (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
|
1139 |
54538 | 1140 (defvar gdb-inferior-io-mode-map |
1141 (let ((map (make-sparse-keymap))) | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1142 (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
|
1143 (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
|
1144 (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
|
1145 (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
|
1146 (define-key map "\C-d" 'gdb-separate-io-eof) |
54538 | 1147 map)) |
1148 | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1149 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
54538 | 1150 "Major mode for gdb inferior-io." |
1151 :syntax-table nil :abbrev-table nil | |
1152 ;; We want to use comint because it has various nifty and familiar | |
1153 ;; features. We don't need a process, but comint wants one, so create | |
1154 ;; a dummy one. | |
1155 (make-comint-in-buffer | |
1156 (substring (buffer-name) 1 (- (length (buffer-name)) 1)) | |
1157 (current-buffer) "hexl") | |
1158 (setq comint-input-sender 'gdb-inferior-io-sender)) | |
1159 | |
1160 (defun gdb-inferior-io-sender (proc string) | |
1161 ;; PROC is the pseudo-process created to satisfy comint. | |
1162 (with-current-buffer (process-buffer proc) | |
1163 (setq proc (get-buffer-process gud-comint-buffer)) | |
1164 (process-send-string proc string) | |
1165 (process-send-string proc "\n"))) | |
1166 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1167 (defun gdb-separate-io-interrupt () |
54538 | 1168 "Interrupt the program being debugged." |
1169 (interactive) | |
1170 (interrupt-process | |
1171 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1172 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1173 (defun gdb-separate-io-quit () |
54538 | 1174 "Send quit signal to the program being debugged." |
1175 (interactive) | |
1176 (quit-process | |
1177 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1178 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1179 (defun gdb-separate-io-stop () |
54538 | 1180 "Stop the program being debugged." |
1181 (interactive) | |
1182 (stop-process | |
1183 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1184 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1185 (defun gdb-separate-io-eof () |
54538 | 1186 "Send end-of-file to the program being debugged." |
1187 (interactive) | |
1188 (process-send-eof | |
1189 (get-buffer-process gud-comint-buffer))) | |
1190 | |
1191 | |
1192 ;; gdb communications | |
1193 ;; | |
1194 | |
1195 ;; INPUT: things sent to gdb | |
1196 ;; | |
1197 ;; The queues are lists. Each element is either a string (indicating user or | |
1198 ;; user-like input) or a list of the form: | |
1199 ;; | |
1200 ;; (INPUT-STRING HANDLER-FN) | |
1201 ;; | |
1202 ;; The handler function will be called from the partial-output buffer when the | |
1203 ;; command completes. This is the way to write commands which invoke gdb | |
1204 ;; commands autonomously. | |
1205 ;; | |
1206 ;; These lists are consumed tail first. | |
1207 ;; | |
1208 | |
1209 (defun gdb-send (proc string) | |
1210 "A comint send filter for gdb. | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1211 This filter may simply queue input for a later time." |
91867
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1212 (if gdb-ready |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1213 (progn |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1214 (with-current-buffer gud-comint-buffer |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1215 (let ((inhibit-read-only t)) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1216 (remove-text-properties (point-min) (point-max) '(face)))) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1217 (if gud-running |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1218 (progn |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1219 (let ((item (concat string "\n"))) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1220 (if gdb-enable-debug (push (cons 'send item) gdb-debug-log)) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1221 (process-send-string proc item))) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1222 (if (string-match "\\\\\\'" string) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1223 (setq gdb-continuation (concat gdb-continuation string "\n")) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1224 (let ((item (concat |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1225 gdb-continuation string |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1226 (if (not comint-input-sender-no-newline) "\n")))) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1227 (gdb-enqueue-input item) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1228 (setq gdb-continuation nil))))) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1229 (push (concat string "\n") gdb-early-user-input))) |
54538 | 1230 |
1231 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
1232 ;; is a query, or other non-top-level prompt. | |
1233 | |
1234 (defun gdb-enqueue-input (item) | |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1235 (if (not gud-running) |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1236 (if gdb-prompting |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1237 (progn |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1238 (gdb-send-item item) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1239 (setq gdb-prompting nil)) |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1240 (push item gdb-input-queue)))) |
54538 | 1241 |
1242 (defun gdb-dequeue-input () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1243 (let ((queue gdb-input-queue)) |
79812
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1244 (if queue |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1245 (let ((last (car (last queue)))) |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1246 (unless (nbutlast queue) (setq gdb-input-queue '())) |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1247 last) |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1248 ;; This should be nil here anyway but set it just to make sure. |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1249 (setq gdb-pending-triggers nil)))) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1250 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1251 (defun gdb-send-item (item) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1252 (setq gdb-flush-pending-output nil) |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1253 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1254 (setq gdb-current-item item) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1255 (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
|
1256 (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
|
1257 (if (stringp item) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1258 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1259 (setq gdb-output-sink 'user) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1260 (process-send-string process item)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1261 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1262 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1263 (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
|
1264 (process-send-string process |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1265 (car item)))) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1266 ;; case: eq gud-minor-mode 'gdbmi |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1267 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1268 (setq gdb-output-sink 'emacs) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1269 (process-send-string process (car item))))) |
54538 | 1270 |
1271 ;; | |
1272 ;; output -- things gdb prints to emacs | |
1273 ;; | |
1274 ;; GDB output is a stream interrupted by annotations. | |
1275 ;; Annotations can be recognized by their beginning | |
1276 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
1277 ;; | |
1278 ;; The tag is a string obeying symbol syntax. | |
1279 ;; | |
1280 ;; The optional part `<opt>' can be either the empty string | |
1281 ;; or a space followed by more data relating to the annotation. | |
1282 ;; For example, the SOURCE annotation is followed by a filename, | |
1283 ;; line number and various useless goo. This data must not include | |
1284 ;; any newlines. | |
1285 ;; | |
1286 | |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
1287 (defcustom gud-gdb-command-name "gdb --annotate=3" |
79724
1216df323631
(gud-gdb-command-name): Explain
Nick Roberts <nickrob@snap.net.nz>
parents:
79717
diff
changeset
|
1288 "Default command to execute an executable under the GDB debugger. |
1216df323631
(gud-gdb-command-name): Explain
Nick Roberts <nickrob@snap.net.nz>
parents:
79717
diff
changeset
|
1289 The option \"--annotate=3\" must be included in this value if you |
1216df323631
(gud-gdb-command-name): Explain
Nick Roberts <nickrob@snap.net.nz>
parents:
79717
diff
changeset
|
1290 want the GDB Graphical Interface." |
54538 | 1291 :type 'string |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
1292 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1293 :version "22.1") |
54538 | 1294 |
1295 (defvar gdb-annotation-rules | |
1296 '(("pre-prompt" gdb-pre-prompt) | |
1297 ("prompt" gdb-prompt) | |
1298 ("commands" gdb-subprompt) | |
1299 ("overload-choice" gdb-subprompt) | |
1300 ("query" gdb-subprompt) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1301 ;; 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
|
1302 ("nquery" gdb-subprompt) |
54538 | 1303 ("prompt-for-continue" gdb-subprompt) |
1304 ("post-prompt" gdb-post-prompt) | |
1305 ("source" gdb-source) | |
1306 ("starting" gdb-starting) | |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1307 ("exited" gdb-exited) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1308 ("signalled" gdb-signalled) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1309 ("signal" gdb-signal) |
54538 | 1310 ("breakpoint" gdb-stopping) |
1311 ("watchpoint" gdb-stopping) | |
1312 ("frame-begin" gdb-frame-begin) | |
1313 ("stopped" gdb-stopped) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1314 ("error-begin" gdb-error) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1315 ("error" gdb-error) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
1316 ("new-thread" (lambda (ignored) (gdb-get-buffer-create 'gdb-threads-buffer)))) |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
1317 "An assoc mapping annotation tags to functions which process them.") |
54538 | 1318 |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1319 (defun gdb-resync() |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1320 (setq gdb-flush-pending-output t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1321 (setq gud-running nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1322 (gdb-force-mode-line-update |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
1323 (propertize "stopped" 'face font-lock-warning-face)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1324 (setq gdb-output-sink 'user) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1325 (setq gdb-input-queue nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1326 (setq gdb-pending-triggers nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1327 (setq gdb-prompting t)) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1328 |
54538 | 1329 (defconst gdb-source-spec-regexp |
62716 | 1330 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)") |
54538 | 1331 |
1332 ;; Do not use this except as an annotation handler. | |
1333 (defun gdb-source (args) | |
1334 (string-match gdb-source-spec-regexp args) | |
1335 ;; Extract the frame position from the marker. | |
1336 (setq gud-last-frame | |
1337 (cons | |
1338 (match-string 1 args) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
1339 (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
|
1340 (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
|
1341 ;; cover for auto-display output which comes *before* |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1342 ;; stopped annotation |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1343 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) |
54538 | 1344 |
1345 (defun gdb-pre-prompt (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1346 "An annotation handler for `pre-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1347 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
|
1348 happens to be in effect." |
67164
c3990f178905
(gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents:
67147
diff
changeset
|
1349 (setq gdb-error nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1350 (let ((sink gdb-output-sink)) |
54538 | 1351 (cond |
1352 ((eq sink 'user) t) | |
1353 ((eq sink 'emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1354 (setq gdb-output-sink 'post-emacs)) |
54538 | 1355 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1356 (gdb-resync) |
54538 | 1357 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
1358 | |
1359 (defun gdb-prompt (ignored) | |
1360 "An annotation handler for `prompt'. | |
1361 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
|
1362 (when gdb-first-prompt |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
1363 (gdb-force-mode-line-update |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1364 (propertize "initializing..." 'face font-lock-variable-name-face)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1365 (gdb-init-1) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1366 (setq gdb-first-prompt nil)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1367 (let ((sink gdb-output-sink)) |
54538 | 1368 (cond |
1369 ((eq sink 'user) t) | |
1370 ((eq sink 'post-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1371 (setq gdb-output-sink 'user) |
54538 | 1372 (let ((handler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1373 (car (cdr gdb-current-item)))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1374 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1375 (funcall handler)))) |
1376 (t | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1377 (gdb-resync) |
54538 | 1378 (error "Phase error in gdb-prompt (got %s)" sink)))) |
1379 (let ((input (gdb-dequeue-input))) | |
1380 (if input | |
1381 (gdb-send-item input) | |
1382 (progn | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1383 (setq gdb-prompting t) |
91867
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1384 (gud-display-frame) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1385 (setq gdb-early-user-input (nreverse gdb-early-user-input)) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1386 (while gdb-early-user-input |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1387 (gdb-enqueue-input (car gdb-early-user-input)) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1388 (setq gdb-early-user-input (cdr gdb-early-user-input))))))) |
54538 | 1389 |
1390 (defun gdb-subprompt (ignored) | |
1391 "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
|
1392 (setq gdb-prompting t)) |
54538 | 1393 |
1394 (defun gdb-starting (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1395 "An annotation handler for `starting'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1396 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
|
1397 not GDB." |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1398 (setq gdb-active-process t) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1399 (setq gdb-printing t) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1400 (let ((sink gdb-output-sink)) |
54538 | 1401 (cond |
1402 ((eq sink 'user) | |
1403 (progn | |
1404 (setq gud-running t) | |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1405 (setq gdb-stack-update t) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1406 ;; Temporarily set gud-running to nil to force "info stack" onto queue. |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1407 (let ((gud-running nil)) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1408 (gdb-invalidate-frames)) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1409 (setq gdb-inferior-status "running") |
72492
2bf69eaa157d
(gdb-starting): Reset gdb-signalled to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
72481
diff
changeset
|
1410 (setq gdb-signalled nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1411 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1412 (propertize gdb-inferior-status 'face font-lock-type-face)) |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1413 (gdb-remove-text-properties) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1414 (setq gud-old-arrow gud-overlay-arrow-position) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
1415 (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
|
1416 (setq gdb-overlay-arrow-position nil) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
1417 (setq gdb-stack-position nil) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1418 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1419 (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
|
1420 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1421 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1422 (error "Unexpected `starting' annotation"))))) |
54538 | 1423 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1424 (defun gdb-signal (ignored) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1425 (setq gdb-inferior-status "signal") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1426 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1427 (propertize gdb-inferior-status 'face font-lock-warning-face)) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1428 (gdb-stopping ignored)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1429 |
54538 | 1430 (defun gdb-stopping (ignored) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1431 "An annotation handler for `breakpoint' and other annotations. |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1432 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
|
1433 being debugged." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1434 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1435 (let ((sink gdb-output-sink)) |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1436 (cond |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1437 ((eq sink 'inferior) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1438 (setq gdb-output-sink 'user)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1439 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1440 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1441 (error "Unexpected stopping annotation")))))) |
54538 | 1442 |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1443 (defun gdb-exited (ignored) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1444 "An annotation handler for `exited' and `signalled'. |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1445 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
|
1446 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
|
1447 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
|
1448 directives." |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1449 (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
|
1450 (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
|
1451 (setq gdb-overlay-arrow-position nil) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
1452 (setq gdb-stack-position nil) |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
1453 (setq gud-old-arrow nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1454 (setq gdb-inferior-status "exited") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1455 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1456 (propertize gdb-inferior-status 'face font-lock-warning-face)) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1457 (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
|
1458 |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1459 (defun gdb-signalled (ignored) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1460 (setq gdb-signalled t)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1461 |
54538 | 1462 (defun gdb-frame-begin (ignored) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1463 (setq gdb-frame-begin t) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1464 (setq gdb-printing nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1465 (let ((sink gdb-output-sink)) |
54538 | 1466 (cond |
1467 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1468 (setq gdb-output-sink 'user)) |
54538 | 1469 ((eq sink 'user) t) |
1470 ((eq sink 'emacs) t) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1471 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1472 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1473 (error "Unexpected frame-begin annotation (%S)" sink))))) |
54538 | 1474 |
94476
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
1475 (defcustom gdb-same-frame (not focus-follows-mouse) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1476 "Non-nil means pop up GUD buffer in same frame." |
93765 | 1477 :group 'gdb |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1478 :type 'boolean |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1479 :version "22.1") |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1480 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1481 (defcustom gdb-find-source-frame nil |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1482 "Non-nil means try to find a source frame further up stack e.g after signal." |
93765 | 1483 :group 'gdb |
72200
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1484 :type 'boolean |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1485 :version "22.1") |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1486 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1487 (defun gdb-find-source-frame (arg) |
94049
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
1488 "Toggle looking for a source frame further up call stack. |
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
1489 The code associated with current (innermost) frame may not have |
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
1490 been compiled with debug information, e.g., C library routine. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
1491 With prefix argument ARG, look for a source frame further up |
94049
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
1492 stack to display in the source buffer if ARG is positive, |
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
1493 otherwise don't look further up." |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1494 (interactive "P") |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1495 (setq gdb-find-source-frame |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1496 (if (null arg) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1497 (not gdb-find-source-frame) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1498 (> (prefix-numeric-value arg) 0))) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1499 (message (format "Looking for source frame %sabled" |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1500 (if gdb-find-source-frame "en" "dis")))) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1501 |
54538 | 1502 (defun gdb-stopped (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1503 "An annotation handler for `stopped'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1504 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
|
1505 sink to `user' in `gdb-stopping', that is fine." |
54538 | 1506 (setq gud-running nil) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1507 (unless (or gud-overlay-arrow-position gud-last-frame) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1508 (if (and gdb-frame-begin gdb-printing) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1509 (setq gud-overlay-arrow-position gud-old-arrow) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1510 ;;Pop up GUD buffer to display current frame when it doesn't have source |
74765
3cedab34a4b6
(gdb-stopped): After attaching to a process
Nick Roberts <nickrob@snap.net.nz>
parents:
74390
diff
changeset
|
1511 ;;information i.e if not compiled with -g as with libc routines generally. |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1512 (if gdb-same-frame |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1513 (gdb-display-gdb-buffer) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1514 (gdb-frame-gdb-buffer)) |
72200
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1515 (if gdb-find-source-frame |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1516 ;;Try to find source further up stack e.g after signal. |
72200
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1517 (setq gdb-look-up-stack |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1518 (if (gdb-get-buffer 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1519 'keep |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1520 (progn |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1521 (gdb-get-buffer-create 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1522 (gdb-invalidate-frames) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1523 'delete)))))) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1524 (unless (member gdb-inferior-status '("exited" "signal")) |
74765
3cedab34a4b6
(gdb-stopped): After attaching to a process
Nick Roberts <nickrob@snap.net.nz>
parents:
74390
diff
changeset
|
1525 (setq gdb-active-process t) ;Just for attaching case. |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1526 (setq gdb-inferior-status "stopped") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1527 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1528 (propertize gdb-inferior-status 'face font-lock-warning-face))) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1529 (let ((sink gdb-output-sink)) |
54538 | 1530 (cond |
1531 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1532 (setq gdb-output-sink 'user)) |
54538 | 1533 ((eq sink 'user) t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1534 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1535 (gdb-resync) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1536 (error "Unexpected stopped annotation")))) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1537 (if gdb-signalled (gdb-exited ignored))) |
54538 | 1538 |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1539 (defun gdb-error (ignored) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1540 (setq gdb-error (not gdb-error))) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1541 |
54538 | 1542 (defun gdb-post-prompt (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1543 "An annotation handler for `post-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1544 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
|
1545 happens to be appropriate." |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
1546 ;; 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
|
1547 ;; yet. |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1548 (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
|
1549 (gdb-get-selected-frame) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1550 (gdb-invalidate-frames) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1551 ;; 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
|
1552 (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
|
1553 (gdb-invalidate-breakpoints) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1554 ;; 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
|
1555 ;; so gdb-pc-address is updated. |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1556 ;; (gdb-invalidate-assembler) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1557 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1558 (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
|
1559 (gdb-invalidate-registers) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1560 (gdb-get-changed-registers) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1561 (gdb-invalidate-registers-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1562 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1563 (gdb-invalidate-memory) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1564 (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
|
1565 (gdb-invalidate-locals) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1566 (gdb-invalidate-locals-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1567 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1568 (gdb-invalidate-threads) |
94348
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
1569 (unless (or (null gdb-var-list) |
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
1570 (eq system-type 'darwin)) ;Breaks on Darwin's GDB-5.3. |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1571 ;; FIXME: with GDB-6 on Darwin, this might very well work. |
64654 | 1572 ;; 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
|
1573 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1574 (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
|
1575 (gdb-var-update) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1576 (gdb-var-update-1))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1577 (setq gdb-first-post-prompt nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1578 (let ((sink gdb-output-sink)) |
54538 | 1579 (cond |
1580 ((eq sink 'user) t) | |
1581 ((eq sink 'pre-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1582 (setq gdb-output-sink 'emacs)) |
54538 | 1583 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1584 (gdb-resync) |
54538 | 1585 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
1586 | |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1587 (defconst gdb-buffer-list |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1588 '(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
|
1589 |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1590 (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
|
1591 (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
|
1592 (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
|
1593 (if buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1594 (with-current-buffer buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1595 (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
|
1596 (remove-text-properties |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1597 (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
|
1598 |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1599 ;; 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
|
1600 ;; 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
|
1601 ;; visited breakpoint is, use that window. |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1602 (defun gdb-display-source-buffer (buffer) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1603 (let* ((last-window (if gud-last-last-frame |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1604 (get-buffer-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1605 (gud-find-file (car gud-last-last-frame))))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1606 (source-window (or last-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1607 (if (and gdb-source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1608 (window-live-p gdb-source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1609 gdb-source-window)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1610 (when source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1611 (setq gdb-source-window source-window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1612 (set-window-buffer source-window buffer)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1613 source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1614 |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1615 ;; Derived from gud-gdb-marker-regexp |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1616 (defvar gdb-fullname-regexp |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1617 (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*")) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1618 |
54538 | 1619 (defun gud-gdba-marker-filter (string) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1620 "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
|
1621 (if gdb-flush-pending-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1622 nil |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1623 (when gdb-enable-debug |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1624 (push (cons 'recv string) gdb-debug-log) |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1625 (if (and gdb-debug-log-max |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1626 (> (length gdb-debug-log) gdb-debug-log-max)) |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1627 (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil))) |
64654 | 1628 ;; 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
|
1629 (setq gud-marker-acc (concat gud-marker-acc string)) |
64654 | 1630 ;; 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
|
1631 (let ((output "")) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1632 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1633 ;; 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
|
1634 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1635 (let ((annotation (match-string 1 gud-marker-acc)) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1636 (before (substring gud-marker-acc 0 (match-beginning 0))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1637 (after (substring gud-marker-acc (match-end 0)))) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1638 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1639 ;; 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
|
1640 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1641 (let* ((annotation-type (match-string 1 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1642 (annotation-arguments (match-string 2 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1643 (annotation-rule (assoc annotation-type |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1644 gdb-annotation-rules)) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1645 (fullname (string-match gdb-fullname-regexp annotation-type))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1646 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1647 ;; Stuff prior to the match is just ordinary output. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1648 ;; It is either concatenated to OUTPUT or directed |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1649 ;; elsewhere. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1650 (setq output |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1651 (gdb-concat-output output |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1652 (concat before (if fullname "\n")))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1653 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1654 ;; Take that stuff off the gud-marker-acc. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1655 (setq gud-marker-acc after) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1656 |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1657 ;; Call the handler for this annotation. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1658 (if annotation-rule |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1659 (funcall (car (cdr annotation-rule)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1660 annotation-arguments) |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1661 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1662 ;; Switch to gud-gdb-marker-filter if appropriate. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1663 (when fullname |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1664 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1665 ;; Extract the frame position from the marker. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1666 (setq gud-last-frame (cons (match-string 1 annotation) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1667 (string-to-number |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1668 (match-string 2 annotation)))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1669 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1670 (set (make-local-variable 'gud-minor-mode) 'gdb) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1671 (set (make-local-variable 'gud-marker-filter) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1672 'gud-gdb-marker-filter))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1673 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1674 ;; Else the annotation is not recognized. Ignore it silently, |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1675 ;; so that GDB can add new annotations without causing |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1676 ;; us to blow up. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1677 ))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1678 |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1679 ;; 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
|
1680 ;; 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
|
1681 (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
|
1682 gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1683 (progn |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1684 ;; 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
|
1685 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1686 (gdb-concat-output output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1687 (substring gud-marker-acc 0 |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1688 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1689 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1690 ;; 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
|
1691 (setq gud-marker-acc (substring gud-marker-acc |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1692 (match-beginning 0)))) |
54538 | 1693 ;; |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1694 ;; In case we know the gud-marker-acc contains no partial annotations: |
54538 | 1695 (progn |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1696 (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
|
1697 (setq gud-marker-acc ""))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1698 output))) |
54538 | 1699 |
1700 (defun gdb-concat-output (so-far new) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1701 (if gdb-error |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1702 (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
|
1703 (let ((sink gdb-output-sink)) |
54538 | 1704 (cond |
1705 ((eq sink 'user) (concat so-far new)) | |
1706 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
1707 ((eq sink 'emacs) | |
1708 (gdb-append-to-partial-output new) | |
1709 so-far) | |
1710 ((eq sink 'inferior) | |
1711 (gdb-append-to-inferior-io new) | |
1712 so-far) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1713 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1714 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1715 (error "Bogon output sink %S" sink))))) |
54538 | 1716 |
1717 (defun gdb-append-to-partial-output (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1718 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1719 (goto-char (point-max)) |
1720 (insert string))) | |
1721 | |
1722 (defun gdb-clear-partial-output () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1723 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1724 (erase-buffer))) |
1725 | |
1726 (defun gdb-append-to-inferior-io (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1727 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1728 (goto-char (point-max)) |
1729 (insert-before-markers string)) | |
1730 (if (not (string-equal string "")) | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
1731 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t))) |
54538 | 1732 |
1733 (defun gdb-clear-inferior-io () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1734 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1735 (erase-buffer))) |
1736 | |
1737 | |
1738 ;; One trick is to have a command who's output is always available in a buffer | |
1739 ;; of it's own, and is always up to date. We build several buffers of this | |
1740 ;; type. | |
1741 ;; | |
1742 ;; There are two aspects to this: gdb has to tell us when the output for that | |
1743 ;; command might have changed, and we have to be able to run the command | |
1744 ;; behind the user's back. | |
1745 ;; | |
1746 ;; The output phasing associated with the variable gdb-output-sink | |
1747 ;; help us to run commands behind the user's back. | |
1748 ;; | |
1749 ;; Below is the code for specificly managing buffers of output from one | |
1750 ;; command. | |
1751 ;; | |
1752 | |
1753 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | |
1754 ;; It adds an input for the command we are tracking. It should be the | |
1755 ;; annotation rule binding of whatever gdb sends to tell us this command | |
1756 ;; might have changed it's output. | |
1757 ;; | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1758 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
54538 | 1759 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
1760 ;; input in the input queue (see comment about ``gdb communications'' above). | |
1761 | |
1762 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command | |
1763 output-handler) | |
1764 `(defun ,name (&optional ignored) | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1765 (if (and ,demand-predicate |
54538 | 1766 (not (member ',name |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1767 gdb-pending-triggers))) |
54538 | 1768 (progn |
1769 (gdb-enqueue-input | |
1770 (list ,gdb-command ',output-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1771 (push ',name gdb-pending-triggers))))) |
54538 | 1772 |
1773 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) | |
1774 `(defun ,name () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1775 (setq gdb-pending-triggers |
54538 | 1776 (delq ',trigger |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1777 gdb-pending-triggers)) |
54538 | 1778 (let ((buf (gdb-get-buffer ',buf-key))) |
1779 (and buf | |
1780 (with-current-buffer buf | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1781 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1782 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1783 (p (window-point window)) |
54538 | 1784 (buffer-read-only nil)) |
1785 (erase-buffer) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1786 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 1787 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1788 (set-window-start window start) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1789 (set-window-point window p))))) |
54538 | 1790 ;; put customisation here |
1791 (,custom-defun))) | |
1792 | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1793 (defmacro def-gdb-auto-updated-buffer (buffer-key |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1794 trigger-name gdb-command |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1795 output-handler-name custom-defun) |
54538 | 1796 `(progn |
1797 (def-gdb-auto-update-trigger ,trigger-name | |
1798 ;; The demand predicate: | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1799 (gdb-get-buffer ',buffer-key) |
54538 | 1800 ,gdb-command |
1801 ,output-handler-name) | |
1802 (def-gdb-auto-update-handler ,output-handler-name | |
1803 ,trigger-name ,buffer-key ,custom-defun))) | |
1804 | |
1805 | |
1806 ;; | |
1807 ;; Breakpoint buffer : This displays the output of `info breakpoints'. | |
1808 ;; | |
1809 (gdb-set-buffer-rules 'gdb-breakpoints-buffer | |
1810 'gdb-breakpoints-buffer-name | |
1811 'gdb-breakpoints-mode) | |
1812 | |
1813 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
1814 ;; This defines the auto update rule for buffers of type | |
1815 ;; `gdb-breakpoints-buffer'. | |
1816 ;; | |
1817 ;; It defines a function to serve as the annotation handler that | |
1818 ;; handles the `foo-invalidated' message. That function is called: | |
1819 gdb-invalidate-breakpoints | |
1820 ;; | |
1821 ;; To update the buffer, this command is sent to gdb. | |
1822 "server info breakpoints\n" | |
1823 ;; | |
1824 ;; This also defines a function to be the handler for the output | |
1825 ;; from the command above. That function will copy the output into | |
1826 ;; the appropriately typed buffer. That function will be called: | |
1827 gdb-info-breakpoints-handler | |
1828 ;; buffer specific functions | |
1829 gdb-info-breakpoints-custom) | |
1830 | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1831 (defconst breakpoint-xpm-data |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1832 "/* XPM */ |
54538 | 1833 static char *magick[] = { |
1834 /* columns rows colors chars-per-pixel */ | |
1835 \"10 10 2 1\", | |
1836 \" c red\", | |
1837 \"+ c None\", | |
1838 /* pixels */ | |
1839 \"+++ +++\", | |
1840 \"++ ++\", | |
1841 \"+ +\", | |
1842 \" \", | |
1843 \" \", | |
1844 \" \", | |
1845 \" \", | |
1846 \"+ +\", | |
1847 \"++ ++\", | |
1848 \"+++ +++\", | |
1849 };" | |
1850 "XPM data used for breakpoint icon.") | |
1851 | |
1852 (defconst breakpoint-enabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1853 "P1 |
54538 | 1854 10 10\", |
1855 0 0 0 0 1 1 1 1 0 0 0 0 | |
1856 0 0 0 1 1 1 1 1 1 0 0 0 | |
1857 0 0 1 1 1 1 1 1 1 1 0 0 | |
1858 0 1 1 1 1 1 1 1 1 1 1 0 | |
1859 0 1 1 1 1 1 1 1 1 1 1 0 | |
1860 0 1 1 1 1 1 1 1 1 1 1 0 | |
1861 0 1 1 1 1 1 1 1 1 1 1 0 | |
1862 0 0 1 1 1 1 1 1 1 1 0 0 | |
1863 0 0 0 1 1 1 1 1 1 0 0 0 | |
1864 0 0 0 0 1 1 1 1 0 0 0 0" | |
1865 "PBM data used for enabled breakpoint icon.") | |
1866 | |
1867 (defconst breakpoint-disabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1868 "P1 |
54538 | 1869 10 10\", |
1870 0 0 1 0 1 0 1 0 0 0 | |
1871 0 1 0 1 0 1 0 1 0 0 | |
1872 1 0 1 0 1 0 1 0 1 0 | |
1873 0 1 0 1 0 1 0 1 0 1 | |
1874 1 0 1 0 1 0 1 0 1 0 | |
1875 0 1 0 1 0 1 0 1 0 1 | |
1876 1 0 1 0 1 0 1 0 1 0 | |
1877 0 1 0 1 0 1 0 1 0 1 | |
1878 0 0 1 0 1 0 1 0 1 0 | |
1879 0 0 0 1 0 1 0 1 0 0" | |
1880 "PBM data used for disabled breakpoint icon.") | |
1881 | |
1882 (defvar breakpoint-enabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1883 "Icon for enabled breakpoint in display margin.") |
54538 | 1884 |
1885 (defvar breakpoint-disabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1886 "Icon for disabled breakpoint in display margin.") |
54538 | 1887 |
57982
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1888 (and (display-images-p) |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1889 ;; 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
|
1890 (define-fringe-bitmap 'breakpoint |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1891 "\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
|
1892 ;; 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
|
1893 (define-fringe-bitmap 'hollow-right-triangle |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1894 "\xe0\x90\x88\x84\x84\x88\x90\xe0")) |
54538 | 1895 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1896 (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
|
1897 '((t |
78112
6ad309ee5f4e
* replace.el (match): Use yellow1 instead of yellow.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76955
diff
changeset
|
1898 :foreground "red1" |
60869
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1899 :weight bold)) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1900 "Face for enabled breakpoint icon in fringe." |
93765 | 1901 :group 'gdb) |
54538 | 1902 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1903 (defface breakpoint-disabled |
76955
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1904 '((((class color) (min-colors 88)) :foreground "grey70") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1905 ;; Ensure that on low-color displays that we end up something visible. |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1906 (((class color) (min-colors 8) (background light)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1907 :foreground "black") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1908 (((class color) (min-colors 8) (background dark)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1909 :foreground "white") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1910 (((type tty) (class mono)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1911 :inverse-video t) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1912 (t :background "gray")) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1913 "Face for disabled breakpoint icon in fringe." |
93765 | 1914 :group 'gdb) |
54538 | 1915 |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
1916 (defconst gdb-breakpoint-regexp |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
1917 "\\(?:\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\|\\([0-9]+\\.[0-9]+\\)\\)\\s-+\\(.\\)\\s-+") |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
1918 |
64654 | 1919 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). |
54538 | 1920 (defun gdb-info-breakpoints-custom () |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1921 (let ((flag) (bptno)) |
64654 | 1922 ;; Remove all breakpoint-icons in source buffers but not assembler buffer. |
54538 | 1923 (dolist (buffer (buffer-list)) |
1924 (with-current-buffer buffer | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1925 (if (and (memq gud-minor-mode '(gdba gdbmi)) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
1926 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name)))) |
54538 | 1927 (gdb-remove-breakpoint-icons (point-min) (point-max))))) |
1928 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) | |
1929 (save-excursion | |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1930 (let ((buffer-read-only nil)) |
80536
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1931 (goto-char (point-min)) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1932 (while (< (point) (- (point-max) 1)) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1933 (forward-line 1) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1934 (if (looking-at gdb-breakpoint-regexp) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1935 (progn |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1936 (setq bptno (or (match-string 1) (match-string 2))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1937 (setq flag (char-after (match-beginning 3))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1938 (if (match-string 1) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1939 (setq gdb-parent-bptno-enabled (eq flag ?y))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1940 (add-text-properties |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1941 (match-beginning 3) (match-end 3) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1942 (if (eq flag ?y) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1943 '(face font-lock-warning-face) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1944 '(face font-lock-type-face))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1945 (let ((bl (point)) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1946 (el (line-end-position))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1947 (when (re-search-forward " in \\(.*\\) at" el t) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1948 (add-text-properties |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1949 (match-beginning 1) (match-end 1) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1950 '(face font-lock-function-name-face))) |
80540
e6565d8a8428
(gdb-info-breakpoints-custom): Don't throw error if no file is found.
Nick Roberts <nickrob@snap.net.nz>
parents:
80536
diff
changeset
|
1951 (if (re-search-forward |
e6565d8a8428
(gdb-info-breakpoints-custom): Don't throw error if no file is found.
Nick Roberts <nickrob@snap.net.nz>
parents:
80536
diff
changeset
|
1952 ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$" nil t) |
80536
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1953 (let ((line (match-string 2)) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1954 (file (match-string 1))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1955 (add-text-properties bl el |
80540
e6565d8a8428
(gdb-info-breakpoints-custom): Don't throw error if no file is found.
Nick Roberts <nickrob@snap.net.nz>
parents:
80536
diff
changeset
|
1956 '(mouse-face highlight |
e6565d8a8428
(gdb-info-breakpoints-custom): Don't throw error if no file is found.
Nick Roberts <nickrob@snap.net.nz>
parents:
80536
diff
changeset
|
1957 help-echo "mouse-2, RET: visit breakpoint")) |
80536
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1958 (unless (file-exists-p file) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1959 (setq file (cdr (assoc bptno gdb-location-alist)))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1960 (if (and file |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1961 (not (string-equal file "File not found"))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1962 (with-current-buffer |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1963 (find-file-noselect file 'nowarn) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1964 (gdb-init-buffer) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1965 ;; Only want one breakpoint icon at each |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1966 ;; location. |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1967 (save-excursion |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1968 (goto-line (string-to-number line)) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1969 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1970 (gdb-enqueue-input |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1971 (list |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1972 (concat gdb-server-prefix "list " |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1973 (match-string-no-properties 1) ":1\n") |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1974 'ignore)) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1975 (gdb-enqueue-input |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1976 (list (concat gdb-server-prefix "info source\n") |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1977 `(lambda () (gdb-get-location |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1978 ,bptno ,line ,flag)))))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1979 (if (re-search-forward |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1980 "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1981 el t) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1982 (add-text-properties |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1983 (match-beginning 1) (match-end 1) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1984 '(face font-lock-function-name-face)) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1985 (end-of-line) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1986 (re-search-backward "\\s-\\(\\S-*\\)" |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1987 bl t) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1988 (add-text-properties |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1989 (match-beginning 1) (match-end 1) |
80536
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1990 '(face font-lock-variable-name-face))))))) |
4b0ab9e918cd
(gdb-info-breakpoints-custom): Fix mismatched parentheses.
Nick Roberts <nickrob@snap.net.nz>
parents:
80535
diff
changeset
|
1991 (end-of-line)))))) |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1992 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1993 |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1994 ;; Breakpoints buffer is always present. Hack to just update |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1995 ;; current frame if there's been no execution. |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1996 (if gdb-stack-update |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1997 (setq gdb-stack-update nil) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
1998 (if (gdb-get-buffer 'gdb-stack-buffer) (gdb-info-stack-custom)))) |
54538 | 1999 |
86886
f43509daf0ee
(gud-remove, gud-break): Declare as functions.
Glenn Morris <rgm@gnu.org>
parents:
86227
diff
changeset
|
2000 (declare-function gud-remove "gdb-ui" t t) ; gud-def |
f43509daf0ee
(gud-remove, gud-break): Declare as functions.
Glenn Morris <rgm@gnu.org>
parents:
86227
diff
changeset
|
2001 (declare-function gud-break "gdb-ui" t t) ; gud-def |
54538 | 2002 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2003 (defun gdb-mouse-set-clear-breakpoint (event) |
93619
a1760b9403f6
(gdb-mouse-set-clear-breakpoint):
Nick Roberts <nickrob@snap.net.nz>
parents:
92360
diff
changeset
|
2004 "Set/clear breakpoint in left fringe/margin at mouse click. |
a1760b9403f6
(gdb-mouse-set-clear-breakpoint):
Nick Roberts <nickrob@snap.net.nz>
parents:
92360
diff
changeset
|
2005 If not in a source or disassembly buffer just set point." |
54538 | 2006 (interactive "e") |
2007 (mouse-minibuffer-check event) | |
2008 (let ((posn (event-end event))) | |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2009 (with-selected-window (posn-window posn) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2010 (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode)) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2011 (if (numberp (posn-point posn)) |
80167
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2012 (save-excursion |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2013 (goto-char (posn-point posn)) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2014 (if (or (posn-object posn) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2015 (eq (car (fringe-bitmaps-at-pos (posn-point posn))) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2016 'breakpoint)) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2017 (gud-remove nil) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2018 (gud-break nil))))) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
2019 (posn-set-point posn)))) |
54538 | 2020 |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2021 (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
|
2022 "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
|
2023 (interactive "e") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2024 (mouse-minibuffer-check event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2025 (let ((posn (event-end event))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2026 (if (numberp (posn-point posn)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2027 (with-selected-window (posn-window posn) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2028 (save-excursion |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2029 (goto-char (posn-point posn)) |
64654 | 2030 (if (posn-object posn) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2031 (let* ((bptno (get-text-property |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2032 0 'gdb-bptno (car (posn-string posn))))) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2033 (string-match "\\([0-9+]\\)*" bptno) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2034 (gdb-enqueue-input |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2035 (list |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2036 (concat gdb-server-prefix |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2037 (if (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2038 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
|
2039 "disable " |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2040 "enable ") |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2041 (match-string 1 bptno) "\n") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2042 'ignore))))))))) |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2043 |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2044 (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
|
2045 "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
|
2046 (interactive "e") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2047 (mouse-minibuffer-check event) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2048 (let* ((posn (event-end event)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2049 (pos (posn-point posn)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2050 obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2051 (when (numberp pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2052 (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
|
2053 (save-excursion |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2054 (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
|
2055 (goto-char pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2056 (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
|
2057 (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
|
2058 (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
|
2059 (when (stringp obj) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2060 (let* ((bptno (get-text-property 0 'gdb-bptno obj))) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2061 (string-match "\\([0-9+]\\)*" bptno) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2062 (gdb-enqueue-input |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2063 (list |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2064 (concat gdb-server-prefix |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2065 (if (get-text-property 0 'gdb-enabled obj) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2066 "disable " |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2067 "enable ") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2068 (match-string 1 bptno) "\n") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2069 'ignore))))))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2070 |
54538 | 2071 (defun gdb-breakpoints-buffer-name () |
2072 (with-current-buffer gud-comint-buffer | |
2073 (concat "*breakpoints of " (gdb-get-target-string) "*"))) | |
2074 | |
2075 (defun gdb-display-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2076 "Display status of user-settable breakpoints." |
54538 | 2077 (interactive) |
2078 (gdb-display-buffer | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2079 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t)) |
54538 | 2080 |
2081 (defun gdb-frame-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2082 "Display status of user-settable breakpoints in a new frame." |
54538 | 2083 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2084 (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
|
2085 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2086 (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer)))) |
54538 | 2087 |
2088 (defvar gdb-breakpoints-mode-map | |
2089 (let ((map (make-sparse-keymap)) | |
2090 (menu (make-sparse-keymap "Breakpoints"))) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2091 (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
|
2092 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
54538 | 2093 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2094 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
54538 | 2095 (suppress-keymap map) |
2096 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) | |
2097 (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
|
2098 (define-key map "D" 'gdb-delete-breakpoint) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2099 ;; 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
|
2100 (define-key map "q" 'gdb-delete-frame-or-window) |
54538 | 2101 (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
|
2102 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2103 (define-key map [follow-link] 'mouse-face) |
54538 | 2104 map)) |
2105 | |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2106 (defun gdb-delete-frame-or-window () |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2107 "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
|
2108 (interactive) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2109 (if (one-window-p) (delete-frame) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2110 (delete-window))) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2111 |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2112 ;;from make-mode-line-mouse-map |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2113 (defun gdb-make-header-line-mouse-map (mouse function) "\ |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2114 Return a keymap with single entry for mouse key MOUSE on the header line. |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2115 MOUSE is defined to run function FUNCTION with no args in the buffer |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2116 corresponding to the mode line clicked." |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2117 (let ((map (make-sparse-keymap))) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2118 (define-key map (vector 'header-line mouse) function) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2119 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2120 map)) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2121 |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2122 (defvar gdb-breakpoints-header |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2123 `(,(propertize "Breakpoints" |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2124 'help-echo "mouse-1: select" |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2125 'mouse-face 'mode-line-highlight |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2126 'face 'mode-line |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2127 'local-map |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2128 (gdb-make-header-line-mouse-map |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2129 'mouse-1 |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2130 (lambda (event) (interactive "e") |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2131 (save-selected-window |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2132 (select-window (posn-window (event-start event))) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2133 (set-window-dedicated-p (selected-window) nil) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2134 (switch-to-buffer |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2135 (gdb-get-buffer-create 'gdb-breakpoints-buffer)) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2136 (set-window-dedicated-p (selected-window) t))))) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2137 " " |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2138 ,(propertize "Threads" |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2139 'help-echo "mouse-1: select" |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2140 'mouse-face 'mode-line-highlight |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2141 'face 'mode-line |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2142 'local-map |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2143 (gdb-make-header-line-mouse-map |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2144 'mouse-1 |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2145 (lambda (event) (interactive "e") |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2146 (save-selected-window |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2147 (select-window (posn-window (event-start event))) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2148 (set-window-dedicated-p (selected-window) nil) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2149 (switch-to-buffer |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2150 (gdb-get-buffer-create 'gdb-threads-buffer)) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2151 (set-window-dedicated-p (selected-window) t))))))) |
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2152 |
54538 | 2153 (defun gdb-breakpoints-mode () |
2154 "Major mode for gdb breakpoints. | |
2155 | |
2156 \\{gdb-breakpoints-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2157 (kill-all-local-variables) |
54538 | 2158 (setq major-mode 'gdb-breakpoints-mode) |
2159 (setq mode-name "Breakpoints") | |
2160 (use-local-map gdb-breakpoints-mode-map) | |
2161 (setq buffer-read-only t) | |
94339
bac78d3bb2ee
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94336
diff
changeset
|
2162 (buffer-disable-undo) |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2163 (setq header-line-format gdb-breakpoints-header) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2164 (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
|
2165 (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
|
2166 'gdb-invalidate-breakpoints |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2167 'gdbmi-invalidate-breakpoints)) |
54538 | 2168 |
2169 (defun gdb-toggle-breakpoint () | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2170 "Enable/disable breakpoint at current line." |
54538 | 2171 (interactive) |
2172 (save-excursion | |
2173 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2174 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2175 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2176 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2177 (concat gdb-server-prefix |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2178 (if (eq ?y (char-after (match-beginning 3))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2179 "disable " |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2180 "enable ") |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2181 (or (match-string 1) (match-string 2)) "\n") 'ignore)) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2182 (error "Not recognized as break/watchpoint line")))) |
54538 | 2183 |
2184 (defun gdb-delete-breakpoint () | |
2185 "Delete the breakpoint at current line." | |
2186 (interactive) | |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2187 (save-excursion |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2188 (beginning-of-line 1) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2189 (if (looking-at gdb-breakpoint-regexp) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2190 (if (match-string 1) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2191 (gdb-enqueue-input |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2192 (list |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2193 (concat gdb-server-prefix "delete " (match-string 1) "\n") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2194 'ignore)) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2195 (message-box "This breakpoint cannot be deleted on its own.")) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2196 (error "Not recognized as break/watchpoint line")))) |
54538 | 2197 |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2198 (defun gdb-goto-breakpoint (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2199 "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
|
2200 (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
|
2201 (if event (posn-set-point (event-end event))) |
54538 | 2202 (save-excursion |
2203 (beginning-of-line 1) | |
80535
106730cfdf95
(gdb-info-breakpoints-custom): Make breakpoint
Nick Roberts <nickrob@snap.net.nz>
parents:
80510
diff
changeset
|
2204 (if (looking-at "\\([0-9]+\\.?[0-9]*\\) .*\\s-+\\(\\S-+\\):\\([0-9]+\\)$") |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2205 (let ((bptno (match-string 1)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2206 (file (match-string 2)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2207 (line (match-string 3))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2208 (save-selected-window |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2209 (let* ((buffer (find-file-noselect |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2210 (if (file-exists-p file) file |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2211 (cdr (assoc bptno gdb-location-alist))))) |
70428
1a065139c7c3
(gdb-goto-breakpoint): Use or instead of unless so nil isn't returned.
Nick Roberts <nickrob@snap.net.nz>
parents:
70372
diff
changeset
|
2212 (window (or (gdb-display-source-buffer buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2213 (display-buffer buffer)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2214 (setq gdb-source-window window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2215 (with-current-buffer buffer |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2216 (goto-line (string-to-number line)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2217 (set-window-point window (point)))))) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2218 (error "No location specified.")))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2219 |
54538 | 2220 |
80535
106730cfdf95
(gdb-info-breakpoints-custom): Make breakpoint
Nick Roberts <nickrob@snap.net.nz>
parents:
80510
diff
changeset
|
2221 ;; Frames buffer. This displays a perpetually correct backtrace |
54538 | 2222 ;; (from the command `where'). |
2223 ;; | |
2224 ;; Alas, if your stack is deep, it is costly. | |
2225 ;; | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2226 (defcustom gdb-max-frames 40 |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2227 "Maximum number of frames displayed in call stack." |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2228 :type 'integer |
93765 | 2229 :group 'gdb |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2230 :version "22.1") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2231 |
54538 | 2232 (gdb-set-buffer-rules 'gdb-stack-buffer |
2233 'gdb-stack-buffer-name | |
2234 'gdb-frames-mode) | |
2235 | |
2236 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
2237 gdb-invalidate-frames | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2238 (concat "server info stack " (number-to-string gdb-max-frames) "\n") |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2239 gdb-info-stack-handler |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2240 gdb-info-stack-custom) |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2241 |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2242 ;; This may be more important for embedded targets where unwinding the |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2243 ;; stack may take a long time. |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2244 (defadvice gdb-invalidate-frames (around gdb-invalidate-frames-advice |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2245 (&optional ignored) activate compile) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2246 "Only queue \"info stack\" if execution has occurred." |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2247 (if gdb-stack-update ad-do-it)) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2248 |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2249 (defun gdb-info-stack-custom () |
54538 | 2250 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2251 (let (move-to) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2252 (save-excursion |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2253 (unless (eq gdb-look-up-stack 'delete) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2254 (let ((buffer-read-only nil) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2255 bl el) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2256 (goto-char (point-min)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2257 (while (< (point) (point-max)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2258 (setq bl (line-beginning-position) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2259 el (line-end-position)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2260 (when (looking-at "#") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2261 (add-text-properties bl el |
94445
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2262 '(mouse-face highlight |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2263 help-echo "mouse-2, RET: Select frame"))) |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2264 (goto-char bl) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2265 (when (looking-at "^#\\([0-9]+\\)") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2266 (when (string-equal (match-string 1) gdb-frame-number) |
94445
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2267 (if (gud-tool-bar-item-visible-no-fringe) |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2268 (progn |
94445
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2269 (put-text-property bl (+ bl 4) |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2270 'face '(:inverse-video t)) |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2271 (setq move-to bl)) |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2272 (or gdb-stack-position |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2273 (setq gdb-stack-position (make-marker))) |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2274 (set-marker gdb-stack-position (point)) |
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
2275 (setq move-to gdb-stack-position))) |
92324
516d1f9d5ddb
(gdb-info-stack-custom): Apply
Nick Roberts <nickrob@snap.net.nz>
parents:
92148
diff
changeset
|
2276 (when (re-search-forward "\\([^ ]+\\) (" el t) |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2277 (put-text-property (match-beginning 1) (match-end 1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2278 'face font-lock-function-name-face) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2279 (setq bl (match-end 0)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2280 (while (re-search-forward "<\\([^>]+\\)>" el t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2281 (put-text-property (match-beginning 1) (match-end 1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2282 'face font-lock-function-name-face)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2283 (goto-char bl) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2284 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2285 (put-text-property (match-beginning 1) (match-end 1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2286 'face font-lock-variable-name-face)))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2287 (forward-line 1)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2288 (forward-line -1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2289 (when (looking-at "(More stack frames follow...)") |
94483
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
2290 (add-text-properties |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
2291 (match-beginning 0) (match-end 0) |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
2292 '(mouse-face highlight |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
2293 gdb-max-frames t |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
2294 help-echo |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
2295 "mouse-2, RET: customize gdb-max-frames to see more frames" |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
2296 ))))) |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2297 (when gdb-look-up-stack |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2298 (goto-char (point-min)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2299 (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2300 (let ((start (line-beginning-position)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2301 (file (match-string 1)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2302 (line (match-string 2))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2303 (re-search-backward "^#*\\([0-9]+\\)" start t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2304 (gdb-enqueue-input |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2305 (list (concat gdb-server-prefix "frame " |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2306 (match-string 1) "\n") 'gdb-set-hollow)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2307 (gdb-enqueue-input |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2308 (list (concat gdb-server-prefix "frame 0\n") 'ignore)))))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2309 (when move-to |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2310 (let ((window (get-buffer-window (current-buffer) 0))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2311 (when window |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2312 (with-selected-window window |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2313 (goto-char move-to) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2314 (unless (pos-visible-in-window-p) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2315 (recenter '(center))))))))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2316 (if (eq gdb-look-up-stack 'delete) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2317 (kill-buffer (gdb-get-buffer 'gdb-stack-buffer))) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2318 (setq gdb-look-up-stack nil)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2319 |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2320 (defun gdb-set-hollow () |
72224
6564e84a8e09
(gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents:
72200
diff
changeset
|
2321 (if gud-last-last-frame |
6564e84a8e09
(gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents:
72200
diff
changeset
|
2322 (with-current-buffer (gud-find-file (car gud-last-last-frame)) |
6564e84a8e09
(gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents:
72200
diff
changeset
|
2323 (setq fringe-indicator-alist |
6564e84a8e09
(gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents:
72200
diff
changeset
|
2324 '((overlay-arrow . hollow-right-triangle)))))) |
54538 | 2325 |
2326 (defun gdb-stack-buffer-name () | |
2327 (with-current-buffer gud-comint-buffer | |
2328 (concat "*stack frames of " (gdb-get-target-string) "*"))) | |
2329 | |
2330 (defun gdb-display-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2331 "Display backtrace of current stack." |
54538 | 2332 (interactive) |
2333 (gdb-display-buffer | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2334 (gdb-get-buffer-create 'gdb-stack-buffer) t)) |
54538 | 2335 |
2336 (defun gdb-frame-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2337 "Display backtrace of current stack in a new frame." |
54538 | 2338 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2339 (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
|
2340 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2341 (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer)))) |
54538 | 2342 |
2343 (defvar gdb-frames-mode-map | |
2344 (let ((map (make-sparse-keymap))) | |
2345 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2346 (define-key map "q" 'kill-this-buffer) |
54538 | 2347 (define-key map "\r" 'gdb-frames-select) |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2348 (define-key map "F" 'gdb-frames-force-update) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2349 (define-key map [mouse-2] 'gdb-frames-select) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2350 (define-key map [follow-link] 'mouse-face) |
54538 | 2351 map)) |
2352 | |
94227
c5e5de94d51f
(gdbmi-invalidate-frames): Declare as function.
Glenn Morris <rgm@gnu.org>
parents:
94192
diff
changeset
|
2353 (declare-function gdbmi-invalidate-frames "ext:gdb-mi" nil t) |
c5e5de94d51f
(gdbmi-invalidate-frames): Declare as function.
Glenn Morris <rgm@gnu.org>
parents:
94192
diff
changeset
|
2354 |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2355 (defun gdb-frames-force-update () |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2356 "Force update of call stack. |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2357 Use when the displayed call stack gets out of sync with the |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2358 actual one, e.g after using the Gdb command \"return\" or setting |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2359 $pc directly from the GUD buffer. This command isn't normally needed." |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2360 (interactive) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2361 (setq gdb-stack-update t) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2362 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2363 (gdb-invalidate-frames) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2364 (gdbmi-invalidate-frames))) |
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2365 |
54538 | 2366 (defun gdb-frames-mode () |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2367 "Major mode for gdb call stack. |
54538 | 2368 |
2369 \\{gdb-frames-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2370 (kill-all-local-variables) |
54538 | 2371 (setq major-mode 'gdb-frames-mode) |
2372 (setq mode-name "Frames") | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2373 (setq gdb-stack-position nil) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2374 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) |
75690
cb2393a69028
(gdb-frames-mode): Truncate lines in stack
Nick Roberts <nickrob@snap.net.nz>
parents:
75589
diff
changeset
|
2375 (setq truncate-lines t) ;; Make it easier to see overlay arrow. |
54538 | 2376 (setq buffer-read-only t) |
94339
bac78d3bb2ee
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94336
diff
changeset
|
2377 (buffer-disable-undo) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2378 (gdb-thread-identification) |
54538 | 2379 (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
|
2380 (run-mode-hooks 'gdb-frames-mode-hook) |
94128
c1450edc341a
(gdb-stack-update): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94049
diff
changeset
|
2381 (setq gdb-stack-update t) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
2382 (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
|
2383 'gdb-invalidate-frames |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2384 'gdbmi-invalidate-frames)) |
54538 | 2385 |
2386 (defun gdb-get-frame-number () | |
2387 (save-excursion | |
65861
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
2388 (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
|
2389 (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
|
2390 (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2391 (n (or (and pos (match-string 1)) "0"))) |
54538 | 2392 n))) |
2393 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2394 (defun gdb-frames-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2395 "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
|
2396 (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
|
2397 (if event (posn-set-point (event-end event))) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2398 (if (get-text-property (point) 'gdb-max-frames) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2399 (progn |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2400 (message-box "After setting gdb-max-frames, you need to enter\n\ |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2401 another GDB command e.g pwd, to see new frames") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2402 (customize-variable-other-window 'gdb-max-frames)) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2403 (gdb-enqueue-input |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2404 (list (concat gdb-server-prefix "frame " |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2405 (gdb-get-frame-number) "\n") 'ignore)))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2406 |
54538 | 2407 |
2408 ;; Threads buffer. This displays a selectable thread list. | |
2409 ;; | |
2410 (gdb-set-buffer-rules 'gdb-threads-buffer | |
2411 'gdb-threads-buffer-name | |
2412 'gdb-threads-mode) | |
2413 | |
2414 (def-gdb-auto-updated-buffer gdb-threads-buffer | |
2415 gdb-invalidate-threads | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2416 (concat gdb-server-prefix "info threads\n") |
54538 | 2417 gdb-info-threads-handler |
2418 gdb-info-threads-custom) | |
2419 | |
2420 (defun gdb-info-threads-custom () | |
2421 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | |
2422 (let ((buffer-read-only nil)) | |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2423 (save-excursion |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2424 (goto-char (point-min)) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2425 (if (re-search-forward "\\* \\([0-9]+\\)" nil t) |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2426 (setq gdb-thread-indicator |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2427 (propertize (concat " [" (match-string 1) "]") |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2428 ; FIXME: this help-echo doesn't work |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2429 'help-echo "thread id"))) |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2430 (goto-char (point-min)) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2431 (while (< (point) (point-max)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2432 (unless (looking-at "No ") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2433 (add-text-properties (line-beginning-position) (line-end-position) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2434 '(mouse-face highlight |
66637
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
2435 help-echo "mouse-2, RET: select thread"))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2436 (forward-line 1)))))) |
54538 | 2437 |
2438 (defun gdb-threads-buffer-name () | |
2439 (with-current-buffer gud-comint-buffer | |
2440 (concat "*threads of " (gdb-get-target-string) "*"))) | |
2441 | |
2442 (defun gdb-display-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2443 "Display IDs of currently known threads." |
54538 | 2444 (interactive) |
2445 (gdb-display-buffer | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2446 (gdb-get-buffer-create 'gdb-threads-buffer) t)) |
54538 | 2447 |
2448 (defun gdb-frame-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2449 "Display IDs of currently known threads in a new frame." |
54538 | 2450 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2451 (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
|
2452 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2453 (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer)))) |
54538 | 2454 |
2455 (defvar gdb-threads-mode-map | |
2456 (let ((map (make-sparse-keymap))) | |
2457 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2458 (define-key map "q" 'kill-this-buffer) |
54538 | 2459 (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
|
2460 (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
|
2461 (define-key map [follow-link] 'mouse-face) |
54538 | 2462 map)) |
2463 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2464 (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
|
2465 '((") +\\([^ ]+\\) (" (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
|
2466 ("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
|
2467 ("\\(\\(\\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
|
2468 "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
|
2469 |
54538 | 2470 (defun gdb-threads-mode () |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2471 "Major mode for gdb threads. |
54538 | 2472 |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2473 \\{gdb-threads-mode-map}" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2474 (kill-all-local-variables) |
54538 | 2475 (setq major-mode 'gdb-threads-mode) |
2476 (setq mode-name "Threads") | |
2477 (setq buffer-read-only t) | |
94339
bac78d3bb2ee
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94336
diff
changeset
|
2478 (buffer-disable-undo) |
94192
1ec796ca1199
(gdb-mouse-set-clear-breakpoint): Select
Nick Roberts <nickrob@snap.net.nz>
parents:
94185
diff
changeset
|
2479 (setq header-line-format gdb-breakpoints-header) |
54538 | 2480 (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
|
2481 (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
|
2482 '(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
|
2483 (run-mode-hooks 'gdb-threads-mode-hook) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2484 ;; Force "info threads" onto queue. |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2485 (lambda () (let ((gud-running nil)) (gdb-invalidate-threads)))) |
54538 | 2486 |
2487 (defun gdb-get-thread-number () | |
2488 (save-excursion | |
2489 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) | |
2490 (match-string-no-properties 1))) | |
2491 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2492 (defun gdb-threads-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2493 "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
|
2494 (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
|
2495 (if event (posn-set-point (event-end event))) |
54538 | 2496 (gdb-enqueue-input |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2497 (list (concat gdb-server-prefix "thread " |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2498 (gdb-get-thread-number) "\n") 'ignore)) |
54538 | 2499 (gud-display-frame)) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2500 |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2501 (defun gdb-thread-identification () |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2502 (setq mode-line-buffer-identification |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2503 (list (car mode-line-buffer-identification) |
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2504 '(gdb-thread-indicator gdb-thread-indicator)))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2505 |
54538 | 2506 ;; Registers buffer. |
2507 ;; | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2508 (defcustom gdb-all-registers nil |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2509 "Non-nil means include floating-point registers." |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2510 :type 'boolean |
93765 | 2511 :group 'gdb |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2512 :version "22.1") |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2513 |
54538 | 2514 (gdb-set-buffer-rules 'gdb-registers-buffer |
2515 'gdb-registers-buffer-name | |
2516 'gdb-registers-mode) | |
2517 | |
2518 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
2519 gdb-invalidate-registers | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2520 (concat |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2521 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n") |
54538 | 2522 gdb-info-registers-handler |
2523 gdb-info-registers-custom) | |
2524 | |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2525 (defun gdb-info-registers-custom () |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2526 (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
|
2527 (save-excursion |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2528 (let ((buffer-read-only nil) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2529 start end) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2530 (goto-char (point-min)) |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2531 (while (< (point) (point-max)) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2532 (setq start (line-beginning-position)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2533 (setq end (line-end-position)) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2534 (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
|
2535 (unless (string-equal (match-string 0) "The") |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2536 (put-text-property start (match-end 0) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2537 '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
|
2538 (add-text-properties start end |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2539 '(help-echo "mouse-2: edit value" |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2540 mouse-face highlight)))) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2541 (forward-line 1)))))) |
54538 | 2542 |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2543 (defun gdb-edit-register-value (&optional event) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2544 (interactive (list last-input-event)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2545 (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
|
2546 (if event (posn-set-point (event-end event))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2547 (beginning-of-line) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2548 (let* ((register (current-word)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2549 (value (read-string (format "New value (%s): " register)))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2550 (gdb-enqueue-input |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2551 (list (concat gdb-server-prefix "set $" register "=" value "\n") |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2552 'ignore))))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2553 |
54538 | 2554 (defvar gdb-registers-mode-map |
2555 (let ((map (make-sparse-keymap))) | |
2556 (suppress-keymap map) | |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2557 (define-key map "\r" 'gdb-edit-register-value) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2558 (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
|
2559 (define-key map " " 'gdb-all-registers) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2560 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2561 map)) |
54538 | 2562 |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2563 (defvar gdb-locals-header |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2564 `(,(propertize "Locals" |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2565 'help-echo "mouse-1: select" |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2566 'mouse-face 'mode-line-highlight |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2567 'face 'mode-line |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2568 'local-map |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2569 (gdb-make-header-line-mouse-map |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2570 'mouse-1 |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2571 (lambda (event) (interactive "e") |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2572 (save-selected-window |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2573 (select-window (posn-window (event-start event))) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2574 (set-window-dedicated-p (selected-window) nil) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2575 (switch-to-buffer |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2576 (gdb-get-buffer-create 'gdb-locals-buffer)) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2577 (set-window-dedicated-p (selected-window) t))))) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2578 " " |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2579 ,(propertize "Registers" |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2580 'help-echo "mouse-1: select" |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2581 'mouse-face 'mode-line-highlight |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2582 'face 'mode-line |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2583 'local-map |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2584 (gdb-make-header-line-mouse-map |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2585 'mouse-1 |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2586 (lambda (event) (interactive "e") |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2587 (save-selected-window |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2588 (select-window (posn-window (event-start event))) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2589 (set-window-dedicated-p (selected-window) nil) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2590 (switch-to-buffer |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2591 (gdb-get-buffer-create 'gdb-registers-buffer)) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2592 (set-window-dedicated-p (selected-window) t))))))) |
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2593 |
54538 | 2594 (defun gdb-registers-mode () |
2595 "Major mode for gdb registers. | |
2596 | |
2597 \\{gdb-registers-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2598 (kill-all-local-variables) |
54538 | 2599 (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
|
2600 (setq mode-name "Registers") |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
2601 (setq header-line-format gdb-locals-header) |
54538 | 2602 (setq buffer-read-only t) |
94339
bac78d3bb2ee
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94336
diff
changeset
|
2603 (buffer-disable-undo) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
2604 (gdb-thread-identification) |
54538 | 2605 (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
|
2606 (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
|
2607 (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
|
2608 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2609 (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
|
2610 'gdb-invalidate-registers) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2611 'gdb-invalidate-registers-1)) |
54538 | 2612 |
2613 (defun gdb-registers-buffer-name () | |
2614 (with-current-buffer gud-comint-buffer | |
2615 (concat "*registers of " (gdb-get-target-string) "*"))) | |
2616 | |
2617 (defun gdb-display-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2618 "Display integer register contents." |
54538 | 2619 (interactive) |
2620 (gdb-display-buffer | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2621 (gdb-get-buffer-create 'gdb-registers-buffer) t)) |
54538 | 2622 |
2623 (defun gdb-frame-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2624 "Display integer register contents in a new frame." |
54538 | 2625 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2626 (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
|
2627 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2628 (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer)))) |
59808 | 2629 |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
2630 (defun gdb-all-registers () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2631 "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
|
2632 (interactive) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2633 (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
|
2634 (if gdb-all-registers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2635 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2636 (setq gdb-all-registers nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2637 (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
|
2638 (setq mode-name "Registers"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2639 (setq gdb-all-registers t) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2640 (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
|
2641 (setq mode-name "Registers:All"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2642 (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
|
2643 (if gdb-all-registers "en" "dis"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2644 (gdb-invalidate-registers))) |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2645 |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2646 |
59808 | 2647 ;; Memory buffer. |
2648 ;; | |
2649 (defcustom gdb-memory-repeat-count 32 | |
2650 "Number of data items in memory window." | |
2651 :type 'integer | |
93765 | 2652 :group 'gdb |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2653 :version "22.1") |
59808 | 2654 |
2655 (defcustom gdb-memory-format "x" | |
2656 "Display format of data items in memory window." | |
2657 :type '(choice (const :tag "Hexadecimal" "x") | |
2658 (const :tag "Signed decimal" "d") | |
2659 (const :tag "Unsigned decimal" "u") | |
2660 (const :tag "Octal" "o") | |
2661 (const :tag "Binary" "t")) | |
93765 | 2662 :group 'gdb |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2663 :version "22.1") |
59808 | 2664 |
2665 (defcustom gdb-memory-unit "w" | |
2666 "Unit size of data items in memory window." | |
2667 :type '(choice (const :tag "Byte" "b") | |
2668 (const :tag "Halfword" "h") | |
2669 (const :tag "Word" "w") | |
2670 (const :tag "Giant word" "g")) | |
93765 | 2671 :group 'gdb |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2672 :version "22.1") |
59808 | 2673 |
2674 (gdb-set-buffer-rules 'gdb-memory-buffer | |
2675 'gdb-memory-buffer-name | |
2676 'gdb-memory-mode) | |
2677 | |
2678 (def-gdb-auto-updated-buffer gdb-memory-buffer | |
2679 gdb-invalidate-memory | |
2680 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count) | |
2681 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n") | |
2682 gdb-read-memory-handler | |
2683 gdb-read-memory-custom) | |
2684 | |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2685 (defun gdb-read-memory-custom () |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2686 (save-excursion |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2687 (goto-char (point-min)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2688 (if (looking-at "0x[[:xdigit:]]+") |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2689 (setq gdb-memory-address (match-string 0))))) |
59808 | 2690 |
2691 (defvar gdb-memory-mode-map | |
2692 (let ((map (make-sparse-keymap))) | |
2693 (suppress-keymap map) | |
2694 (define-key map "q" 'kill-this-buffer) | |
2695 map)) | |
2696 | |
2697 (defun gdb-memory-set-address (event) | |
2698 "Set the start memory address." | |
2699 (interactive "e") | |
2700 (save-selected-window | |
2701 (select-window (posn-window (event-start event))) | |
2702 (let ((arg (read-from-minibuffer "Memory address: "))) | |
2703 (setq gdb-memory-address arg)) | |
2704 (gdb-invalidate-memory))) | |
2705 | |
2706 (defun gdb-memory-set-repeat-count (event) | |
2707 "Set the number of data items in memory window." | |
2708 (interactive "e") | |
2709 (save-selected-window | |
2710 (select-window (posn-window (event-start event))) | |
2711 (let* ((arg (read-from-minibuffer "Repeat count: ")) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2712 (count (string-to-number arg))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2713 (if (<= count 0) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2714 (error "Positive numbers only") |
59808 | 2715 (customize-set-variable 'gdb-memory-repeat-count count) |
2716 (gdb-invalidate-memory))))) | |
2717 | |
2718 (defun gdb-memory-format-binary () | |
2719 "Set the display format to binary." | |
2720 (interactive) | |
2721 (customize-set-variable 'gdb-memory-format "t") | |
2722 (gdb-invalidate-memory)) | |
2723 | |
2724 (defun gdb-memory-format-octal () | |
2725 "Set the display format to octal." | |
2726 (interactive) | |
2727 (customize-set-variable 'gdb-memory-format "o") | |
2728 (gdb-invalidate-memory)) | |
2729 | |
2730 (defun gdb-memory-format-unsigned () | |
2731 "Set the display format to unsigned decimal." | |
2732 (interactive) | |
2733 (customize-set-variable 'gdb-memory-format "u") | |
2734 (gdb-invalidate-memory)) | |
2735 | |
2736 (defun gdb-memory-format-signed () | |
2737 "Set the display format to decimal." | |
2738 (interactive) | |
2739 (customize-set-variable 'gdb-memory-format "d") | |
2740 (gdb-invalidate-memory)) | |
2741 | |
2742 (defun gdb-memory-format-hexadecimal () | |
2743 "Set the display format to hexadecimal." | |
2744 (interactive) | |
2745 (customize-set-variable 'gdb-memory-format "x") | |
2746 (gdb-invalidate-memory)) | |
2747 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2748 (defvar gdb-memory-format-map |
59808 | 2749 (let ((map (make-sparse-keymap))) |
2750 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) | |
2751 map) | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2752 "Keymap to select format in the header line.") |
59808 | 2753 |
2754 (defvar gdb-memory-format-menu (make-sparse-keymap "Format") | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2755 "Menu of display formats in the header line.") |
59808 | 2756 |
2757 (define-key gdb-memory-format-menu [binary] | |
2758 '(menu-item "Binary" gdb-memory-format-binary | |
2759 :button (:radio . (equal gdb-memory-format "t")))) | |
2760 (define-key gdb-memory-format-menu [octal] | |
2761 '(menu-item "Octal" gdb-memory-format-octal | |
2762 :button (:radio . (equal gdb-memory-format "o")))) | |
2763 (define-key gdb-memory-format-menu [unsigned] | |
2764 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned | |
2765 :button (:radio . (equal gdb-memory-format "u")))) | |
2766 (define-key gdb-memory-format-menu [signed] | |
2767 '(menu-item "Signed Decimal" gdb-memory-format-signed | |
2768 :button (:radio . (equal gdb-memory-format "d")))) | |
2769 (define-key gdb-memory-format-menu [hexadecimal] | |
2770 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal | |
2771 :button (:radio . (equal gdb-memory-format "x")))) | |
2772 | |
2773 (defun gdb-memory-format-menu (event) | |
2774 (interactive "@e") | |
2775 (x-popup-menu event gdb-memory-format-menu)) | |
2776 | |
2777 (defun gdb-memory-format-menu-1 (event) | |
2778 (interactive "e") | |
2779 (save-selected-window | |
2780 (select-window (posn-window (event-start event))) | |
2781 (let* ((selection (gdb-memory-format-menu event)) | |
2782 (binding (and selection (lookup-key gdb-memory-format-menu | |
2783 (vector (car selection)))))) | |
2784 (if binding (call-interactively binding))))) | |
2785 | |
2786 (defun gdb-memory-unit-giant () | |
2787 "Set the unit size to giant words (eight bytes)." | |
2788 (interactive) | |
2789 (customize-set-variable 'gdb-memory-unit "g") | |
2790 (gdb-invalidate-memory)) | |
2791 | |
2792 (defun gdb-memory-unit-word () | |
2793 "Set the unit size to words (four bytes)." | |
2794 (interactive) | |
2795 (customize-set-variable 'gdb-memory-unit "w") | |
2796 (gdb-invalidate-memory)) | |
2797 | |
2798 (defun gdb-memory-unit-halfword () | |
2799 "Set the unit size to halfwords (two bytes)." | |
2800 (interactive) | |
2801 (customize-set-variable 'gdb-memory-unit "h") | |
2802 (gdb-invalidate-memory)) | |
2803 | |
2804 (defun gdb-memory-unit-byte () | |
2805 "Set the unit size to bytes." | |
2806 (interactive) | |
2807 (customize-set-variable 'gdb-memory-unit "b") | |
2808 (gdb-invalidate-memory)) | |
2809 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2810 (defvar gdb-memory-unit-map |
59808 | 2811 (let ((map (make-sparse-keymap))) |
2812 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) | |
2813 map) | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2814 "Keymap to select units in the header line.") |
59808 | 2815 |
2816 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit") | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2817 "Menu of units in the header line.") |
59808 | 2818 |
2819 (define-key gdb-memory-unit-menu [giantwords] | |
2820 '(menu-item "Giant words" gdb-memory-unit-giant | |
2821 :button (:radio . (equal gdb-memory-unit "g")))) | |
2822 (define-key gdb-memory-unit-menu [words] | |
2823 '(menu-item "Words" gdb-memory-unit-word | |
2824 :button (:radio . (equal gdb-memory-unit "w")))) | |
2825 (define-key gdb-memory-unit-menu [halfwords] | |
2826 '(menu-item "Halfwords" gdb-memory-unit-halfword | |
2827 :button (:radio . (equal gdb-memory-unit "h")))) | |
2828 (define-key gdb-memory-unit-menu [bytes] | |
2829 '(menu-item "Bytes" gdb-memory-unit-byte | |
2830 :button (:radio . (equal gdb-memory-unit "b")))) | |
2831 | |
2832 (defun gdb-memory-unit-menu (event) | |
2833 (interactive "@e") | |
2834 (x-popup-menu event gdb-memory-unit-menu)) | |
2835 | |
2836 (defun gdb-memory-unit-menu-1 (event) | |
2837 (interactive "e") | |
2838 (save-selected-window | |
2839 (select-window (posn-window (event-start event))) | |
2840 (let* ((selection (gdb-memory-unit-menu event)) | |
2841 (binding (and selection (lookup-key gdb-memory-unit-menu | |
2842 (vector (car selection)))))) | |
2843 (if binding (call-interactively binding))))) | |
2844 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2845 (defvar gdb-memory-font-lock-keywords |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2846 '(;; <__function.name+n> |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2847 ("<\\(\\(\\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
|
2848 ) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2849 "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
|
2850 |
59808 | 2851 (defun gdb-memory-mode () |
2852 "Major mode for examining memory. | |
2853 | |
2854 \\{gdb-memory-mode-map}" | |
2855 (kill-all-local-variables) | |
2856 (setq major-mode 'gdb-memory-mode) | |
2857 (setq mode-name "Memory") | |
2858 (setq buffer-read-only t) | |
94339
bac78d3bb2ee
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94336
diff
changeset
|
2859 (buffer-disable-undo) |
59808 | 2860 (use-local-map gdb-memory-mode-map) |
2861 (setq header-line-format | |
2862 '(:eval | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2863 (concat |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2864 "Read address[" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2865 (propertize |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2866 "-" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2867 'face font-lock-warning-face |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2868 'help-echo "mouse-1: decrement address" |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2869 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2870 'local-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2871 (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2872 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2873 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2874 (let ((gdb-memory-address |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2875 ;; Let GDB do the arithmetic. |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2876 (concat |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2877 gdb-memory-address " - " |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2878 (number-to-string |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2879 (* gdb-memory-repeat-count |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2880 (cond ((string= gdb-memory-unit "b") 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2881 ((string= gdb-memory-unit "h") 2) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2882 ((string= gdb-memory-unit "w") 4) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2883 ((string= gdb-memory-unit "g") 8))))))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2884 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2885 "|" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2886 (propertize "+" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2887 'face font-lock-warning-face |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2888 'help-echo "mouse-1: increment address" |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2889 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2890 'local-map (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2891 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2892 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2893 (let ((gdb-memory-address nil)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2894 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2895 "]: " |
59808 | 2896 (propertize gdb-memory-address |
2897 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2898 'help-echo "mouse-1: set memory address" |
62716 | 2899 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2900 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2901 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2902 #'gdb-memory-set-address)) |
59808 | 2903 " Repeat Count: " |
2904 (propertize (number-to-string gdb-memory-repeat-count) | |
2905 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2906 'help-echo "mouse-1: set repeat count" |
62716 | 2907 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2908 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2909 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2910 #'gdb-memory-set-repeat-count)) |
59808 | 2911 " Display Format: " |
2912 (propertize gdb-memory-format | |
2913 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2914 'help-echo "mouse-3: select display format" |
62716 | 2915 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2916 'local-map gdb-memory-format-map) |
59808 | 2917 " Unit Size: " |
2918 (propertize gdb-memory-unit | |
2919 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2920 'help-echo "mouse-3: select unit size" |
62716 | 2921 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2922 '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
|
2923 (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
|
2924 '(gdb-memory-font-lock-keywords)) |
59808 | 2925 (run-mode-hooks 'gdb-memory-mode-hook) |
2926 'gdb-invalidate-memory) | |
2927 | |
2928 (defun gdb-memory-buffer-name () | |
2929 (with-current-buffer gud-comint-buffer | |
2930 (concat "*memory of " (gdb-get-target-string) "*"))) | |
2931 | |
2932 (defun gdb-display-memory-buffer () | |
2933 "Display memory contents." | |
2934 (interactive) | |
2935 (gdb-display-buffer | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2936 (gdb-get-buffer-create 'gdb-memory-buffer) t)) |
59808 | 2937 |
2938 (defun gdb-frame-memory-buffer () | |
2939 "Display memory contents in a new frame." | |
2940 (interactive) | |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2941 (let* ((special-display-regexps (append special-display-regexps '(".*"))) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2942 (special-display-frame-alist |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2943 (cons '(left-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2944 (cons '(right-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2945 (cons '(width . 83) gdb-frame-parameters))))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2946 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) |
54538 | 2947 |
59808 | 2948 |
54538 | 2949 ;; Locals buffer. |
2950 ;; | |
2951 (gdb-set-buffer-rules 'gdb-locals-buffer | |
2952 'gdb-locals-buffer-name | |
2953 'gdb-locals-mode) | |
2954 | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2955 (def-gdb-auto-update-trigger gdb-invalidate-locals |
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2956 (gdb-get-buffer 'gdb-locals-buffer) |
54538 | 2957 "server info locals\n" |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2958 gdb-info-locals-handler) |
54538 | 2959 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2960 (defvar gdb-locals-watch-map |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2961 (let ((map (make-sparse-keymap))) |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
2962 (suppress-keymap map) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2963 (define-key map "\r" (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2964 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2965 (gud-watch))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2966 (define-key map [mouse-2] (lambda (event) (interactive "e") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2967 (mouse-set-point event) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2968 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2969 (gud-watch))) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2970 map) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2971 "Keymap to create watch expression of a complex data type local variable.") |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2972 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2973 (defconst gdb-struct-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2974 (concat (propertize "[struct/union]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2975 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2976 '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
|
2977 '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
|
2978 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2979 (defconst gdb-array-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2980 (concat " " (propertize "[array]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2981 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2982 '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
|
2983 '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
|
2984 |
54538 | 2985 ;; Abbreviate for arrays and structures. |
2986 ;; 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
|
2987 (defun gdb-info-locals-handler () |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2988 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2989 gdb-pending-triggers)) |
54538 | 2990 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer))) |
2991 (with-current-buffer buf | |
2992 (goto-char (point-min)) | |
94348
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
2993 ;; Need this in case "set print pretty" is on. |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2994 (while (re-search-forward "^[ }].*\n" nil t) |
54538 | 2995 (replace-match "" nil nil)) |
2996 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2997 (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
|
2998 (replace-match gdb-struct-string nil nil)) |
54538 | 2999 (goto-char (point-min)) |
94348
912b9ac13852
(gud-watch): Don't create speedbar...
Nick Roberts <nickrob@snap.net.nz>
parents:
94339
diff
changeset
|
3000 (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
|
3001 (replace-match gdb-array-string nil nil)))) |
54538 | 3002 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3003 (and buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3004 (with-current-buffer buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3005 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3006 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3007 (p (window-point window)) |
54538 | 3008 (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
|
3009 (erase-buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3010 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 3011 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3012 (set-window-start window start) |
94445
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
3013 (set-window-point window p))))) |
54538 | 3014 (run-hooks 'gdb-info-locals-hook)) |
3015 | |
3016 (defvar gdb-locals-mode-map | |
3017 (let ((map (make-sparse-keymap))) | |
3018 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3019 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3020 map)) |
54538 | 3021 |
3022 (defun gdb-locals-mode () | |
3023 "Major mode for gdb locals. | |
3024 | |
3025 \\{gdb-locals-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3026 (kill-all-local-variables) |
54538 | 3027 (setq major-mode 'gdb-locals-mode) |
62716 | 3028 (setq mode-name (concat "Locals:" gdb-selected-frame)) |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
3029 (use-local-map gdb-locals-mode-map) |
54538 | 3030 (setq buffer-read-only t) |
94339
bac78d3bb2ee
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94336
diff
changeset
|
3031 (buffer-disable-undo) |
94231
c0d59c1fcc51
(gdb-locals-header): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94227
diff
changeset
|
3032 (setq header-line-format gdb-locals-header) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
3033 (gdb-thread-identification) |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
3034 (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
|
3035 '(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
|
3036 (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
|
3037 (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
|
3038 (string-equal gdb-version "pre-6.4")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3039 'gdb-invalidate-locals |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3040 'gdb-invalidate-locals-1)) |
54538 | 3041 |
3042 (defun gdb-locals-buffer-name () | |
3043 (with-current-buffer gud-comint-buffer | |
3044 (concat "*locals of " (gdb-get-target-string) "*"))) | |
3045 | |
3046 (defun gdb-display-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3047 "Display local variables of current stack and their values." |
54538 | 3048 (interactive) |
3049 (gdb-display-buffer | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
3050 (gdb-get-buffer-create 'gdb-locals-buffer) t)) |
54538 | 3051 |
3052 (defun gdb-frame-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3053 "Display local variables of current stack and their values in a new frame." |
54538 | 3054 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
3055 (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
|
3056 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3057 (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer)))) |
54538 | 3058 |
3059 | |
3060 ;;;; Window management | |
94445
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
3061 (defun gdb-display-buffer (buf dedicated &optional frame) |
94476
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
3062 (let ((answer (get-buffer-window buf (or frame 0)))) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3063 (if answer |
94445
52a0ed7601cb
(gdb-info-stack-custom): Use
Nick Roberts <nickrob@snap.net.nz>
parents:
94348
diff
changeset
|
3064 (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary. |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3065 (let ((window (get-lru-window))) |
94476
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
3066 (let* ((largest (get-largest-window)) |
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
3067 (cur-size (window-height largest))) |
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
3068 (setq answer (split-window largest)) |
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
3069 (set-window-buffer answer buf) |
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
3070 (set-window-dedicated-p answer dedicated))) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3071 answer))) |
54538 | 3072 |
3073 | |
3074 ;;; Shared keymap initialization: | |
3075 | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
3076 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
3077 (define-key gud-menu-map [displays] |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3078 `(menu-item "GDB-Windows" ,menu |
94049
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
3079 :help "Open a GDB-UI buffer in a new window." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3080 :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
|
3081 (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
|
3082 (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
|
3083 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
3084 '(menu-item "Separate IO" gdb-display-separate-io-buffer |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3085 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3086 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3087 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3088 (define-key menu [disassembly] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3089 '("Disassembly" . gdb-display-assembler-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3090 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3091 '("Breakpoints" . gdb-display-breakpoints-buffer)) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
3092 (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
|
3093 (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
|
3094 |
54538 | 3095 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
3096 (define-key gud-menu-map [frames] | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3097 `(menu-item "GDB-Frames" ,menu |
94049
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
3098 :help "Open a GDB-UI buffer in a new frame." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3099 :visible (memq gud-minor-mode '(gdbmi gdba)))) |
54538 | 3100 (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
|
3101 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
59808 | 3102 (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
|
3103 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
3104 '(menu-item "Separate IO" gdb-frame-separate-io-buffer |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3105 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3106 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) |
70351
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
3107 (define-key menu [disassembly] '("Disassembly" . gdb-frame-assembler-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3108 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
3109 '("Breakpoints" . gdb-frame-breakpoints-buffer)) |
54538 | 3110 (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
|
3111 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))) |
54538 | 3112 |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
3113 (let ((menu (make-sparse-keymap "GDB-UI/MI"))) |
54538 | 3114 (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
|
3115 `(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
|
3116 ,menu :visible (memq gud-minor-mode '(gdbmi gdba)))) |
93765 | 3117 (define-key menu [gdb-customize] |
3118 '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb)) | |
3119 :help "Customize Gdb Graphical Mode options.")) | |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
3120 (define-key menu [gdb-find-source-frame] |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
3121 '(menu-item "Look For Source Frame" gdb-find-source-frame |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
3122 :visible (eq gud-minor-mode 'gdba) |
94049
4b1d804fa27a
(gdb-find-source-frame): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
93765
diff
changeset
|
3123 :help "Toggle looking for source frame further up call stack." |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
3124 :button (:toggle . gdb-find-source-frame))) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3125 (define-key menu [gdb-use-separate-io] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
3126 '(menu-item "Separate 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
|
3127 :visible (eq gud-minor-mode 'gdba) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
3128 :help "Toggle separate IO for debugged program." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3129 :button (:toggle . gdb-use-separate-io-buffer))) |
54538 | 3130 (define-key menu [gdb-many-windows] |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3131 '(menu-item "Display Other Windows" gdb-many-windows |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3132 :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
|
3133 :button (:toggle . gdb-many-windows))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
3134 (define-key menu [gdb-restore-windows] |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
3135 '(menu-item "Restore Window Layout" gdb-restore-windows |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
3136 :help "Restore standard layout for debug session."))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3137 |
54538 | 3138 (defun gdb-frame-gdb-buffer () |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3139 "Display GUD buffer in a new frame." |
54538 | 3140 (interactive) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3141 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
3142 (special-display-frame-alist |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
3143 (remove '(menu-bar-lines) (remove '(tool-bar-lines) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
3144 gdb-frame-parameters))) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
3145 (same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
3146 (display-buffer gud-comint-buffer))) |
54538 | 3147 |
3148 (defun gdb-display-gdb-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3149 "Display GUD buffer." |
54538 | 3150 (interactive) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
3151 (let ((same-window-regexps nil)) |
94476
3fd45a6262cb
(gdb-display-buffer): Don't pop up GUD buffer.
Nick Roberts <nickrob@snap.net.nz>
parents:
94452
diff
changeset
|
3152 (select-window (display-buffer gud-comint-buffer nil 0)))) |
54538 | 3153 |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3154 (defun gdb-set-window-buffer (name) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3155 (set-window-buffer (selected-window) (get-buffer name)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3156 (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
|
3157 |
54538 | 3158 (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
|
3159 "Layout the window pattern for `gdb-many-windows'." |
54538 | 3160 (gdb-display-locals-buffer) |
3161 (gdb-display-stack-buffer) | |
3162 (delete-other-windows) | |
3163 (gdb-display-breakpoints-buffer) | |
3164 (delete-other-windows) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3165 ; Don't dedicate. |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3166 (pop-to-buffer gud-comint-buffer) |
54538 | 3167 (split-window nil ( / ( * (window-height) 3) 4)) |
3168 (split-window nil ( / (window-height) 3)) | |
3169 (split-window-horizontally) | |
3170 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3171 (gdb-set-window-buffer (gdb-locals-buffer-name)) |
54538 | 3172 (other-window 1) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3173 (switch-to-buffer |
54538 | 3174 (if gud-last-last-frame |
3175 (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
|
3176 (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
|
3177 (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
|
3178 ;; 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
|
3179 ;; 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
|
3180 (list-buffers-noselect)))) |
70428
1a065139c7c3
(gdb-goto-breakpoint): Use or instead of unless so nil isn't returned.
Nick Roberts <nickrob@snap.net.nz>
parents:
70372
diff
changeset
|
3181 (setq gdb-source-window (selected-window)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3182 (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
|
3183 (split-window-horizontally) |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
3184 (other-window 1) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3185 (gdb-set-window-buffer |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3186 (gdb-get-buffer-create 'gdb-inferior-io))) |
54538 | 3187 (other-window 1) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3188 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
54538 | 3189 (split-window-horizontally) |
3190 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3191 (gdb-set-window-buffer (gdb-breakpoints-buffer-name)) |
54538 | 3192 (other-window 1)) |
3193 | |
3194 (defun gdb-restore-windows () | |
3195 "Restore the basic arrangement of windows used by gdba. | |
3196 This arrangement depends on the value of `gdb-many-windows'." | |
3197 (interactive) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3198 (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
|
3199 (delete-other-windows) |
54538 | 3200 (if gdb-many-windows |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3201 (gdb-setup-windows) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3202 (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
|
3203 (split-window) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3204 (other-window 1) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3205 (switch-to-buffer |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3206 (if gud-last-last-frame |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3207 (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
|
3208 (gud-find-file gdb-main-file))) |
70428
1a065139c7c3
(gdb-goto-breakpoint): Use or instead of unless so nil isn't returned.
Nick Roberts <nickrob@snap.net.nz>
parents:
70372
diff
changeset
|
3209 (setq gdb-source-window (selected-window)) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3210 (other-window 1)))) |
54538 | 3211 |
3212 (defun gdb-reset () | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
3213 "Exit a debugging session cleanly. |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
3214 Kills the gdb buffers, and resets variables and the source buffers." |
54538 | 3215 (dolist (buffer (buffer-list)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3216 (unless (eq buffer gud-comint-buffer) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3217 (with-current-buffer buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3218 (if (memq gud-minor-mode '(gdbmi gdba)) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
3219 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3220 (kill-buffer nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3221 (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
|
3222 (setq gud-minor-mode nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3223 (kill-local-variable 'tool-bar-map) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3224 (kill-local-variable 'gdb-define-alist)))))) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
3225 (setq gdb-overlay-arrow-position nil) |
54538 | 3226 (setq overlay-arrow-variable-list |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3227 (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
|
3228 (setq fringe-indicator-alist '((overlay-arrow . right-triangle))) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
3229 (setq gdb-stack-position nil) |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
3230 (setq overlay-arrow-variable-list |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
3231 (delq 'gdb-stack-position overlay-arrow-variable-list)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
3232 (if (boundp 'speedbar-frame) (speedbar-timer-fn)) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3233 (setq gud-running nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3234 (setq gdb-active-process nil) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
3235 (setq gdb-var-list nil) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3236 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) |
54538 | 3237 |
3238 (defun gdb-source-info () | |
3239 "Find the source file where the program starts and displays it with related | |
3240 buffers." | |
3241 (goto-char (point-min)) | |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3242 (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
|
3243 (looking-at "\\S-+")) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3244 (setq gdb-main-file (match-string 0))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3245 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3246 (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
|
3247 (setq gdb-macro-info t)) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
3248 (if gdb-many-windows |
54538 | 3249 (gdb-setup-windows) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3250 (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
|
3251 (if gdb-show-main |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3252 (let ((pop-up-windows t)) |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
3253 (display-buffer (gud-find-file gdb-main-file))))) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
3254 (setq gdb-ready t)) |
54538 | 3255 |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3256 (defun gdb-get-location (bptno line flag) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3257 "Find the directory containing the relevant source file. |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3258 Put in buffer and place breakpoint icon." |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3259 (goto-char (point-min)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3260 (catch 'file-not-found |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3261 (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
|
3262 (when (looking-at "\\S-+") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3263 (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
|
3264 (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
|
3265 (gdb-resync) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3266 (unless (assoc bptno gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3267 (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
|
3268 (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
|
3269 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
|
3270 (throw 'file-not-found nil)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3271 (with-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3272 (find-file-noselect (match-string 0)) |
80510
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
3273 (gdb-init-buffer) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3274 ;; 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
|
3275 (save-excursion |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3276 (goto-line (string-to-number line)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3277 (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
|
3278 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3279 (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
|
3280 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3281 (defun gdb-find-file-hook () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3282 "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
|
3283 of the current session." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3284 (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
|
3285 ;; 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
|
3286 gud-comint-buffer |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3287 (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
|
3288 '(gdba gdbmi))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3289 ;;Pre GDB 6.3 "info sources" doesn't give absolute file name. |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3290 (if (member (if (string-equal gdb-version "pre-6.4") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3291 (file-name-nondirectory buffer-file-name) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3292 buffer-file-name) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
3293 gdb-source-file-list) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3294 (with-current-buffer (find-buffer-visiting buffer-file-name) |
80510
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
3295 (gdb-init-buffer))))) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3296 |
54538 | 3297 ;;from put-image |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3298 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) |
54538 | 3299 "Put string PUTSTRING in front of POS in the current buffer. |
3300 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
|
3301 `before-string' string that has a `display' property whose value is |
54538 | 3302 PUTSTRING." |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3303 (let ((string (make-string 1 ?x)) |
54538 | 3304 (buffer (current-buffer))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3305 (setq putstring (copy-sequence putstring)) |
54538 | 3306 (let ((overlay (make-overlay pos pos buffer)) |
3307 (prop (or dprop | |
3308 (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
|
3309 (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
|
3310 (if sprops |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3311 (add-text-properties 0 1 sprops string)) |
54538 | 3312 (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
|
3313 (overlay-put overlay 'before-string string)))) |
54538 | 3314 |
3315 ;;from remove-images | |
3316 (defun gdb-remove-strings (start end &optional buffer) | |
3317 "Remove strings between START and END in BUFFER. | |
3318 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. | |
3319 BUFFER nil or omitted means use the current buffer." | |
3320 (unless buffer | |
3321 (setq buffer (current-buffer))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3322 (dolist (overlay (overlays-in start end)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
3323 (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
|
3324 (delete-overlay overlay)))) |
54538 | 3325 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3326 (defun gdb-put-breakpoint-icon (enabled bptno) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3327 (if (string-match "[0-9+]+\\." bptno) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3328 (setq enabled gdb-parent-bptno-enabled)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
3329 (let ((start (- (line-beginning-position) 1)) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
3330 (end (+ (line-end-position) 1)) |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3331 (putstring (if enabled "B" "b")) |
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3332 (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
|
3333 (add-text-properties |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3334 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
|
3335 putstring) |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3336 (if enabled |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3337 (add-text-properties |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3338 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
|
3339 (add-text-properties |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3340 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) |
54538 | 3341 (gdb-remove-breakpoint-icons start end) |
3342 (if (display-images-p) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3343 (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
|
3344 (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
|
3345 gdb-buffer-fringe-width) 8) |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3346 (gdb-put-string |
54538 | 3347 nil (1+ start) |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
3348 `(left-fringe breakpoint |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3349 ,(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
|
3350 'breakpoint-enabled |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3351 'breakpoint-disabled)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3352 'gdb-bptno bptno |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3353 'gdb-enabled enabled) |
54538 | 3354 (when (< left-margin-width 2) |
3355 (save-current-buffer | |
3356 (setq left-margin-width 2) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3357 (if source-window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
3358 (set-window-margins |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3359 source-window |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
3360 left-margin-width right-margin-width)))) |
54538 | 3361 (put-image |
3362 (if enabled | |
3363 (or breakpoint-enabled-icon | |
3364 (setq breakpoint-enabled-icon | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3365 (find-image `((:type xpm :data |
54538 | 3366 ,breakpoint-xpm-data |
3367 :ascent 100 :pointer hand) | |
3368 (:type pbm :data | |
3369 ,breakpoint-enabled-pbm-data | |
3370 :ascent 100 :pointer hand))))) | |
3371 (or breakpoint-disabled-icon | |
3372 (setq breakpoint-disabled-icon | |
3373 (find-image `((:type xpm :data | |
3374 ,breakpoint-xpm-data | |
3375 :conversion disabled | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3376 :ascent 100 :pointer hand) |
54538 | 3377 (:type pbm :data |
3378 ,breakpoint-disabled-pbm-data | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3379 :ascent 100 :pointer hand)))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3380 (+ start 1) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3381 putstring |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3382 'left-margin)) |
54538 | 3383 (when (< left-margin-width 2) |
3384 (save-current-buffer | |
3385 (setq left-margin-width 2) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3386 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3387 (if window |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3388 (set-window-margins |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3389 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
|
3390 (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
|
3391 (propertize putstring |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
3392 '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
|
3393 (1+ start))))) |
54538 | 3394 |
3395 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin) | |
3396 (gdb-remove-strings start end) | |
3397 (if (display-images-p) | |
3398 (remove-images start end)) | |
3399 (when remove-margin | |
3400 (setq left-margin-width 0) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3401 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3402 (if window |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3403 (set-window-margins |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3404 window left-margin-width right-margin-width))))) |
54538 | 3405 |
3406 | |
3407 ;; | |
3408 ;; Assembler buffer. | |
3409 ;; | |
3410 (gdb-set-buffer-rules 'gdb-assembler-buffer | |
3411 'gdb-assembler-buffer-name | |
3412 'gdb-assembler-mode) | |
3413 | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3414 ;; 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
|
3415 ;; 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
|
3416 (defun gdb-assembler-handler () |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3417 (setq gdb-pending-triggers |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3418 (delq 'gdb-invalidate-assembler |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3419 gdb-pending-triggers)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3420 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3421 (and buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3422 (with-current-buffer buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3423 (let* ((window (get-buffer-window buf 0)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3424 (p (window-point window)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3425 (buffer-read-only nil)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3426 (erase-buffer) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3427 (insert-buffer-substring (gdb-get-buffer-create |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3428 'gdb-partial-output-buffer)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3429 (set-window-point window p))))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3430 ;; put customisation here |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3431 (gdb-assembler-custom)) |
54538 | 3432 |
3433 (defun gdb-assembler-custom () | |
3434 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) | |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3435 (pos 1) (address) (flag) (bptno)) |
54538 | 3436 (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
|
3437 (save-excursion |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3438 (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
|
3439 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3440 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3441 (if (and gdb-pc-address |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3442 (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
|
3443 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3444 (setq pos (point)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3445 (beginning-of-line) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3446 (setq fringe-indicator-alist |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3447 (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
|
3448 nil |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3449 '((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
|
3450 (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
|
3451 (setq gdb-overlay-arrow-position (make-marker))) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
3452 (set-marker gdb-overlay-arrow-position (point)))))) |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3453 ;; 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
|
3454 (gdb-remove-breakpoint-icons (point-min) (point-max)))) |
54538 | 3455 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
3456 (goto-char (point-min)) | |
3457 (while (< (point) (- (point-max) 1)) | |
3458 (forward-line 1) | |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3459 (when (looking-at |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3460 "\\([0-9]+\\.?[0-9]*\\).*?\\s-+\\(.\\)\\s-+0x0*\\(\\S-+\\)") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3461 (setq bptno (match-string 1)) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3462 (setq flag (char-after (match-beginning 2))) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3463 (setq address (match-string 3)) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3464 (with-current-buffer buffer |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3465 (save-excursion |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3466 (goto-char (point-min)) |
80535
106730cfdf95
(gdb-info-breakpoints-custom): Make breakpoint
Nick Roberts <nickrob@snap.net.nz>
parents:
80510
diff
changeset
|
3467 (if (re-search-forward (concat "^0x0*" address) nil t) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3468 (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
|
3469 (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
|
3470 (with-current-buffer buffer |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
3471 (set-window-point (get-buffer-window buffer 0) pos))))) |
54538 | 3472 |
3473 (defvar gdb-assembler-mode-map | |
3474 (let ((map (make-sparse-keymap))) | |
3475 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3476 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3477 map)) |
54538 | 3478 |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3479 (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
|
3480 '(;; <__function.name+n> |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3481 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3482 (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
|
3483 ;; 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
|
3484 ("^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
|
3485 (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
|
3486 ;; %register(at least i386) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3487 ("%\\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
|
3488 ("^\\(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
|
3489 (1 font-lock-comment-face) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3490 (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
|
3491 ("^\\(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
|
3492 "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
|
3493 |
54538 | 3494 (defun gdb-assembler-mode () |
3495 "Major mode for viewing code assembler. | |
3496 | |
3497 \\{gdb-assembler-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3498 (kill-all-local-variables) |
54538 | 3499 (setq major-mode 'gdb-assembler-mode) |
62716 | 3500 (setq mode-name (concat "Machine:" gdb-selected-frame)) |
54538 | 3501 (setq gdb-overlay-arrow-position nil) |
3502 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position) | |
3503 (setq fringes-outside-margins t) | |
3504 (setq buffer-read-only t) | |
94339
bac78d3bb2ee
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94336
diff
changeset
|
3505 (buffer-disable-undo) |
94185
580129e092d0
(gdb-thread-indicator): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
94128
diff
changeset
|
3506 (gdb-thread-identification) |
54538 | 3507 (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
|
3508 (gdb-invalidate-assembler) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3509 (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
|
3510 '(gdb-assembler-font-lock-keywords)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3511 (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
|
3512 'gdb-invalidate-assembler) |
54538 | 3513 |
3514 (defun gdb-assembler-buffer-name () | |
3515 (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
|
3516 (concat "*disassembly of " (gdb-get-target-string) "*"))) |
54538 | 3517 |
3518 (defun gdb-display-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3519 "Display disassembly view." |
54538 | 3520 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3521 (setq gdb-previous-frame nil) |
54538 | 3522 (gdb-display-buffer |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
3523 (gdb-get-buffer-create 'gdb-assembler-buffer) t)) |
54538 | 3524 |
3525 (defun gdb-frame-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3526 "Display disassembly view in a new frame." |
54538 | 3527 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3528 (setq gdb-previous-frame nil) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
3529 (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
|
3530 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3531 (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer)))) |
54538 | 3532 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3533 ;; modified because if gdb-pc-address has changed value a new command |
54538 | 3534 ;; must be enqueued to update the buffer with the new output |
3535 (defun gdb-invalidate-assembler (&optional ignored) | |
3536 (if (gdb-get-buffer 'gdb-assembler-buffer) | |
3537 (progn | |
62716 | 3538 (unless (and gdb-selected-frame |
3539 (string-equal gdb-selected-frame gdb-previous-frame)) | |
54538 | 3540 (if (or (not (member 'gdb-invalidate-assembler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3541 gdb-pending-triggers)) |
94336
4d089dfae3b1
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94293
diff
changeset
|
3542 (not (equal (string-to-number gdb-pc-address) |
4d089dfae3b1
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94293
diff
changeset
|
3543 (string-to-number |
4d089dfae3b1
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94293
diff
changeset
|
3544 gdb-previous-frame-pc-address)))) |
54538 | 3545 (progn |
62716 | 3546 ;; take previous disassemble command, if any, off the queue |
54538 | 3547 (with-current-buffer gud-comint-buffer |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3548 (let ((queue gdb-input-queue)) |
54538 | 3549 (dolist (item queue) |
3550 (if (equal (cdr item) '(gdb-assembler-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3551 (setq gdb-input-queue |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3552 (delete item gdb-input-queue)))))) |
54538 | 3553 (gdb-enqueue-input |
62716 | 3554 (list |
94336
4d089dfae3b1
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94293
diff
changeset
|
3555 (concat gdb-server-prefix "disassemble " gdb-pc-address "\n") |
54538 | 3556 'gdb-assembler-handler)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3557 (push 'gdb-invalidate-assembler gdb-pending-triggers) |
94273
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3558 (setq gdb-previous-frame-pc-address gdb-pc-address) |
62716 | 3559 (setq gdb-previous-frame gdb-selected-frame))))))) |
54538 | 3560 |
62716 | 3561 (defun gdb-get-selected-frame () |
3562 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers)) | |
54538 | 3563 (progn |
94273
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3564 (if (string-equal gdb-version "pre-6.4") |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3565 (gdb-enqueue-input |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3566 (list (concat gdb-server-prefix "info frame\n") |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3567 'gdb-frame-handler)) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3568 (gdb-enqueue-input |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3569 (list "server interpreter mi -stack-info-frame\n" |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3570 'gdb-frame-handler-1))) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3571 (push 'gdb-get-selected-frame gdb-pending-triggers)))) |
54538 | 3572 |
3573 (defun gdb-frame-handler () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3574 (setq gdb-pending-triggers |
62716 | 3575 (delq 'gdb-get-selected-frame gdb-pending-triggers)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3576 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3577 (when (re-search-forward |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3578 "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
|
3579 (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
|
3580 (setq gdb-frame-address (match-string 2))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3581 (goto-char (point-min)) |
94336
4d089dfae3b1
(gdb-invalidate-assembler): Compare numeric
Nick Roberts <nickrob@snap.net.nz>
parents:
94293
diff
changeset
|
3582 (when (re-search-forward ".*=\\s-+\\(\\S-*\\)\\s-+in\\s-+\\(.*?\\)\ |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
3583 \\(?: (\\(\\S-+?\\):[0-9]+?)\\)*; " |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3584 nil t) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3585 (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
|
3586 (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
|
3587 (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
|
3588 (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
|
3589 (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
|
3590 (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
|
3591 (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
|
3592 (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
|
3593 (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
|
3594 (let ((buffer (marker-buffer gud-overlay-arrow-position)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3595 (position (marker-position gud-overlay-arrow-position))) |
70372
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3596 (when (and buffer |
79812
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
3597 (string-equal (file-name-nondirectory |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
3598 (buffer-file-name buffer)) |
70372
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3599 (file-name-nondirectory (match-string 3)))) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3600 (with-current-buffer buffer |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3601 (setq fringe-indicator-alist |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3602 (if (string-equal gdb-frame-number "0") |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3603 nil |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3604 '((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
|
3605 (set-marker gud-overlay-arrow-position position)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3606 (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
|
3607 (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
|
3608 (setq gdb-current-language (match-string 1))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3609 (gdb-invalidate-assembler)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3610 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3611 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3612 ;; Code specific to GDB 6.4 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3613 (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
|
3614 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3615 (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
|
3616 "Create list of source files for current GDB session. |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
3617 If buffers already exist for any of these files, `gud-minor-mode' |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3618 is set in them." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3619 (goto-char (point-min)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3620 (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
|
3621 (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
|
3622 (dolist (buffer (buffer-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3623 (with-current-buffer buffer |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3624 (when (member buffer-file-name gdb-source-file-list) |
80510
f3ac5401fa8e
(gdb-init-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
80436
diff
changeset
|
3625 (gdb-init-buffer)))) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
3626 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
3627 (propertize "ready" 'face font-lock-variable-name-face))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3628 |
94273
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3629 ;; Used for -stack-info-frame but could be used for -stack-list-frames too. |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3630 (defconst gdb-stack-list-frames-regexp |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3631 ".*?level=\"\\(.*?\\)\",.*?addr=\"\\(.*?\\)\",.*?func=\"\\(.*?\\)\",\ |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3632 \\(?:.*?file=\".*?\",.*?fullname=\"\\(.*?\\)\",.*?line=\"\\(.*?\\)\".*?}\\|\ |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3633 from=\"\\(.*?\\)\"\\)") |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3634 |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3635 (defun gdb-frame-handler-1 () |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3636 (setq gdb-pending-triggers |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3637 (delq 'gdb-get-selected-frame gdb-pending-triggers)) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3638 (goto-char (point-min)) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3639 (when (re-search-forward gdb-stack-list-frames-regexp nil t) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3640 (setq gdb-frame-number (match-string 1)) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3641 (setq gdb-pc-address (match-string 2)) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3642 (setq gdb-selected-frame (match-string 3)) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3643 (if (gdb-get-buffer 'gdb-locals-buffer) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3644 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3645 (setq mode-name (concat "Locals:" gdb-selected-frame)))) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3646 (if (gdb-get-buffer 'gdb-assembler-buffer) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3647 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3648 (setq mode-name (concat "Machine:" gdb-selected-frame))))) |
94483
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3649 (if (and (match-string 4) (match-string 5) gud-overlay-arrow-position) |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3650 (let ((buffer (marker-buffer gud-overlay-arrow-position)) |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3651 (position (marker-position gud-overlay-arrow-position))) |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3652 (when (and buffer |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3653 (string-equal (file-name-nondirectory |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3654 (buffer-file-name buffer)) |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3655 (file-name-nondirectory (match-string 4)))) |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3656 (with-current-buffer buffer |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3657 (setq fringe-indicator-alist |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3658 (if (string-equal gdb-frame-number "0") |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3659 nil |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3660 '((overlay-arrow . hollow-right-triangle)))) |
3a51a1333f0f
(gdb-frame-handler-1): Make overlay arrow
Nick Roberts <nickrob@snap.net.nz>
parents:
94476
diff
changeset
|
3661 (set-marker gud-overlay-arrow-position position))))) |
94273
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3662 (gdb-invalidate-assembler)) |
4fad9433957b
(gdb-previous-frame-address): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
94235
diff
changeset
|
3663 |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3664 ; Uses "-var-list-children --all-values". Needs GDB 6.4 onwards. |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3665 (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
|
3666 (gdb-enqueue-input |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3667 (list |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3668 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
79754
6a820000a687
(gdb-var-list-children-1): Put varnum in
Nick Roberts <nickrob@snap.net.nz>
parents:
79724
diff
changeset
|
3669 (concat "server interpreter mi \"-var-list-children --all-values \\\"" |
6a820000a687
(gdb-var-list-children-1): Put varnum in
Nick Roberts <nickrob@snap.net.nz>
parents:
79724
diff
changeset
|
3670 varnum "\\\"\"\n") |
6a820000a687
(gdb-var-list-children-1): Put varnum in
Nick Roberts <nickrob@snap.net.nz>
parents:
79724
diff
changeset
|
3671 (concat "-var-list-children --all-values \"" varnum "\"\n")) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3672 `(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
|
3673 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3674 (defconst gdb-var-list-children-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3675 "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3676 numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\ |
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3677 \\(}\\|,.*?\\(type=\"\\(.+?\\)\"\\)?.*?}\\)") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3678 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3679 (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
|
3680 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3681 (let ((var-list nil)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3682 (catch 'child-already-watched |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3683 (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
|
3684 (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
|
3685 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3686 (push var var-list) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3687 (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
|
3688 (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
|
3689 (match-string 2) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3690 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3691 (match-string 7) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3692 (read (match-string 4)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3693 nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3694 (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
|
3695 (throw 'child-already-watched nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3696 (push varchild var-list)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3697 (push var var-list))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3698 (setq gdb-var-list (nreverse var-list)))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3699 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3700 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3701 ; 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
|
3702 (defun gdb-var-update-1 () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3703 (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
|
3704 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3705 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3706 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3707 (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
|
3708 "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
|
3709 "-var-update --all-values *\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3710 'gdb-var-update-handler-1)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3711 (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
|
3712 |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
3713 (defconst gdb-var-update-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3714 "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3715 in_scope=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3716 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3717 (defun gdb-var-update-handler-1 () |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3718 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3719 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3720 (goto-char (point-min)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3721 (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
|
3722 (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
|
3723 (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
|
3724 (when var |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3725 (let ((match (match-string 3))) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3726 (cond ((string-equal match "false") |
79261
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3727 (if gdb-delete-out-of-scope |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3728 (gdb-var-delete-1 varnum) |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3729 (setcar (nthcdr 5 var) 'out-of-scope))) |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3730 ((string-equal match "true") |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3731 (setcar (nthcdr 5 var) 'changed) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3732 (setcar (nthcdr 4 var) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3733 (read (match-string 2)))) |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
3734 ((string-equal match "invalid") |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
3735 (gdb-var-delete-1 varnum))))))) |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3736 (setq gdb-pending-triggers |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3737 (delq 'gdb-var-update gdb-pending-triggers)) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3738 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3739 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3740 ;; Registers buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3741 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3742 (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
|
3743 'gdb-registers-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3744 'gdb-registers-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3745 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3746 (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
|
3747 (gdb-get-buffer 'gdb-registers-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3748 (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
|
3749 "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
|
3750 "-data-list-register-values x\n") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3751 gdb-data-list-register-values-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3752 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3753 (defconst gdb-data-list-register-values-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3754 "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3755 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3756 (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
|
3757 (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
|
3758 gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3759 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3760 (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
|
3761 (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
|
3762 (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
|
3763 (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
|
3764 (erase-buffer) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3765 (put-text-property 0 (length err) 'face font-lock-warning-face err) |
69910
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3766 (insert err) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3767 (goto-char (point-min))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3768 (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
|
3769 (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
|
3770 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3771 (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
|
3772 (setq register (pop register-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3773 (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
|
3774 (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
|
3775 (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
|
3776 'face 'font-lock-warning-face |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3777 register-string)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3778 (setq register-values |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3779 (concat register-values register-string))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3780 (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
|
3781 (with-current-buffer buf |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3782 (let* ((window (get-buffer-window buf 0)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3783 (start (window-start window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3784 (p (window-point window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3785 (buffer-read-only nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3786 (erase-buffer) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3787 (insert register-values) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3788 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3789 (set-window-point window p)))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3790 (gdb-data-list-register-values-custom)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3791 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3792 (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
|
3793 (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
|
3794 (save-excursion |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3795 (let ((buffer-read-only nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3796 start end) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3797 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3798 (while (< (point) (point-max)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3799 (setq start (line-beginning-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3800 (setq end (line-end-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3801 (when (looking-at "^[^\t]+") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3802 (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
|
3803 (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
|
3804 '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
|
3805 (add-text-properties start end |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3806 '(help-echo "mouse-2: edit value" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3807 mouse-face highlight)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3808 (forward-line 1)))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3809 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3810 ;; 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
|
3811 (defun gdb-get-changed-registers () |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3812 (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
|
3813 (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
|
3814 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3815 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3816 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3817 (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
|
3818 "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
|
3819 "-data-list-changed-registers\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3820 'gdb-get-changed-registers-handler)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3821 (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
|
3822 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3823 (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
|
3824 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3825 (defun gdb-get-changed-registers-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3826 (setq gdb-pending-triggers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3827 (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
|
3828 (setq gdb-changed-registers nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3829 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3830 (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
|
3831 (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
|
3832 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3833 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3834 ;; Locals buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3835 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3836 ;; 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
|
3837 (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
|
3838 'gdb-locals-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3839 'gdb-locals-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3840 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3841 (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
|
3842 (gdb-get-buffer 'gdb-locals-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3843 (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
|
3844 "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
|
3845 "-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
|
3846 gdb-stack-list-locals-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3847 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3848 (defconst gdb-stack-list-locals-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3849 "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3850 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3851 (defvar gdb-locals-watch-map-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3852 (let ((map (make-sparse-keymap))) |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3853 (suppress-keymap map) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3854 (define-key map "\r" 'gud-watch) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3855 (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
|
3856 map) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
3857 "Keymap to create watch expression of a complex data type local variable.") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3858 |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3859 (defvar gdb-edit-locals-map-1 |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3860 (let ((map (make-sparse-keymap))) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3861 (suppress-keymap map) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3862 (define-key map "\r" 'gdb-edit-locals-value) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3863 (define-key map [mouse-2] 'gdb-edit-locals-value) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3864 map) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
3865 "Keymap to edit value of a simple data type local variable.") |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3866 |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3867 (defun gdb-edit-locals-value (&optional event) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3868 "Assign a value to a variable displayed in the locals buffer." |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3869 (interactive (list last-input-event)) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3870 (save-excursion |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3871 (if event (posn-set-point (event-end event))) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3872 (beginning-of-line) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3873 (let* ((var (current-word)) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3874 (value (read-string (format "New value (%s): " var)))) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3875 (gdb-enqueue-input |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3876 (list (concat gdb-server-prefix"set variable " var " = " value "\n") |
72435
4bb2db64b4a1
(gdb-edit-locals-value): Balance parens.
Romain Francoise <romain@orebokech.com>
parents:
72429
diff
changeset
|
3877 'ignore))))) |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3878 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3879 ;; 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
|
3880 ;; 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
|
3881 (defun gdb-stack-list-locals-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3882 (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
|
3883 gdb-pending-triggers)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3884 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3885 (if (re-search-forward gdb-error-regexp nil t) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3886 (let ((err (match-string 1))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3887 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3888 (let ((buffer-read-only nil)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3889 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3890 (insert err) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3891 (goto-char (point-min))))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3892 (let (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3893 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3894 (while (re-search-forward gdb-stack-list-locals-regexp nil t) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3895 (let ((local (list (match-string 1) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3896 (match-string 2) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3897 nil))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3898 (if (looking-at ",value=\\(\".*\"\\).*?}") |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3899 (setcar (nthcdr 2 local) (read (match-string 1)))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3900 (push local locals-list))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3901 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3902 (and buf (with-current-buffer buf |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3903 (let* ((window (get-buffer-window buf 0)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3904 (start (window-start window)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3905 (p (window-point window)) |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3906 (buffer-read-only nil) (name) (value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3907 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3908 (dolist (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3909 (setq name (car local)) |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3910 (setq value (nth 2 local)) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3911 (if (or (not value) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3912 (string-match "^\\0x" value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3913 (add-text-properties 0 (length name) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3914 `(mouse-face highlight |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3915 help-echo "mouse-2: create watch expression" |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3916 local-map ,gdb-locals-watch-map-1) |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3917 name) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3918 (add-text-properties 0 (length value) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3919 `(mouse-face highlight |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3920 help-echo "mouse-2: edit value" |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3921 local-map ,gdb-edit-locals-map-1) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3922 value)) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3923 (insert |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3924 (concat name "\t" (nth 1 local) |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
3925 "\t" value "\n"))) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3926 (set-window-start window start) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3927 (set-window-point window p)))))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3928 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3929 (defun gdb-get-register-names () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3930 "Create a list of register names." |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3931 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3932 (setq gdb-register-names nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3933 (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
|
3934 (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
|
3935 |
54538 | 3936 (provide 'gdb-ui) |
3937 | |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3938 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
54538 | 3939 ;;; gdb-ui.el ends here |