Mercurial > emacs
annotate lisp/progmodes/gdb-ui.el @ 93526:90118d6d9050
(calendar-time-zone-daylight-rules): Simplify.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 02 Apr 2008 03:18:55 +0000 |
parents | 4054054dd212 |
children | a1760b9403f6 |
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 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
78234
c1ec1c8a8d2e
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
78112
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
54538 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
54538 | 26 |
27 ;;; Commentary: | |
28 | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
29 ;; This mode acts as a graphical user interface to GDB. You can interact with |
54538 | 30 ;; GDB through the GUD buffer in the usual way, but there are also further |
31 ;; buffers which control the execution and describe the state of your program. | |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
32 ;; It separates the input/output of your program from that of GDB, if |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
33 ;; required, and watches expressions in the speedbar. It also uses features of |
56258
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
34 ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar |
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
35 ;; (see the GDB Graphical Interface section in the Emacs info manual). |
54538 | 36 |
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
|
37 ;; By default, M-x gdb will start the debugger. |
54538 | 38 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
39 ;; This file has evolved from gdba.el that was included with GDB 5.0 and |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
40 ;; written by Tom Lord and Jim Kingdon. It uses GDB's annotation interface. |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
41 ;; You don't need to know about annotations to use this mode as a debugger, |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
42 ;; 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
|
43 ;; 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
|
44 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
45 ;; GDB developers plan to make the annotation interface obsolete. A new |
79446 | 46 ;; interface called GDB/MI (machine interface) has been designed to replace it. |
47 ;; Some GDB/MI commands are used in this file through the CLI command | |
48 ;; 'interpreter mi <mi-command>'. To help with the process of fully migrating | |
49 ;; Emacs from annotations to GDB/MI, there is an experimental package called | |
50 ;; gdb-mi in the Emacs Lisp Package Archive ("http://tromey.com/elpa/"). It | |
51 ;; comprises of modified gud.el and a file called gdb-mi.el which replaces | |
52 ;; gdb-ui.el. When installed, this overrides the current files and invoking | |
53 ;; M-x gdb will use GDB/MI directly (starts with "gdb -i=mi"). When deleted | |
54 ;; ('d' followed by 'x' in Package Menu mode), the files are deleted and old | |
55 ;; functionality restored. This provides a convenient way to review the | |
56 ;; current status/contribute to its improvement. For someone who just wants to | |
57 ;; use GDB, however, the current mode in Emacs 22 is a much better option. | |
58 ;; There is also a file, also called gdb-mi.el, a version of which is included | |
59 ;; the GDB distribution. This will probably only work with versions | |
60 ;; distributed with GDB 6.5 or later. Unlike the version in ELPA it works on | |
61 ;; 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
|
62 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
63 ;; 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
|
64 ;; 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
|
65 ;; 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
|
66 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
67 ;;; 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
|
68 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
69 ;; 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
|
70 ;; 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
|
71 ;; 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
|
72 ;; 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
|
73 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
74 ;; #ifdef UNBUFFERED |
64999
e1cdc6178b3e
(toggle-gdb-use-inferior-io-buffer):
Nick Roberts <nickrob@snap.net.nz>
parents:
64993
diff
changeset
|
75 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0); |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
76 ;; #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
|
77 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
78 ;; 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
|
79 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
80 ;;; 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
|
81 |
79446 | 82 ;; 1) Cannot handle multiple debug sessions. |
83 ;; 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
|
84 ;; 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
|
85 ;; "gdb --annotate=2 myprog" to keep source buffer/selected frame fixed. |
79446 | 86 ;; 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
|
87 ;; (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
|
88 |
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
|
89 ;;; TODO: |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
90 |
59808 | 91 ;; 1) Use MI command -data-read-memory for memory window. |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
92 ;; 2) Use tree-widget.el instead of the speedbar for watch-expressions? |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
93 ;; 3) Mark breakpoint locations on scroll-bar of source buffer? |
54538 | 94 |
95 ;;; Code: | |
96 | |
97 (require 'gud) | |
98 | |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
99 (defvar tool-bar-map) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
100 (defvar speedbar-initial-expansion-list-name) |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
101 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
102 (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
|
103 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
|
104 (defvar gdb-frame-address nil "Identity of frame for watch expression.") |
62716 | 105 (defvar gdb-previous-frame-address nil) |
59808 | 106 (defvar gdb-memory-address "main") |
54538 | 107 (defvar gdb-previous-frame nil) |
62716 | 108 (defvar gdb-selected-frame nil) |
109 (defvar gdb-frame-number nil) | |
54538 | 110 (defvar gdb-current-language nil) |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
111 (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
|
112 "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
|
113 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
|
114 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
|
115 address for root variables.") |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
116 (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
|
117 (defvar gud-old-arrow nil) |
54538 | 118 (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
|
119 (defvar gdb-stack-position nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
120 (defvar gdb-server-prefix nil) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
121 (defvar gdb-flush-pending-output nil) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
122 (defvar gdb-location-alist nil |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
123 "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
|
124 Emacs can't find.") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
125 (defvar gdb-active-process nil |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
126 "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
|
127 (defvar gdb-error "Non-nil when GDB is reporting an error.") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
128 (defvar gdb-macro-info nil |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
129 "Non-nil if GDB knows that the inferior includes preprocessor macro info.") |
65884
7246b6fe556e
(gdb-fringe-width -> gdb-buffer-fringe-width):
Nick Roberts <nickrob@snap.net.nz>
parents:
65870
diff
changeset
|
130 (defvar gdb-buffer-fringe-width nil) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
131 (defvar gdb-signalled nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
132 (defvar gdb-source-window nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
133 (defvar gdb-inferior-status nil) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
134 (defvar gdb-continuation nil) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
135 (defvar gdb-look-up-stack nil) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
136 (defvar gdb-frame-begin nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
137 "Non-nil when GDB generates frame-begin annotation.") |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
138 (defvar gdb-printing t) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
139 (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
|
140 (defvar gdb-ready nil) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
141 (defvar gdb-early-user-input nil) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
142 |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
143 (defvar gdb-buffer-type nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
144 "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
|
145 (make-variable-buffer-local 'gdb-buffer-type) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
146 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
147 (defvar gdb-input-queue () |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
148 "A list of gdb command objects.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
149 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
150 (defvar gdb-prompting nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
151 "True when gdb is idle with no pending input.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
152 |
91950
d758efc0f23f
(gdb-output-sink): Define with an invalid value.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91867
diff
changeset
|
153 (defvar gdb-output-sink nil |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
154 "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
|
155 Possible values are these symbols: |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
156 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
157 `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
|
158 for the user to see. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
159 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
160 `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
|
161 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
162 `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
|
163 annotation is received. Then the output-sink |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
164 becomes:... |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
165 `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
|
166 for subsequent processing by a command. This is the |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
167 disposition of output generated by commands that |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
168 gdb mode sends to gdb on its own behalf. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
169 `post-emacs' -- ignore output until the prompt annotation is |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
170 received, then go to USER disposition. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
171 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
172 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
|
173 \(`user' and `emacs').") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
174 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
175 (defvar gdb-current-item nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
176 "The most recent command item sent to gdb.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
177 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
178 (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
|
179 "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
|
180 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
181 (defvar gdb-first-post-prompt nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
182 (defvar gdb-version nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
183 (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
|
184 (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
|
185 "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
|
186 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
187 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
188 (defvar gdb-locals-font-lock-keywords-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
189 '( |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
190 ;; var = (struct struct_tag) value |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
191 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
192 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
193 (3 font-lock-keyword-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
194 (4 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
195 ;; var = (type) value |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
196 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
197 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
198 (3 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
199 ;; var = val |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
200 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
201 (1 font-lock-variable-name-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
202 ) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
203 "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
|
204 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
205 (defvar gdb-locals-font-lock-keywords-2 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
206 '( |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
207 ;; var = type value |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
208 ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
209 (1 font-lock-variable-name-face) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
210 (3 font-lock-type-face)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
211 ) |
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 ;; Variables for GDB 6.4+ |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
215 (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
|
216 (defvar gdb-changed-registers nil |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
217 "List of changed register numbers (strings).") |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
218 |
54538 | 219 ;;;###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
|
220 (defun gdb (command-line) |
54538 | 221 "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
|
222 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
|
223 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
|
224 |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 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
|
229 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
230 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
|
231 `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
|
232 `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
|
233 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
|
234 some of the buffers. |
54538 | 235 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
236 Watch expressions appear in the speedbar/slowbar. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
237 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
238 The following commands help control operation : |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
239 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
240 `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
|
241 `gdb-restore-windows' - To restore the window layout. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
242 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
243 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
|
244 detailed description of this mode. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
245 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
246 |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
247 +----------------------------------------------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
248 | GDB Toolbar | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
249 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
250 | GUD buffer (I/O of GDB) | Locals buffer | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
251 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
252 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
253 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
254 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
255 | Source buffer | I/O buffer (of debugged program) | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
256 | | (comint-mode) | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
257 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
258 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
259 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
260 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
261 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
262 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
263 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
264 | Stack buffer | Breakpoints buffer | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
265 | RET gdb-frames-select | SPC gdb-toggle-breakpoint | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
266 | | RET gdb-goto-breakpoint | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
267 | | D gdb-delete-breakpoint | |
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
|
268 +-----------------------------------+----------------------------------+ |
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 |
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 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
|
271 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
|
272 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
|
273 `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
|
274 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
|
275 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
|
276 (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
|
277 |
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 (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
|
279 (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
|
280 (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
|
281 (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
|
282 (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
|
283 (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
|
284 "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
|
285 |
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-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
|
287 (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
|
288 (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
|
289 |
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-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
|
291 (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
|
292 "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
|
293 (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
|
294 (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
|
295 (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
|
296 (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
|
297 (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
|
298 (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
|
299 (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
|
300 (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
|
301 (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
|
302 "\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
|
303 |
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 (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
|
305 (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
|
306 (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
|
307 (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
|
308 "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
|
309 |
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 ;; 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
|
311 (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
|
312 |
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 (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
|
314 (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
|
315 |
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 (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
|
317 (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
|
318 (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
|
319 (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
|
320 (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
|
321 (setq gud-running nil) |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
322 (setq gdb-ready nil) |
80146
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
323 (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
|
324 (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
|
325 (setq gud-filter-pending-text 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
|
326 (run-hooks 'gdb-mode-hook)) |
54538 | 327 |
80146
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
328 ;; 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
|
329 ;;;###autoload |
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
330 (defalias 'gdba 'gdb) |
6b627ca66379
(gdba): Recreate as an alias for gdb.
Nick Roberts <nickrob@snap.net.nz>
parents:
79965
diff
changeset
|
331 |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
332 (defcustom gdb-debug-log-max 128 |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
333 "Maximum size of `gdb-debug-log'. If nil, size is unlimited." |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
334 :group 'gud |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
335 :type '(choice (integer :tag "Number of elements") |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
336 (const :tag "Unlimited" nil)) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
337 :version "22.1") |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
338 |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
339 (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
|
340 "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
|
341 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
|
342 `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
|
343 |
64697
7767f4fb012a
* progmodes/gdb-ui.el (gdb-enable-debug-log): Add autoload cookie.
Nick Roberts <nickrob@snap.net.nz>
parents:
64654
diff
changeset
|
344 ;;;###autoload |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
345 (defcustom gdb-enable-debug nil |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
346 "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
|
347 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
348 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
349 :version "22.1") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
350 |
62115
515e18600ed2
(gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
62065
diff
changeset
|
351 (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
|
352 "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
|
353 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
|
354 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
|
355 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
|
356 |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
357 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
|
358 predefined macros." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
359 :type 'string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
360 :group 'gud |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
361 :version "22.1") |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
362 |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
363 (defcustom gdb-cpp-define-alist-flags "" |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
364 "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
|
365 :type 'string |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
366 :group 'gud |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
367 :version "22.1") |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
368 |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
369 (defcustom gdb-show-main nil |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
370 "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
|
371 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
|
372 :type 'boolean |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
373 :group 'gud |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
374 :version "22.1") |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
375 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
376 (defcustom gdb-many-windows nil |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
377 "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
|
378 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
|
379 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
|
380 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
|
381 for `gdba'." |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
382 :type 'boolean |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
383 :group 'gud |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
384 :version "22.1") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
385 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
386 (defcustom gdb-use-separate-io-buffer nil |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
387 "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
|
388 :type 'boolean |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
389 :group 'gud |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
390 :version "22.1") |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
391 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
392 (defun gdb-force-mode-line-update (status) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
393 (let ((buffer gud-comint-buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
394 (if (and buffer (buffer-name buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
395 (with-current-buffer buffer |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
396 (setq mode-line-process |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
397 (format ":%s [%s]" |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
398 (process-status (get-buffer-process buffer)) status)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
399 ;; Force mode line redisplay soon. |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
400 (force-mode-line-update))))) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
401 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
402 (defun gdb-many-windows (arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
403 "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
|
404 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
|
405 otherwise use a single window." |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
406 (interactive "P") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
407 (setq gdb-many-windows |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
408 (if (null arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
409 (not gdb-many-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
410 (> (prefix-numeric-value arg) 0))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
411 (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
|
412 (if gdb-many-windows "en" "dis"))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
413 (if (and gud-comint-buffer |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
414 (buffer-name gud-comint-buffer)) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
415 (condition-case nil |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
416 (gdb-restore-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
417 (error nil)))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
418 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
419 (defun gdb-use-separate-io-buffer (arg) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
420 "Toggle separate IO for debugged program. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
421 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
|
422 otherwise do not." |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
423 (interactive "P") |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
424 (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
|
425 (if (null arg) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
426 (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
|
427 (> (prefix-numeric-value arg) 0))) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
428 (message (format "Separate IO %sabled" |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
429 (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
|
430 (if (and gud-comint-buffer |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
431 (buffer-name gud-comint-buffer)) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
432 (condition-case nil |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
433 (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
|
434 (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
|
435 (kill-buffer (gdb-inferior-io-name))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
436 (error nil)))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
437 |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
438 (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
|
439 |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
440 (defun gdb-create-define-alist () |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
441 "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
|
442 (let* ((file (buffer-file-name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
443 (output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
444 (with-output-to-string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
445 (with-current-buffer standard-output |
79945
d1a91cfdb94c
(gdb-create-define-alist): Don't call
Nick Roberts <nickrob@snap.net.nz>
parents:
79812
diff
changeset
|
446 (and file (file-exists-p file) |
d1a91cfdb94c
(gdb-create-define-alist): Don't call
Nick Roberts <nickrob@snap.net.nz>
parents:
79812
diff
changeset
|
447 (call-process shell-file-name file |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
448 (list t nil) nil "-c" |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
449 (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
|
450 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
|
451 (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
|
452 (setq gdb-define-alist nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
453 (dolist (define define-list) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
454 (setq name (nth 1 (split-string define "[( ]"))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
455 (push (cons name define) gdb-define-alist)))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
456 |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
457 (defun gdb-tooltip-print (expr) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
458 (tooltip-show |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
459 (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
|
460 (goto-char (point-min)) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
461 (let ((string |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
462 (if (search-forward "=" nil t) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
463 (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
|
464 (buffer-string)))) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
465 ;; 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
|
466 (substring string 0 (- (length string) 1)))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
467 (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
|
468 |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
469 ;; 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
|
470 ;; 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
|
471 ;; unexpected starting annotation (phase error). |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
472 (defun gdb-tooltip-print-1 (expr) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
473 (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
|
474 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
475 (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
|
476 (unless (looking-at "\\S-+.*(.*).*") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
477 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
478 (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
|
479 `(lambda () (gdb-tooltip-print ,expr)))))))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
480 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
481 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)") |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
482 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
483 (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
|
484 "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
|
485 (goto-char (point-min)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
486 (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
|
487 (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
|
488 (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
|
489 gdb-source-file-list)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
490 (dolist (buffer (buffer-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
491 (with-current-buffer buffer |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
492 (when (and buffer-file-name |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
493 (member (file-name-nondirectory buffer-file-name) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
494 gdb-source-file-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
495 (set (make-local-variable 'gud-minor-mode) 'gdba) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
496 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
497 (when gud-tooltip-mode |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
498 (make-local-variable 'gdb-define-alist) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
499 (gdb-create-define-alist) |
71277
99ed754e8f50
(gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
71113
diff
changeset
|
500 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
501 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
502 (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
|
503 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
504 (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
|
505 (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
|
506 (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
|
507 (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
|
508 (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
|
509 (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
|
510 (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
|
511 (setq varnumlet (car var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
512 (dolist (component component-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
513 (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
|
514 (setq expr (concat expr |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
515 (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
|
516 (concat "[" component "]") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
517 (concat "." component)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
518 (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
|
519 expr))) |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
520 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
521 (defun gdb-init-1 () |
62716 | 522 (gud-def gud-break (if (not (string-match "Machine" mode-name)) |
54538 | 523 (gud-call "break %f:%l" arg) |
524 (save-excursion | |
525 (beginning-of-line) | |
526 (forward-char 2) | |
527 (gud-call "break *%a" arg))) | |
528 "\C-b" "Set breakpoint at current line or address.") | |
529 ;; | |
62716 | 530 (gud-def gud-remove (if (not (string-match "Machine" mode-name)) |
54538 | 531 (gud-call "clear %f:%l" arg) |
532 (save-excursion | |
533 (beginning-of-line) | |
534 (forward-char 2) | |
535 (gud-call "clear *%a" arg))) | |
536 "\C-d" "Remove breakpoint at current line or address.") | |
537 ;; | |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
538 (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
|
539 (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
|
540 (save-excursion |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
541 (beginning-of-line) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
542 (forward-char 2) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
543 (gud-call "until *%a" arg))) |
54538 | 544 "\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
|
545 ;; |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
546 (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
|
547 nil "Start or continue execution.") |
54538 | 548 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
549 ;; For debugging Emacs only. |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
550 (gud-def gud-pp |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
551 (gud-call |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
552 (concat |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
553 "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
|
554 '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
|
555 (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
|
556 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
|
557 |
54538 | 558 (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
|
559 'gdb-mouse-set-clear-breakpoint) |
54538 | 560 (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
|
561 'gdb-mouse-set-clear-breakpoint) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
562 (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
|
563 'gdb-mouse-toggle-breakpoint-margin) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
564 (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
|
565 'gdb-mouse-toggle-breakpoint-fringe) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
566 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
567 (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
|
568 'gdb-mouse-until) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
569 (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
|
570 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
571 (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
|
572 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
573 (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
|
574 'gdb-mouse-until) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
575 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
576 (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
|
577 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
578 (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
|
579 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
580 (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
|
581 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
582 (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
|
583 'gdb-mouse-jump) |
54538 | 584 |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
585 ;; (re-)initialize |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
586 (setq gdb-pc-address (if gdb-show-main "main" nil)) |
62716 | 587 (setq gdb-previous-frame-address nil |
588 gdb-memory-address "main" | |
589 gdb-previous-frame nil | |
590 gdb-selected-frame nil | |
591 gdb-current-language nil | |
592 gdb-frame-number nil | |
593 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
|
594 gdb-main-file nil |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
595 gdb-first-post-prompt t |
62716 | 596 gdb-prompting nil |
597 gdb-input-queue nil | |
598 gdb-current-item nil | |
599 gdb-pending-triggers nil | |
600 gdb-output-sink 'user | |
601 gdb-server-prefix "server " | |
602 gdb-location-alist nil | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
603 gdb-source-file-list nil |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
604 gdb-error nil |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
605 gdb-macro-info nil |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
606 gdb-buffer-fringe-width (car (window-fringes)) |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
607 gdb-debug-log nil |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
608 gdb-signalled nil |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
609 gdb-source-window nil |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
610 gdb-inferior-status nil |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
611 gdb-continuation nil |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
612 gdb-look-up-stack nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
613 gdb-frame-begin nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
614 gdb-printing t |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
615 gud-old-arrow nil) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
616 |
54538 | 617 (setq gdb-buffer-type 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
618 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
619 (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
|
620 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
621 ;; 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
|
622 (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
|
623 'gdb-get-version))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
624 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
625 (defun gdb-init-2 () |
54538 | 626 (if (eq window-system 'w32) |
627 (gdb-enqueue-input (list "set new-console off\n" 'ignore))) | |
628 (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
|
629 (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
|
630 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
631 (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
|
632 (progn |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
633 (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
|
634 '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
|
635 (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
|
636 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
637 (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
|
638 'gdb-get-register-names)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
639 ; Needs GDB 6.2 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
640 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
641 (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
|
642 '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
|
643 (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
|
644 |
69839
f91451ffdab7
(gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents:
69666
diff
changeset
|
645 ;; 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
|
646 ;; 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
|
647 (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
|
648 (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
|
649 |
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
|
650 (run-hooks 'gdb-mode-hook)) |
54538 | 651 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
652 (defun gdb-get-version () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
653 (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
|
654 (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
|
655 (setq gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
656 (setq gdb-version "6.4+")) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
657 (gdb-init-2)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
658 |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
659 (defmacro gdb-if-arrow (arrow-position &rest body) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
660 `(if ,arrow-position |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
661 (let ((buffer (marker-buffer ,arrow-position)) (line)) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
662 (if (equal buffer (window-buffer (posn-window end))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
663 (with-current-buffer buffer |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
664 (when (or (equal start end) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
665 (equal (posn-point start) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
666 (marker-position ,arrow-position))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
667 ,@body)))))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
668 |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
669 (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
|
670 "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
|
671 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
|
672 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
|
673 with mouse-1 (default bindings)." |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
674 (interactive "e") |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
675 (let ((start (event-start event)) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
676 (end (event-end event))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
677 (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
|
678 (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
|
679 (gud-call (concat "until " (number-to-string line)))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
680 (gdb-if-arrow gdb-overlay-arrow-position |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
681 (save-excursion |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
682 (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
|
683 (forward-char 2) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
684 (gud-call (concat "until *%a")))))) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
685 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
686 (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
|
687 "Set execution address/line. |
76238
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
688 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
|
689 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
|
690 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
|
691 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
|
692 (interactive "e") |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
693 (let ((start (event-start event)) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
694 (end (event-end event))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
695 (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
|
696 (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
|
697 (progn |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
698 (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
|
699 (gud-call (concat "jump " (number-to-string line))))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
700 (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
|
701 (save-excursion |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
702 (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
|
703 (forward-char 2) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
704 (progn |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
705 (gud-call (concat "tbreak *%a")) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
706 (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
|
707 |
69042
01ec984a6ce6
(gdb-speedbar-auto-raise): Don't enable by default.
Nick Roberts <nickrob@snap.net.nz>
parents:
69023
diff
changeset
|
708 (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
|
709 "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
|
710 updated." |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
711 :type 'boolean |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
712 :group 'gud |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
713 :version "22.1") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
714 |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
715 (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
|
716 "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
|
717 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
|
718 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
|
719 (interactive "P") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
720 (setq gdb-speedbar-auto-raise |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
721 (if (null arg) |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
722 (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
|
723 (> (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
|
724 (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
|
725 (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
|
726 |
54538 | 727 (defcustom gdb-use-colon-colon-notation nil |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
728 "If non-nil use FUN::VAR format to display variables in the speedbar." |
54538 | 729 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
730 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
731 :version "22.1") |
54538 | 732 |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
733 (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
|
734 (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
|
735 |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
736 (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
|
737 "Watch expression at point. |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
738 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
|
739 (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
|
740 (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
|
741 (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
|
742 (progn |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
743 (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
|
744 (require 'tooltip) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
745 (save-selected-window |
70351
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
746 (let ((expr |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
747 (if arg |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
748 (completing-read "Name of variable: " |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
749 'gud-gdb-complete-command) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
750 (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
|
751 (buffer-substring (region-beginning) (region-end)) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
752 (tooltip-identifier-from-point (point)))))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
753 (speedbar 1) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
754 (set-text-properties 0 (length expr) nil expr) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
755 (gdb-enqueue-input |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
756 (list |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
757 (if (eq minor-mode 'gdba) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
758 (concat |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
759 "server interpreter mi \"-var-create - * " expr "\"\n") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
760 (concat"-var-create - * " expr "\n")) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
761 `(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
|
762 (message "gud-watch is a no-op in this mode.")))) |
54538 | 763 |
764 (defconst gdb-var-create-regexp | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
765 "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",\\(?:.*value=\\(\".*\"\\),\\)?.*type=\"\\(.*?\\)\"") |
54538 | 766 |
767 (defun gdb-var-create-handler (expr) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
768 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
769 (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
|
770 (let ((var (list |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
771 (match-string 1) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
772 (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
|
773 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
|
774 (setq expr (concat gdb-selected-frame "::" expr)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
775 expr) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
776 (match-string 2) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
777 (match-string 4) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
778 (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
|
779 nil gdb-frame-address))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
780 (push var gdb-var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
781 (unless (string-equal |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
782 speedbar-initial-expansion-list-name "GUD") |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
783 (speedbar-change-initial-expansion-list "GUD")) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
784 (unless (nth 4 var) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
785 (gdb-enqueue-input |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
786 (list |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
787 (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
|
788 'gdba) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
789 (concat "server interpreter mi \"0-var-evaluate-expression " |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
790 (car var) "\"\n") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
791 (concat "0-var-evaluate-expression " (car var) "\n")) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
792 `(lambda () (gdb-var-evaluate-expression-handler |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
793 ,(car var) nil)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
794 (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
|
795 (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
|
796 (message-box "No symbol \"%s\" in current context." expr)))) |
54538 | 797 |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
798 (defun gdb-speedbar-update () |
75589
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
799 (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
|
800 (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
|
801 ;; 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
|
802 (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
|
803 ;; 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
|
804 (push 'gdb-speedbar-timer gdb-pending-triggers))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
805 |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
806 (defun gdb-speedbar-timer-fn () |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
807 (setq gdb-pending-triggers |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
808 (delq 'gdb-speedbar-timer gdb-pending-triggers)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
809 (speedbar-timer-fn)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
810 |
54538 | 811 (defun gdb-var-evaluate-expression-handler (varnum changed) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
812 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
813 (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
814 (setq gdb-pending-triggers |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
815 (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
|
816 (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
|
817 (when var |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
818 (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
|
819 (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
|
820 (gdb-speedbar-update)) |
54538 | 821 |
822 (defun gdb-var-list-children (varnum) | |
823 (gdb-enqueue-input | |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
824 (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
|
825 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
54538 | 826 |
827 (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
|
828 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
829 numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)") |
54538 | 830 |
831 (defun gdb-var-list-children-handler (varnum) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
832 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
833 (let ((var-list nil)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
834 (catch 'child-already-watched |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
835 (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
|
836 (if (string-equal varnum (car var)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
837 (progn |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
838 (push var var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
839 (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
|
840 (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
|
841 (match-string 2) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
842 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
843 (match-string 6) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
844 nil nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
845 (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
|
846 (throw 'child-already-watched nil)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
847 (push varchild var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
848 (gdb-enqueue-input |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
849 (list |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
850 (concat |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
851 "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
|
852 (car varchild) "\"\n") |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
853 `(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
|
854 ,(car varchild) nil))))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
855 (push var var-list))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
856 (setq gdb-var-list (nreverse var-list))))) |
54538 | 857 |
858 (defun gdb-var-update () | |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
859 (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
|
860 (gdb-enqueue-input |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
861 (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
|
862 'gdb-var-update-handler)) |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
863 (push 'gdb-var-update gdb-pending-triggers))) |
54538 | 864 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
865 (defconst gdb-var-update-regexp |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
866 "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
867 type_changed=\".*?\".*?}") |
54538 | 868 |
869 (defun gdb-var-update-handler () | |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
870 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
871 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
872 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
873 (let ((n 0)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
874 (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
|
875 (let ((varnum (match-string 1))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
876 (if (string-equal (match-string 2) "false") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
877 (let ((var (assoc varnum gdb-var-list))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
878 (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
|
879 (setq n (1+ n)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
880 (push n gdb-pending-triggers) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
881 (gdb-enqueue-input |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
882 (list |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
883 (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
|
884 "-var-evaluate-expression " varnum "\"\n") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
885 `(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
|
886 (setq gdb-pending-triggers |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
887 (delq 'gdb-var-update gdb-pending-triggers))) |
54538 | 888 |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
889 (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
|
890 "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
|
891 (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
|
892 (varnum (car var))) |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
893 (gdb-enqueue-input |
79965
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
894 (list |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
895 (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
|
896 (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
|
897 varnum " " format "\"\n") |
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
898 (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
|
899 `(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
|
900 |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
901 (defconst gdb-var-set-format-regexp |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
902 "format=\"\\(.*?\\)\",.*value=\"\\(.*?\\)\"") |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
903 |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
904 (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
|
905 (goto-char (point-min)) |
c88c86182e91
(gdb-var-set-format-regexp): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
79945
diff
changeset
|
906 (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
|
907 (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
|
908 (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
|
909 (gdb-var-update-1)))) |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
910 |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
911 (defun gdb-var-delete-1 (varnum) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
912 (gdb-enqueue-input |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
913 (list |
79667
87eecf56e2a6
(gdb-var-set-format): Set the output format
Nick Roberts <nickrob@snap.net.nz>
parents:
79446
diff
changeset
|
914 (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
|
915 (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
|
916 (concat "-var-delete " varnum "\n")) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
917 'ignore)) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
918 (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
|
919 (dolist (varchild gdb-var-list) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
920 (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
|
921 (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
|
922 |
54538 | 923 (defun gdb-var-delete () |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
924 "Delete watch expression at point from the speedbar." |
54538 | 925 (interactive) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
926 (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
|
927 '(gdbmi gdba)) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
928 (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
|
929 (varnum (car var))) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
930 (if (string-match "\\." (car var)) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
931 (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
|
932 (gdb-var-delete-1 varnum))))) |
54538 | 933 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
934 (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
|
935 "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
|
936 (gdb-enqueue-input |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
937 (list |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
938 (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
|
939 (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
|
940 (concat "-var-delete -c " varnum "\n")) 'ignore))) |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
941 |
54538 | 942 (defun gdb-edit-value (text token indent) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
943 "Assign a value to a variable displayed in the speedbar." |
54538 | 944 (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
|
945 (varnum (car var)) (value)) |
54538 | 946 (setq value (read-string "New value: ")) |
947 (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
|
948 (list |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
949 (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
|
950 (concat "server interpreter mi \"-var-assign " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
951 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
|
952 (concat "-var-assign " varnum " " value "\n")) |
69325
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
953 `(lambda () (gdb-edit-value-handler ,value)))))) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
954 |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
955 (defun gdb-edit-value-handler (value) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
956 (goto-char (point-min)) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
957 (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
|
958 (message-box "Invalid number or expression (%s)" value))) |
54538 | 959 |
960 (defcustom gdb-show-changed-values t | |
68967
87bf1f965a0f
(gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68941
diff
changeset
|
961 "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
|
962 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
|
963 Changed values are highlighted with the face `font-lock-warning-face'." |
54538 | 964 :type 'boolean |
58049
fd0093bd412a
(gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
57982
diff
changeset
|
965 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
966 :version "22.1") |
54538 | 967 |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
968 (defcustom gdb-max-children 40 |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
969 "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
|
970 :type 'integer |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
971 :group 'gud |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
972 :version "22.1") |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
973 |
79261
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
974 (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
|
975 "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
|
976 :type 'boolean |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
977 :group 'gud |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
978 :version "22.2") |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
979 |
54538 | 980 (defun gdb-speedbar-expand-node (text token indent) |
981 "Expand the node the user clicked on. | |
982 TEXT is the text of the button we clicked on, a + or - item. | |
983 TOKEN is data related to this node. | |
984 INDENT is the current indentation depth." | |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
985 (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
|
986 (progn |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
987 (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
|
988 (let* ((var (assoc token gdb-var-list)) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
989 (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
|
990 (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
|
991 (y-or-n-p |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
992 (format |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
993 "%s has %s children. Continue? " expr children))) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
994 (if (and (eq (buffer-local-value |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
995 'gud-minor-mode gud-comint-buffer) 'gdba) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
996 (string-equal gdb-version "pre-6.4")) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
997 (gdb-var-list-children token) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
998 (gdb-var-list-children-1 token))))) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
999 ((string-match "-" text) ;contract this node |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1000 (dolist (var gdb-var-list) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1001 (if (string-match (concat token "\\.") (car var)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1002 (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
|
1003 (gdb-var-delete-children token) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1004 (speedbar-change-expand-button-char ?+) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1005 (speedbar-delete-subblock indent)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1006 (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
|
1007 (speedbar-center-buffer-smartly)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1008 (message-box "GUD session has been killed"))) |
54538 | 1009 |
1010 (defun gdb-get-target-string () | |
1011 (with-current-buffer gud-comint-buffer | |
1012 gud-target-name)) | |
1013 | |
1014 | |
1015 ;; | |
1016 ;; gdb buffers. | |
1017 ;; | |
1018 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
1019 ;; of that particular buffer. | |
1020 ;; | |
1021 ;; The usual gdb interaction buffer is given the type `gdba' and | |
1022 ;; is constructed specially. | |
1023 ;; | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1024 ;; Others are constructed by gdb-get-buffer-create and |
54538 | 1025 ;; named according to the rules set forth in the gdb-buffer-rules-assoc |
1026 | |
1027 (defvar gdb-buffer-rules-assoc '()) | |
1028 | |
1029 (defun gdb-get-buffer (key) | |
1030 "Return the gdb buffer tagged with type KEY. | |
1031 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
1032 (save-excursion | |
1033 (gdb-look-for-tagged-buffer key (buffer-list)))) | |
1034 | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1035 (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
|
1036 "Create a new gdb buffer of the type specified by KEY. |
54538 | 1037 The key should be one of the cars in `gdb-buffer-rules-assoc'." |
1038 (or (gdb-get-buffer key) | |
1039 (let* ((rules (assoc key gdb-buffer-rules-assoc)) | |
1040 (name (funcall (gdb-rules-name-maker rules))) | |
1041 (new (get-buffer-create name))) | |
1042 (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
|
1043 (let ((trigger)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1044 (if (cdr (cdr rules)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1045 (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
|
1046 (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
|
1047 (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
|
1048 (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
|
1049 (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
|
1050 (if trigger (funcall trigger))) |
54538 | 1051 new)))) |
1052 | |
1053 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
1054 | |
1055 (defun gdb-look-for-tagged-buffer (key bufs) | |
1056 (let ((retval nil)) | |
1057 (while (and (not retval) bufs) | |
1058 (set-buffer (car bufs)) | |
1059 (if (eq gdb-buffer-type key) | |
1060 (setq retval (car bufs))) | |
1061 (setq bufs (cdr bufs))) | |
1062 retval)) | |
1063 | |
1064 ;; | |
1065 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
1066 ;; at least one and possible more functions. The functions have these | |
1067 ;; roles in defining a buffer type: | |
1068 ;; | |
1069 ;; NAME - Return a name for this buffer type. | |
1070 ;; | |
1071 ;; The remaining function(s) are optional: | |
1072 ;; | |
1073 ;; MODE - called in a new buffer with no arguments, should establish | |
1074 ;; the proper mode for the buffer. | |
1075 ;; | |
1076 | |
1077 (defun gdb-set-buffer-rules (buffer-type &rest rules) | |
1078 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) | |
1079 (if binding | |
1080 (setcdr binding rules) | |
1081 (push (cons buffer-type rules) | |
1082 gdb-buffer-rules-assoc)))) | |
1083 | |
1084 ;; GUD buffers are an exception to the rules | |
1085 (gdb-set-buffer-rules 'gdba 'error) | |
1086 | |
1087 ;; Partial-output buffer : This accumulates output from a command executed on | |
1088 ;; behalf of emacs (rather than the user). | |
1089 ;; | |
1090 (gdb-set-buffer-rules 'gdb-partial-output-buffer | |
1091 'gdb-partial-output-name) | |
1092 | |
1093 (defun gdb-partial-output-name () | |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
1094 (concat " *partial-output-" |
54538 | 1095 (gdb-get-target-string) |
1096 "*")) | |
1097 | |
1098 | |
1099 (gdb-set-buffer-rules 'gdb-inferior-io | |
1100 'gdb-inferior-io-name | |
1101 'gdb-inferior-io-mode) | |
1102 | |
1103 (defun gdb-inferior-io-name () | |
1104 (concat "*input/output of " | |
1105 (gdb-get-target-string) | |
1106 "*")) | |
1107 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1108 (defun gdb-display-separate-io-buffer () |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1109 "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
|
1110 (interactive) |
68903
57fa3643220b
(gdb-display-separate-io-buffer): Change use of
Nick Roberts <nickrob@snap.net.nz>
parents:
68902
diff
changeset
|
1111 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1112 (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
|
1113 (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
|
1114 |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1115 (defconst gdb-frame-parameters |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1116 '((height . 14) (width . 80) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1117 (unsplittable . t) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1118 (tool-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1119 (menu-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1120 (minibuffer . nil))) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1121 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1122 (defun gdb-frame-separate-io-buffer () |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1123 "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
|
1124 (interactive) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1125 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1126 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1127 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1128 (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
|
1129 |
54538 | 1130 (defvar gdb-inferior-io-mode-map |
1131 (let ((map (make-sparse-keymap))) | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1132 (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
|
1133 (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
|
1134 (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
|
1135 (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
|
1136 (define-key map "\C-d" 'gdb-separate-io-eof) |
54538 | 1137 map)) |
1138 | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1139 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
54538 | 1140 "Major mode for gdb inferior-io." |
1141 :syntax-table nil :abbrev-table nil | |
1142 ;; We want to use comint because it has various nifty and familiar | |
1143 ;; features. We don't need a process, but comint wants one, so create | |
1144 ;; a dummy one. | |
1145 (make-comint-in-buffer | |
1146 (substring (buffer-name) 1 (- (length (buffer-name)) 1)) | |
1147 (current-buffer) "hexl") | |
1148 (setq comint-input-sender 'gdb-inferior-io-sender)) | |
1149 | |
1150 (defun gdb-inferior-io-sender (proc string) | |
1151 ;; PROC is the pseudo-process created to satisfy comint. | |
1152 (with-current-buffer (process-buffer proc) | |
1153 (setq proc (get-buffer-process gud-comint-buffer)) | |
1154 (process-send-string proc string) | |
1155 (process-send-string proc "\n"))) | |
1156 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1157 (defun gdb-separate-io-interrupt () |
54538 | 1158 "Interrupt the program being debugged." |
1159 (interactive) | |
1160 (interrupt-process | |
1161 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1162 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1163 (defun gdb-separate-io-quit () |
54538 | 1164 "Send quit signal to the program being debugged." |
1165 (interactive) | |
1166 (quit-process | |
1167 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1168 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1169 (defun gdb-separate-io-stop () |
54538 | 1170 "Stop the program being debugged." |
1171 (interactive) | |
1172 (stop-process | |
1173 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1174 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1175 (defun gdb-separate-io-eof () |
54538 | 1176 "Send end-of-file to the program being debugged." |
1177 (interactive) | |
1178 (process-send-eof | |
1179 (get-buffer-process gud-comint-buffer))) | |
1180 | |
1181 | |
1182 ;; gdb communications | |
1183 ;; | |
1184 | |
1185 ;; INPUT: things sent to gdb | |
1186 ;; | |
1187 ;; The queues are lists. Each element is either a string (indicating user or | |
1188 ;; user-like input) or a list of the form: | |
1189 ;; | |
1190 ;; (INPUT-STRING HANDLER-FN) | |
1191 ;; | |
1192 ;; The handler function will be called from the partial-output buffer when the | |
1193 ;; command completes. This is the way to write commands which invoke gdb | |
1194 ;; commands autonomously. | |
1195 ;; | |
1196 ;; These lists are consumed tail first. | |
1197 ;; | |
1198 | |
1199 (defun gdb-send (proc string) | |
1200 "A comint send filter for gdb. | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1201 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
|
1202 (if gdb-ready |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1203 (progn |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1204 (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
|
1205 (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
|
1206 (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
|
1207 (if gud-running |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1208 (progn |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1209 (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
|
1210 (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
|
1211 (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
|
1212 (if (string-match "\\\\\\'" string) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1213 (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
|
1214 (let ((item (concat |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1215 gdb-continuation string |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1216 (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
|
1217 (gdb-enqueue-input item) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1218 (setq gdb-continuation nil))))) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1219 (push (concat string "\n") gdb-early-user-input))) |
54538 | 1220 |
1221 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
1222 ;; is a query, or other non-top-level prompt. | |
1223 | |
1224 (defun gdb-enqueue-input (item) | |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1225 (if (not gud-running) |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1226 (if gdb-prompting |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1227 (progn |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1228 (gdb-send-item item) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1229 (setq gdb-prompting nil)) |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1230 (push item gdb-input-queue)))) |
54538 | 1231 |
1232 (defun gdb-dequeue-input () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1233 (let ((queue gdb-input-queue)) |
79812
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1234 (if queue |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1235 (let ((last (car (last queue)))) |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1236 (unless (nbutlast queue) (setq gdb-input-queue '())) |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1237 last) |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
1238 ;; 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
|
1239 (setq gdb-pending-triggers nil)))) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1240 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1241 (defun gdb-send-item (item) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1242 (setq gdb-flush-pending-output nil) |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1243 (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
|
1244 (setq gdb-current-item item) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1245 (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
|
1246 (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
|
1247 (if (stringp item) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1248 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1249 (setq gdb-output-sink 'user) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1250 (process-send-string process item)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1251 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1252 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1253 (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
|
1254 (process-send-string process |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1255 (car item)))) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1256 ;; case: eq gud-minor-mode 'gdbmi |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1257 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1258 (setq gdb-output-sink 'emacs) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1259 (process-send-string process (car item))))) |
54538 | 1260 |
1261 ;; | |
1262 ;; output -- things gdb prints to emacs | |
1263 ;; | |
1264 ;; GDB output is a stream interrupted by annotations. | |
1265 ;; Annotations can be recognized by their beginning | |
1266 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
1267 ;; | |
1268 ;; The tag is a string obeying symbol syntax. | |
1269 ;; | |
1270 ;; The optional part `<opt>' can be either the empty string | |
1271 ;; or a space followed by more data relating to the annotation. | |
1272 ;; For example, the SOURCE annotation is followed by a filename, | |
1273 ;; line number and various useless goo. This data must not include | |
1274 ;; any newlines. | |
1275 ;; | |
1276 | |
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
|
1277 (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
|
1278 "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
|
1279 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
|
1280 want the GDB Graphical Interface." |
54538 | 1281 :type 'string |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
1282 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1283 :version "22.1") |
54538 | 1284 |
1285 (defvar gdb-annotation-rules | |
1286 '(("pre-prompt" gdb-pre-prompt) | |
1287 ("prompt" gdb-prompt) | |
1288 ("commands" gdb-subprompt) | |
1289 ("overload-choice" gdb-subprompt) | |
1290 ("query" gdb-subprompt) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1291 ;; 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
|
1292 ("nquery" gdb-subprompt) |
54538 | 1293 ("prompt-for-continue" gdb-subprompt) |
1294 ("post-prompt" gdb-post-prompt) | |
1295 ("source" gdb-source) | |
1296 ("starting" gdb-starting) | |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1297 ("exited" gdb-exited) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1298 ("signalled" gdb-signalled) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1299 ("signal" gdb-signal) |
54538 | 1300 ("breakpoint" gdb-stopping) |
1301 ("watchpoint" gdb-stopping) | |
1302 ("frame-begin" gdb-frame-begin) | |
1303 ("stopped" gdb-stopped) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1304 ("error-begin" gdb-error) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1305 ("error" gdb-error) |
54538 | 1306 ) "An assoc mapping annotation tags to functions which process them.") |
1307 | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1308 (defun gdb-resync() |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1309 (setq gdb-flush-pending-output t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1310 (setq gud-running nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1311 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1312 (propertize "stopped"'face font-lock-warning-face)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1313 (setq gdb-output-sink 'user) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1314 (setq gdb-input-queue nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1315 (setq gdb-pending-triggers nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1316 (setq gdb-prompting t)) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1317 |
54538 | 1318 (defconst gdb-source-spec-regexp |
62716 | 1319 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)") |
54538 | 1320 |
1321 ;; Do not use this except as an annotation handler. | |
1322 (defun gdb-source (args) | |
1323 (string-match gdb-source-spec-regexp args) | |
1324 ;; Extract the frame position from the marker. | |
1325 (setq gud-last-frame | |
1326 (cons | |
1327 (match-string 1 args) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
1328 (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
|
1329 (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
|
1330 ;; cover for auto-display output which comes *before* |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1331 ;; stopped annotation |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1332 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) |
54538 | 1333 |
1334 (defun gdb-pre-prompt (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1335 "An annotation handler for `pre-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1336 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
|
1337 happens to be in effect." |
67164
c3990f178905
(gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents:
67147
diff
changeset
|
1338 (setq gdb-error nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1339 (let ((sink gdb-output-sink)) |
54538 | 1340 (cond |
1341 ((eq sink 'user) t) | |
1342 ((eq sink 'emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1343 (setq gdb-output-sink 'post-emacs)) |
54538 | 1344 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1345 (gdb-resync) |
54538 | 1346 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
1347 | |
1348 (defun gdb-prompt (ignored) | |
1349 "An annotation handler for `prompt'. | |
1350 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
|
1351 (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
|
1352 (gdb-force-mode-line-update |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1353 (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
|
1354 (gdb-init-1) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1355 (setq gdb-first-prompt nil)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1356 (let ((sink gdb-output-sink)) |
54538 | 1357 (cond |
1358 ((eq sink 'user) t) | |
1359 ((eq sink 'post-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1360 (setq gdb-output-sink 'user) |
54538 | 1361 (let ((handler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1362 (car (cdr gdb-current-item)))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1363 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1364 (funcall handler)))) |
1365 (t | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1366 (gdb-resync) |
54538 | 1367 (error "Phase error in gdb-prompt (got %s)" sink)))) |
1368 (let ((input (gdb-dequeue-input))) | |
1369 (if input | |
1370 (gdb-send-item input) | |
1371 (progn | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1372 (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
|
1373 (gud-display-frame) |
79ba128d9b58
(gdb-ready): Move declaration from gud.el to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
88093
diff
changeset
|
1374 (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
|
1375 (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
|
1376 (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
|
1377 (setq gdb-early-user-input (cdr gdb-early-user-input))))))) |
54538 | 1378 |
1379 (defun gdb-subprompt (ignored) | |
1380 "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
|
1381 (setq gdb-prompting t)) |
54538 | 1382 |
1383 (defun gdb-starting (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1384 "An annotation handler for `starting'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1385 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
|
1386 not GDB." |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1387 (setq gdb-active-process t) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1388 (setq gdb-printing t) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1389 (let ((sink gdb-output-sink)) |
54538 | 1390 (cond |
1391 ((eq sink 'user) | |
1392 (progn | |
1393 (setq gud-running t) | |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1394 (setq gdb-inferior-status "running") |
72492
2bf69eaa157d
(gdb-starting): Reset gdb-signalled to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
72481
diff
changeset
|
1395 (setq gdb-signalled nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1396 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1397 (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
|
1398 (gdb-remove-text-properties) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1399 (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
|
1400 (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
|
1401 (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
|
1402 (setq gdb-stack-position nil) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1403 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1404 (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
|
1405 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1406 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1407 (error "Unexpected `starting' annotation"))))) |
54538 | 1408 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1409 (defun gdb-signal (ignored) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1410 (setq gdb-inferior-status "signal") |
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-warning-face)) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1413 (gdb-stopping ignored)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1414 |
54538 | 1415 (defun gdb-stopping (ignored) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1416 "An annotation handler for `breakpoint' and other annotations. |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1417 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
|
1418 being debugged." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1419 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1420 (let ((sink gdb-output-sink)) |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1421 (cond |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1422 ((eq sink 'inferior) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1423 (setq gdb-output-sink 'user)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1424 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1425 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1426 (error "Unexpected stopping annotation")))))) |
54538 | 1427 |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1428 (defun gdb-exited (ignored) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1429 "An annotation handler for `exited' and `signalled'. |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1430 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
|
1431 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
|
1432 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
|
1433 directives." |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1434 (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
|
1435 (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
|
1436 (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
|
1437 (setq gdb-stack-position nil) |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
1438 (setq gud-old-arrow nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1439 (setq gdb-inferior-status "exited") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1440 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1441 (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
|
1442 (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
|
1443 |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1444 (defun gdb-signalled (ignored) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1445 (setq gdb-signalled t)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1446 |
54538 | 1447 (defun gdb-frame-begin (ignored) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1448 (setq gdb-frame-begin t) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1449 (setq gdb-printing nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1450 (let ((sink gdb-output-sink)) |
54538 | 1451 (cond |
1452 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1453 (setq gdb-output-sink 'user)) |
54538 | 1454 ((eq sink 'user) t) |
1455 ((eq sink 'emacs) t) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1456 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1457 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1458 (error "Unexpected frame-begin annotation (%S)" sink))))) |
54538 | 1459 |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1460 (defcustom gdb-same-frame focus-follows-mouse |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1461 "Non-nil means pop up GUD buffer in same frame." |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1462 :group 'gud |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1463 :type 'boolean |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1464 :version "22.1") |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1465 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1466 (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
|
1467 "Non-nil means try to find a source frame 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
|
1468 :group 'gud |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1469 :type 'boolean |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1470 :version "22.1") |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1471 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1472 (defun gdb-find-source-frame (arg) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1473 "Toggle trying to find a source frame further up stack. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
1474 With prefix argument ARG, look for a source frame further up |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
1475 stack if ARG is positive, 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
|
1476 (interactive "P") |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1477 (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
|
1478 (if (null arg) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1479 (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
|
1480 (> (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
|
1481 (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
|
1482 (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
|
1483 |
54538 | 1484 (defun gdb-stopped (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1485 "An annotation handler for `stopped'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1486 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
|
1487 sink to `user' in `gdb-stopping', that is fine." |
54538 | 1488 (setq gud-running nil) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1489 (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
|
1490 (if (and gdb-frame-begin gdb-printing) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1491 (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
|
1492 ;;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
|
1493 ;;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
|
1494 (if gdb-same-frame |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1495 (gdb-display-gdb-buffer) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1496 (gdb-frame-gdb-buffer)) |
72200
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1497 (if gdb-find-source-frame |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1498 ;;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
|
1499 (setq gdb-look-up-stack |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1500 (if (gdb-get-buffer 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1501 'keep |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1502 (progn |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1503 (gdb-get-buffer-create 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1504 (gdb-invalidate-frames) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1505 'delete)))))) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1506 (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
|
1507 (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
|
1508 (setq gdb-inferior-status "stopped") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1509 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1510 (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
|
1511 (let ((sink gdb-output-sink)) |
54538 | 1512 (cond |
1513 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1514 (setq gdb-output-sink 'user)) |
54538 | 1515 ((eq sink 'user) t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1516 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1517 (gdb-resync) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1518 (error "Unexpected stopped annotation")))) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1519 (if gdb-signalled (gdb-exited ignored))) |
54538 | 1520 |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1521 (defun gdb-error (ignored) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1522 (setq gdb-error (not gdb-error))) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1523 |
54538 | 1524 (defun gdb-post-prompt (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1525 "An annotation handler for `post-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1526 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
|
1527 happens to be appropriate." |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
1528 ;; 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
|
1529 ;; yet. |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1530 (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
|
1531 (gdb-get-selected-frame) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1532 (gdb-invalidate-frames) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1533 ;; 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
|
1534 (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
|
1535 (gdb-invalidate-breakpoints) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1536 ;; 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
|
1537 ;; so gdb-pc-address is updated. |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1538 ;; (gdb-invalidate-assembler) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1539 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1540 (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
|
1541 (gdb-invalidate-registers) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1542 (gdb-get-changed-registers) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1543 (gdb-invalidate-registers-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1544 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1545 (gdb-invalidate-memory) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1546 (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
|
1547 (gdb-invalidate-locals) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1548 (gdb-invalidate-locals-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1549 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1550 (gdb-invalidate-threads) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1551 (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3. |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1552 ;; FIXME: with GDB-6 on Darwin, this might very well work. |
64654 | 1553 ;; 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
|
1554 (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
|
1555 (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
|
1556 (gdb-var-update) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1557 (gdb-var-update-1))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1558 (setq gdb-first-post-prompt nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1559 (let ((sink gdb-output-sink)) |
54538 | 1560 (cond |
1561 ((eq sink 'user) t) | |
1562 ((eq sink 'pre-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1563 (setq gdb-output-sink 'emacs)) |
54538 | 1564 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1565 (gdb-resync) |
54538 | 1566 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
1567 | |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1568 (defconst gdb-buffer-list |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1569 '(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
|
1570 |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1571 (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
|
1572 (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
|
1573 (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
|
1574 (if buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1575 (with-current-buffer buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1576 (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
|
1577 (remove-text-properties |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1578 (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
|
1579 |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1580 ;; 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
|
1581 ;; 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
|
1582 ;; visited breakpoint is, use that window. |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1583 (defun gdb-display-source-buffer (buffer) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1584 (let* ((last-window (if gud-last-last-frame |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1585 (get-buffer-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1586 (gud-find-file (car gud-last-last-frame))))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1587 (source-window (or last-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1588 (if (and gdb-source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1589 (window-live-p gdb-source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1590 gdb-source-window)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1591 (when source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1592 (setq gdb-source-window source-window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1593 (set-window-buffer source-window buffer)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1594 source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1595 |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1596 ;; 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
|
1597 (defvar gdb-fullname-regexp |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1598 (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*")) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1599 |
54538 | 1600 (defun gud-gdba-marker-filter (string) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1601 "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
|
1602 (if gdb-flush-pending-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1603 nil |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1604 (when gdb-enable-debug |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1605 (push (cons 'recv string) gdb-debug-log) |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1606 (if (and gdb-debug-log-max |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1607 (> (length gdb-debug-log) gdb-debug-log-max)) |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1608 (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil))) |
64654 | 1609 ;; 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
|
1610 (setq gud-marker-acc (concat gud-marker-acc string)) |
64654 | 1611 ;; 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
|
1612 (let ((output "")) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1613 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1614 ;; 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
|
1615 (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
|
1616 (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
|
1617 (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
|
1618 (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
|
1619 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1620 ;; 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
|
1621 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1622 (let* ((annotation-type (match-string 1 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1623 (annotation-arguments (match-string 2 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1624 (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
|
1625 gdb-annotation-rules)) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1626 (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
|
1627 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1628 ;; 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
|
1629 ;; 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
|
1630 ;; elsewhere. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1631 (setq output |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1632 (gdb-concat-output output |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1633 (concat before (if fullname "\n")))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1634 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1635 ;; 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
|
1636 (setq gud-marker-acc after) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1637 |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1638 ;; Call the handler for this annotation. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1639 (if annotation-rule |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1640 (funcall (car (cdr annotation-rule)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1641 annotation-arguments) |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1642 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1643 ;; 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
|
1644 (when fullname |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1645 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1646 ;; 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
|
1647 (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
|
1648 (string-to-number |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1649 (match-string 2 annotation)))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1650 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1651 (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
|
1652 (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
|
1653 'gud-gdb-marker-filter))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1654 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1655 ;; 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
|
1656 ;; 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
|
1657 ;; us to blow up. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1658 ))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1659 |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1660 ;; 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
|
1661 ;; 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
|
1662 (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
|
1663 gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1664 (progn |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1665 ;; 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
|
1666 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1667 (gdb-concat-output output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1668 (substring gud-marker-acc 0 |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1669 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1670 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1671 ;; 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
|
1672 (setq gud-marker-acc (substring gud-marker-acc |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1673 (match-beginning 0)))) |
54538 | 1674 ;; |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1675 ;; In case we know the gud-marker-acc contains no partial annotations: |
54538 | 1676 (progn |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1677 (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
|
1678 (setq gud-marker-acc ""))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1679 output))) |
54538 | 1680 |
1681 (defun gdb-concat-output (so-far new) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1682 (if gdb-error |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1683 (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
|
1684 (let ((sink gdb-output-sink)) |
54538 | 1685 (cond |
1686 ((eq sink 'user) (concat so-far new)) | |
1687 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
1688 ((eq sink 'emacs) | |
1689 (gdb-append-to-partial-output new) | |
1690 so-far) | |
1691 ((eq sink 'inferior) | |
1692 (gdb-append-to-inferior-io new) | |
1693 so-far) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1694 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1695 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1696 (error "Bogon output sink %S" sink))))) |
54538 | 1697 |
1698 (defun gdb-append-to-partial-output (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1699 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1700 (goto-char (point-max)) |
1701 (insert string))) | |
1702 | |
1703 (defun gdb-clear-partial-output () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1704 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1705 (erase-buffer))) |
1706 | |
1707 (defun gdb-append-to-inferior-io (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1708 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1709 (goto-char (point-max)) |
1710 (insert-before-markers string)) | |
1711 (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
|
1712 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t))) |
54538 | 1713 |
1714 (defun gdb-clear-inferior-io () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1715 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1716 (erase-buffer))) |
1717 | |
1718 | |
1719 ;; One trick is to have a command who's output is always available in a buffer | |
1720 ;; of it's own, and is always up to date. We build several buffers of this | |
1721 ;; type. | |
1722 ;; | |
1723 ;; There are two aspects to this: gdb has to tell us when the output for that | |
1724 ;; command might have changed, and we have to be able to run the command | |
1725 ;; behind the user's back. | |
1726 ;; | |
1727 ;; The output phasing associated with the variable gdb-output-sink | |
1728 ;; help us to run commands behind the user's back. | |
1729 ;; | |
1730 ;; Below is the code for specificly managing buffers of output from one | |
1731 ;; command. | |
1732 ;; | |
1733 | |
1734 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | |
1735 ;; It adds an input for the command we are tracking. It should be the | |
1736 ;; annotation rule binding of whatever gdb sends to tell us this command | |
1737 ;; might have changed it's output. | |
1738 ;; | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1739 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
54538 | 1740 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
1741 ;; input in the input queue (see comment about ``gdb communications'' above). | |
1742 | |
1743 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command | |
1744 output-handler) | |
1745 `(defun ,name (&optional ignored) | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1746 (if (and ,demand-predicate |
54538 | 1747 (not (member ',name |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1748 gdb-pending-triggers))) |
54538 | 1749 (progn |
1750 (gdb-enqueue-input | |
1751 (list ,gdb-command ',output-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1752 (push ',name gdb-pending-triggers))))) |
54538 | 1753 |
1754 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) | |
1755 `(defun ,name () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1756 (setq gdb-pending-triggers |
54538 | 1757 (delq ',trigger |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1758 gdb-pending-triggers)) |
54538 | 1759 (let ((buf (gdb-get-buffer ',buf-key))) |
1760 (and buf | |
1761 (with-current-buffer buf | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1762 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1763 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1764 (p (window-point window)) |
54538 | 1765 (buffer-read-only nil)) |
1766 (erase-buffer) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1767 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 1768 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1769 (set-window-start window start) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1770 (set-window-point window p))))) |
54538 | 1771 ;; put customisation here |
1772 (,custom-defun))) | |
1773 | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1774 (defmacro def-gdb-auto-updated-buffer (buffer-key |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1775 trigger-name gdb-command |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1776 output-handler-name custom-defun) |
54538 | 1777 `(progn |
1778 (def-gdb-auto-update-trigger ,trigger-name | |
1779 ;; The demand predicate: | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1780 (gdb-get-buffer ',buffer-key) |
54538 | 1781 ,gdb-command |
1782 ,output-handler-name) | |
1783 (def-gdb-auto-update-handler ,output-handler-name | |
1784 ,trigger-name ,buffer-key ,custom-defun))) | |
1785 | |
1786 | |
1787 ;; | |
1788 ;; Breakpoint buffer : This displays the output of `info breakpoints'. | |
1789 ;; | |
1790 (gdb-set-buffer-rules 'gdb-breakpoints-buffer | |
1791 'gdb-breakpoints-buffer-name | |
1792 'gdb-breakpoints-mode) | |
1793 | |
1794 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
1795 ;; This defines the auto update rule for buffers of type | |
1796 ;; `gdb-breakpoints-buffer'. | |
1797 ;; | |
1798 ;; It defines a function to serve as the annotation handler that | |
1799 ;; handles the `foo-invalidated' message. That function is called: | |
1800 gdb-invalidate-breakpoints | |
1801 ;; | |
1802 ;; To update the buffer, this command is sent to gdb. | |
1803 "server info breakpoints\n" | |
1804 ;; | |
1805 ;; This also defines a function to be the handler for the output | |
1806 ;; from the command above. That function will copy the output into | |
1807 ;; the appropriately typed buffer. That function will be called: | |
1808 gdb-info-breakpoints-handler | |
1809 ;; buffer specific functions | |
1810 gdb-info-breakpoints-custom) | |
1811 | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1812 (defconst breakpoint-xpm-data |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1813 "/* XPM */ |
54538 | 1814 static char *magick[] = { |
1815 /* columns rows colors chars-per-pixel */ | |
1816 \"10 10 2 1\", | |
1817 \" c red\", | |
1818 \"+ c None\", | |
1819 /* pixels */ | |
1820 \"+++ +++\", | |
1821 \"++ ++\", | |
1822 \"+ +\", | |
1823 \" \", | |
1824 \" \", | |
1825 \" \", | |
1826 \" \", | |
1827 \"+ +\", | |
1828 \"++ ++\", | |
1829 \"+++ +++\", | |
1830 };" | |
1831 "XPM data used for breakpoint icon.") | |
1832 | |
1833 (defconst breakpoint-enabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1834 "P1 |
54538 | 1835 10 10\", |
1836 0 0 0 0 1 1 1 1 0 0 0 0 | |
1837 0 0 0 1 1 1 1 1 1 0 0 0 | |
1838 0 0 1 1 1 1 1 1 1 1 0 0 | |
1839 0 1 1 1 1 1 1 1 1 1 1 0 | |
1840 0 1 1 1 1 1 1 1 1 1 1 0 | |
1841 0 1 1 1 1 1 1 1 1 1 1 0 | |
1842 0 1 1 1 1 1 1 1 1 1 1 0 | |
1843 0 0 1 1 1 1 1 1 1 1 0 0 | |
1844 0 0 0 1 1 1 1 1 1 0 0 0 | |
1845 0 0 0 0 1 1 1 1 0 0 0 0" | |
1846 "PBM data used for enabled breakpoint icon.") | |
1847 | |
1848 (defconst breakpoint-disabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1849 "P1 |
54538 | 1850 10 10\", |
1851 0 0 1 0 1 0 1 0 0 0 | |
1852 0 1 0 1 0 1 0 1 0 0 | |
1853 1 0 1 0 1 0 1 0 1 0 | |
1854 0 1 0 1 0 1 0 1 0 1 | |
1855 1 0 1 0 1 0 1 0 1 0 | |
1856 0 1 0 1 0 1 0 1 0 1 | |
1857 1 0 1 0 1 0 1 0 1 0 | |
1858 0 1 0 1 0 1 0 1 0 1 | |
1859 0 0 1 0 1 0 1 0 1 0 | |
1860 0 0 0 1 0 1 0 1 0 0" | |
1861 "PBM data used for disabled breakpoint icon.") | |
1862 | |
1863 (defvar breakpoint-enabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1864 "Icon for enabled breakpoint in display margin.") |
54538 | 1865 |
1866 (defvar breakpoint-disabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1867 "Icon for disabled breakpoint in display margin.") |
54538 | 1868 |
57982
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1869 (and (display-images-p) |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1870 ;; 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
|
1871 (define-fringe-bitmap 'breakpoint |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1872 "\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
|
1873 ;; 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
|
1874 (define-fringe-bitmap 'hollow-right-triangle |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1875 "\xe0\x90\x88\x84\x84\x88\x90\xe0")) |
54538 | 1876 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1877 (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
|
1878 '((t |
78112
6ad309ee5f4e
* replace.el (match): Use yellow1 instead of yellow.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76955
diff
changeset
|
1879 :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
|
1880 :weight bold)) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1881 "Face for enabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1882 :group 'gud) |
54538 | 1883 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1884 (defface breakpoint-disabled |
76955
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1885 '((((class color) (min-colors 88)) :foreground "grey70") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1886 ;; 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
|
1887 (((class color) (min-colors 8) (background light)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1888 :foreground "black") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1889 (((class color) (min-colors 8) (background dark)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1890 :foreground "white") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1891 (((type tty) (class mono)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1892 :inverse-video t) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1893 (t :background "gray")) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1894 "Face for disabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1895 :group 'gud) |
54538 | 1896 |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
1897 (defconst gdb-breakpoint-regexp |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
1898 "\\(?:\\([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
|
1899 |
64654 | 1900 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). |
54538 | 1901 (defun gdb-info-breakpoints-custom () |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1902 (let ((flag) (bptno)) |
64654 | 1903 ;; Remove all breakpoint-icons in source buffers but not assembler buffer. |
54538 | 1904 (dolist (buffer (buffer-list)) |
1905 (with-current-buffer buffer | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1906 (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
|
1907 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name)))) |
54538 | 1908 (gdb-remove-breakpoint-icons (point-min) (point-max))))) |
1909 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) | |
1910 (save-excursion | |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1911 (let ((buffer-read-only nil)) |
54538 | 1912 (goto-char (point-min)) |
1913 (while (< (point) (- (point-max) 1)) | |
1914 (forward-line 1) | |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1915 (if (looking-at gdb-breakpoint-regexp) |
54538 | 1916 (progn |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
1917 (setq bptno (or (match-string 1) (match-string 2))) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
1918 (setq flag (char-after (match-beginning 3))) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
1919 (if (match-string 1) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
1920 (setq gdb-parent-bptno-enabled (eq flag ?y))) |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1921 (add-text-properties |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
1922 (match-beginning 3) (match-end 3) |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1923 (if (eq flag ?y) |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1924 '(face font-lock-warning-face) |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1925 '(face font-lock-type-face))) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1926 (let ((bl (point)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1927 (el (line-end-position))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1928 (if (re-search-forward " in \\(.*\\) at\\s-+" el t) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1929 (progn |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1930 (add-text-properties |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1931 (match-beginning 1) (match-end 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1932 '(face font-lock-function-name-face)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1933 (looking-at "\\(\\S-+\\):\\([0-9]+\\)") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1934 (let ((line (match-string 2)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1935 (file (match-string 1))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1936 (add-text-properties bl el |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1937 '(mouse-face highlight |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1938 help-echo "mouse-2, RET: visit breakpoint")) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1939 (unless (file-exists-p file) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1940 (setq file (cdr (assoc bptno gdb-location-alist)))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1941 (if (and file |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1942 (not (string-equal file "File not found"))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1943 (with-current-buffer |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1944 (find-file-noselect file 'nowarn) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1945 (set (make-local-variable 'gud-minor-mode) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1946 'gdba) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1947 (set (make-local-variable 'tool-bar-map) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1948 gud-tool-bar-map) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1949 ;; Only want one breakpoint icon at each |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1950 ;; location. |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1951 (save-excursion |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1952 (goto-line (string-to-number line)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1953 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1954 (gdb-enqueue-input |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1955 (list |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1956 (concat gdb-server-prefix "list " |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1957 (match-string-no-properties 1) ":1\n") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1958 'ignore)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1959 (gdb-enqueue-input |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1960 (list (concat gdb-server-prefix "info source\n") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1961 `(lambda () (gdb-get-location |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1962 ,bptno ,line ,flag))))))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1963 (if (re-search-forward |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1964 "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1965 el t) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1966 (add-text-properties |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1967 (match-beginning 1) (match-end 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1968 '(face font-lock-function-name-face)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1969 (end-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1970 (re-search-backward "\\s-\\(\\S-*\\)" |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1971 bl t) |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1972 (add-text-properties |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1973 (match-beginning 1) (match-end 1) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1974 '(face font-lock-variable-name-face))))))) |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1975 (end-of-line)))))) |
54962
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1976 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) |
54538 | 1977 |
86886
f43509daf0ee
(gud-remove, gud-break): Declare as functions.
Glenn Morris <rgm@gnu.org>
parents:
86227
diff
changeset
|
1978 (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
|
1979 (declare-function gud-break "gdb-ui" t t) ; gud-def |
f43509daf0ee
(gud-remove, gud-break): Declare as functions.
Glenn Morris <rgm@gnu.org>
parents:
86227
diff
changeset
|
1980 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1981 (defun gdb-mouse-set-clear-breakpoint (event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1982 "Set/clear breakpoint in left fringe/margin with mouse click." |
54538 | 1983 (interactive "e") |
1984 (mouse-minibuffer-check event) | |
1985 (let ((posn (event-end event))) | |
80167
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1986 (if (buffer-file-name) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1987 (if (numberp (posn-point posn)) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1988 (with-selected-window (posn-window posn) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1989 (save-excursion |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1990 (goto-char (posn-point posn)) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1991 (if (or (posn-object posn) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1992 (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
|
1993 'breakpoint)) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1994 (gud-remove nil) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1995 (gud-break nil))))) |
b48b70b93856
(gdb-mouse-set-clear-breakpoint): Fall back
Nick Roberts <nickrob@snap.net.nz>
parents:
80146
diff
changeset
|
1996 (posn-set-point posn)))) |
54538 | 1997 |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1998 (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
|
1999 "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
|
2000 (interactive "e") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2001 (mouse-minibuffer-check event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2002 (let ((posn (event-end event))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2003 (if (numberp (posn-point posn)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2004 (with-selected-window (posn-window posn) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2005 (save-excursion |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2006 (goto-char (posn-point posn)) |
64654 | 2007 (if (posn-object posn) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2008 (let* ((bptno (get-text-property |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2009 0 'gdb-bptno (car (posn-string posn))))) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2010 (string-match "\\([0-9+]\\)*" bptno) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2011 (gdb-enqueue-input |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2012 (list |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2013 (concat gdb-server-prefix |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2014 (if (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2015 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
|
2016 "disable " |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2017 "enable ") |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2018 (match-string 1 bptno) "\n") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2019 'ignore))))))))) |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2020 |
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-fringe (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 fringe with mouse click." |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2023 (interactive "e") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2024 (mouse-minibuffer-check event) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2025 (let* ((posn (event-end event)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2026 (pos (posn-point posn)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2027 obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2028 (when (numberp pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2029 (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
|
2030 (save-excursion |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2031 (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
|
2032 (goto-char pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2033 (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
|
2034 (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
|
2035 (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
|
2036 (when (stringp obj) |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2037 (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
|
2038 (string-match "\\([0-9+]\\)*" bptno) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2039 (gdb-enqueue-input |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2040 (list |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2041 (concat gdb-server-prefix |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2042 (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
|
2043 "disable " |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2044 "enable ") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2045 (match-string 1 bptno) "\n") |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2046 'ignore))))))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2047 |
54538 | 2048 (defun gdb-breakpoints-buffer-name () |
2049 (with-current-buffer gud-comint-buffer | |
2050 (concat "*breakpoints of " (gdb-get-target-string) "*"))) | |
2051 | |
2052 (defun gdb-display-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2053 "Display status of user-settable breakpoints." |
54538 | 2054 (interactive) |
2055 (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
|
2056 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t)) |
54538 | 2057 |
2058 (defun gdb-frame-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2059 "Display status of user-settable breakpoints in a new frame." |
54538 | 2060 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2061 (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
|
2062 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2063 (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer)))) |
54538 | 2064 |
2065 (defvar gdb-breakpoints-mode-map | |
2066 (let ((map (make-sparse-keymap)) | |
2067 (menu (make-sparse-keymap "Breakpoints"))) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2068 (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
|
2069 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
54538 | 2070 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2071 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
54538 | 2072 (suppress-keymap map) |
2073 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) | |
2074 (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
|
2075 (define-key map "D" 'gdb-delete-breakpoint) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2076 ;; 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
|
2077 (define-key map "q" 'gdb-delete-frame-or-window) |
54538 | 2078 (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
|
2079 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2080 (define-key map [follow-link] 'mouse-face) |
54538 | 2081 map)) |
2082 | |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2083 (defun gdb-delete-frame-or-window () |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2084 "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
|
2085 (interactive) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2086 (if (one-window-p) (delete-frame) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2087 (delete-window))) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2088 |
54538 | 2089 (defun gdb-breakpoints-mode () |
2090 "Major mode for gdb breakpoints. | |
2091 | |
2092 \\{gdb-breakpoints-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2093 (kill-all-local-variables) |
54538 | 2094 (setq major-mode 'gdb-breakpoints-mode) |
2095 (setq mode-name "Breakpoints") | |
2096 (use-local-map gdb-breakpoints-mode-map) | |
2097 (setq buffer-read-only t) | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2098 (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
|
2099 (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
|
2100 'gdb-invalidate-breakpoints |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2101 'gdbmi-invalidate-breakpoints)) |
54538 | 2102 |
2103 (defun gdb-toggle-breakpoint () | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2104 "Enable/disable breakpoint at current line." |
54538 | 2105 (interactive) |
2106 (save-excursion | |
2107 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2108 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2109 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2110 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2111 (concat gdb-server-prefix |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2112 (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
|
2113 "disable " |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2114 "enable ") |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2115 (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
|
2116 (error "Not recognized as break/watchpoint line")))) |
54538 | 2117 |
2118 (defun gdb-delete-breakpoint () | |
2119 "Delete the breakpoint at current line." | |
2120 (interactive) | |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2121 (save-excursion |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2122 (beginning-of-line 1) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2123 (if (looking-at gdb-breakpoint-regexp) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2124 (if (match-string 1) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2125 (gdb-enqueue-input |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2126 (list |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2127 (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
|
2128 'ignore)) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2129 (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
|
2130 (error "Not recognized as break/watchpoint line")))) |
54538 | 2131 |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2132 (defun gdb-goto-breakpoint (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2133 "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
|
2134 (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
|
2135 (if event (posn-set-point (event-end event))) |
54538 | 2136 (save-excursion |
2137 (beginning-of-line 1) | |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
2138 (if (looking-at "\\([0-9]+\\.?[0-9]*\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2139 (let ((bptno (match-string 1)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2140 (file (match-string 2)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2141 (line (match-string 3))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2142 (save-selected-window |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2143 (let* ((buffer (find-file-noselect |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2144 (if (file-exists-p file) file |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2145 (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
|
2146 (window (or (gdb-display-source-buffer buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2147 (display-buffer buffer)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2148 (setq gdb-source-window window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2149 (with-current-buffer buffer |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2150 (goto-line (string-to-number line)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2151 (set-window-point window (point)))))) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2152 (error "No location specified.")))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2153 |
54538 | 2154 |
2155 ;; Frames buffer. This displays a perpetually correct bactracktrace | |
2156 ;; (from the command `where'). | |
2157 ;; | |
2158 ;; Alas, if your stack is deep, it is costly. | |
2159 ;; | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2160 (defcustom gdb-max-frames 40 |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2161 "Maximum number of frames displayed in call stack." |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2162 :type 'integer |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2163 :group 'gud |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2164 :version "22.1") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2165 |
54538 | 2166 (gdb-set-buffer-rules 'gdb-stack-buffer |
2167 'gdb-stack-buffer-name | |
2168 'gdb-frames-mode) | |
2169 | |
2170 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
2171 gdb-invalidate-frames | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2172 (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
|
2173 gdb-info-stack-handler |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2174 gdb-info-stack-custom) |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2175 |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2176 (defun gdb-info-stack-custom () |
54538 | 2177 (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
|
2178 (let (move-to) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2179 (save-excursion |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2180 (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
|
2181 (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
|
2182 bl el) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2183 (goto-char (point-min)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2184 (while (< (point) (point-max)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2185 (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
|
2186 el (line-end-position)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2187 (when (looking-at "#") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2188 (add-text-properties bl el |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2189 '(mouse-face highlight |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2190 help-echo "mouse-2, RET: Select frame"))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2191 (goto-char bl) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2192 (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
|
2193 (when (string-equal (match-string 1) gdb-frame-number) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2194 (if (> (car (window-fringes)) 0) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2195 (progn |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2196 (or gdb-stack-position |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2197 (setq gdb-stack-position (make-marker))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2198 (set-marker gdb-stack-position (point)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2199 (setq move-to gdb-stack-position)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2200 (put-text-property bl (+ bl 4) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2201 'face '(:inverse-video t)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2202 (setq move-to bl))) |
92324
516d1f9d5ddb
(gdb-info-stack-custom): Apply
Nick Roberts <nickrob@snap.net.nz>
parents:
92148
diff
changeset
|
2203 (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
|
2204 (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
|
2205 '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
|
2206 (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
|
2207 (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
|
2208 (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
|
2209 '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
|
2210 (goto-char bl) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2211 (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
|
2212 (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
|
2213 '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
|
2214 (forward-line 1)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2215 (forward-line -1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2216 (when (looking-at "(More stack frames follow...)") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2217 (add-text-properties (match-beginning 0) (match-end 0) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2218 '(mouse-face highlight |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2219 gdb-max-frames t |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2220 help-echo |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2221 "mouse-2, RET: customize gdb-max-frames to see more frames"))))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2222 (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
|
2223 (goto-char (point-min)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2224 (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
|
2225 (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
|
2226 (file (match-string 1)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2227 (line (match-string 2))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2228 (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
|
2229 (gdb-enqueue-input |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2230 (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
|
2231 (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
|
2232 (gdb-enqueue-input |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2233 (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
|
2234 (when move-to |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2235 (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
|
2236 (when window |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2237 (with-selected-window window |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2238 (goto-char move-to) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2239 (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
|
2240 (recenter '(center))))))))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2241 (if (eq gdb-look-up-stack 'delete) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2242 (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
|
2243 (setq gdb-look-up-stack nil)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2244 |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2245 (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
|
2246 (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
|
2247 (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
|
2248 (setq fringe-indicator-alist |
6564e84a8e09
(gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents:
72200
diff
changeset
|
2249 '((overlay-arrow . hollow-right-triangle)))))) |
54538 | 2250 |
2251 (defun gdb-stack-buffer-name () | |
2252 (with-current-buffer gud-comint-buffer | |
2253 (concat "*stack frames of " (gdb-get-target-string) "*"))) | |
2254 | |
2255 (defun gdb-display-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2256 "Display backtrace of current stack." |
54538 | 2257 (interactive) |
2258 (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
|
2259 (gdb-get-buffer-create 'gdb-stack-buffer) t)) |
54538 | 2260 |
2261 (defun gdb-frame-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2262 "Display backtrace of current stack in a new frame." |
54538 | 2263 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2264 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2265 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2266 (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer)))) |
54538 | 2267 |
2268 (defvar gdb-frames-mode-map | |
2269 (let ((map (make-sparse-keymap))) | |
2270 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2271 (define-key map "q" 'kill-this-buffer) |
54538 | 2272 (define-key map "\r" 'gdb-frames-select) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2273 (define-key map [mouse-2] 'gdb-frames-select) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2274 (define-key map [follow-link] 'mouse-face) |
54538 | 2275 map)) |
2276 | |
2277 (defun gdb-frames-mode () | |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2278 "Major mode for gdb call stack. |
54538 | 2279 |
2280 \\{gdb-frames-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2281 (kill-all-local-variables) |
54538 | 2282 (setq major-mode 'gdb-frames-mode) |
2283 (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
|
2284 (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
|
2285 (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
|
2286 (setq truncate-lines t) ;; Make it easier to see overlay arrow. |
54538 | 2287 (setq buffer-read-only t) |
2288 (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
|
2289 (run-mode-hooks 'gdb-frames-mode-hook) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
2290 (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
|
2291 'gdb-invalidate-frames |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2292 'gdbmi-invalidate-frames)) |
54538 | 2293 |
2294 (defun gdb-get-frame-number () | |
2295 (save-excursion | |
65861
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
2296 (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
|
2297 (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
|
2298 (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2299 (n (or (and pos (match-string 1)) "0"))) |
54538 | 2300 n))) |
2301 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2302 (defun gdb-frames-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2303 "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
|
2304 (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
|
2305 (if event (posn-set-point (event-end event))) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2306 (if (get-text-property (point) 'gdb-max-frames) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2307 (progn |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2308 (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
|
2309 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
|
2310 (customize-variable-other-window 'gdb-max-frames)) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2311 (gdb-enqueue-input |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2312 (list (concat gdb-server-prefix "frame " |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2313 (gdb-get-frame-number) "\n") 'ignore)))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2314 |
54538 | 2315 |
2316 ;; Threads buffer. This displays a selectable thread list. | |
2317 ;; | |
2318 (gdb-set-buffer-rules 'gdb-threads-buffer | |
2319 'gdb-threads-buffer-name | |
2320 'gdb-threads-mode) | |
2321 | |
2322 (def-gdb-auto-updated-buffer gdb-threads-buffer | |
2323 gdb-invalidate-threads | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2324 (concat gdb-server-prefix "info threads\n") |
54538 | 2325 gdb-info-threads-handler |
2326 gdb-info-threads-custom) | |
2327 | |
2328 (defun gdb-info-threads-custom () | |
2329 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | |
2330 (let ((buffer-read-only nil)) | |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2331 (save-excursion |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2332 (goto-char (point-min)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2333 (while (< (point) (point-max)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2334 (unless (looking-at "No ") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2335 (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
|
2336 '(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
|
2337 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
|
2338 (forward-line 1)))))) |
54538 | 2339 |
2340 (defun gdb-threads-buffer-name () | |
2341 (with-current-buffer gud-comint-buffer | |
2342 (concat "*threads of " (gdb-get-target-string) "*"))) | |
2343 | |
2344 (defun gdb-display-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2345 "Display IDs of currently known threads." |
54538 | 2346 (interactive) |
2347 (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
|
2348 (gdb-get-buffer-create 'gdb-threads-buffer) t)) |
54538 | 2349 |
2350 (defun gdb-frame-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2351 "Display IDs of currently known threads in a new frame." |
54538 | 2352 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2353 (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
|
2354 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2355 (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer)))) |
54538 | 2356 |
2357 (defvar gdb-threads-mode-map | |
2358 (let ((map (make-sparse-keymap))) | |
2359 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2360 (define-key map "q" 'kill-this-buffer) |
54538 | 2361 (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
|
2362 (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
|
2363 (define-key map [follow-link] 'mouse-face) |
54538 | 2364 map)) |
2365 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2366 (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
|
2367 '((") +\\([^ ]+\\) (" (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
|
2368 ("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
|
2369 ("\\(\\(\\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
|
2370 "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
|
2371 |
54538 | 2372 (defun gdb-threads-mode () |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2373 "Major mode for gdb threads. |
54538 | 2374 |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2375 \\{gdb-threads-mode-map}" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2376 (kill-all-local-variables) |
54538 | 2377 (setq major-mode 'gdb-threads-mode) |
2378 (setq mode-name "Threads") | |
2379 (setq buffer-read-only t) | |
2380 (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
|
2381 (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
|
2382 '(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
|
2383 (run-mode-hooks 'gdb-threads-mode-hook) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2384 'gdb-invalidate-threads) |
54538 | 2385 |
2386 (defun gdb-get-thread-number () | |
2387 (save-excursion | |
2388 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) | |
2389 (match-string-no-properties 1))) | |
2390 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2391 (defun gdb-threads-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2392 "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
|
2393 (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
|
2394 (if event (posn-set-point (event-end event))) |
54538 | 2395 (gdb-enqueue-input |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2396 (list (concat gdb-server-prefix "thread " |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2397 (gdb-get-thread-number) "\n") 'ignore)) |
54538 | 2398 (gud-display-frame)) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2399 |
54538 | 2400 |
2401 ;; Registers buffer. | |
2402 ;; | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2403 (defcustom gdb-all-registers nil |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2404 "Non-nil means include floating-point registers." |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2405 :type 'boolean |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2406 :group 'gud |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2407 :version "22.1") |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2408 |
54538 | 2409 (gdb-set-buffer-rules 'gdb-registers-buffer |
2410 'gdb-registers-buffer-name | |
2411 'gdb-registers-mode) | |
2412 | |
2413 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
2414 gdb-invalidate-registers | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2415 (concat |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2416 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n") |
54538 | 2417 gdb-info-registers-handler |
2418 gdb-info-registers-custom) | |
2419 | |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2420 (defun gdb-info-registers-custom () |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2421 (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
|
2422 (save-excursion |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2423 (let ((buffer-read-only nil) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2424 start end) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2425 (goto-char (point-min)) |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2426 (while (< (point) (point-max)) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2427 (setq start (line-beginning-position)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2428 (setq end (line-end-position)) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2429 (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
|
2430 (unless (string-equal (match-string 0) "The") |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2431 (put-text-property start (match-end 0) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2432 '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
|
2433 (add-text-properties start end |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2434 '(help-echo "mouse-2: edit value" |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2435 mouse-face highlight)))) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2436 (forward-line 1)))))) |
54538 | 2437 |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2438 (defun gdb-edit-register-value (&optional event) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2439 (interactive (list last-input-event)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2440 (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
|
2441 (if event (posn-set-point (event-end event))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2442 (beginning-of-line) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2443 (let* ((register (current-word)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2444 (value (read-string (format "New value (%s): " register)))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2445 (gdb-enqueue-input |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2446 (list (concat gdb-server-prefix "set $" register "=" value "\n") |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2447 'ignore))))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2448 |
54538 | 2449 (defvar gdb-registers-mode-map |
2450 (let ((map (make-sparse-keymap))) | |
2451 (suppress-keymap map) | |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2452 (define-key map "\r" 'gdb-edit-register-value) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2453 (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
|
2454 (define-key map " " 'gdb-all-registers) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2455 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2456 map)) |
54538 | 2457 |
2458 (defun gdb-registers-mode () | |
2459 "Major mode for gdb registers. | |
2460 | |
2461 \\{gdb-registers-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2462 (kill-all-local-variables) |
54538 | 2463 (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
|
2464 (setq mode-name "Registers") |
54538 | 2465 (setq buffer-read-only t) |
2466 (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
|
2467 (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
|
2468 (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
|
2469 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2470 (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
|
2471 'gdb-invalidate-registers) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2472 'gdb-invalidate-registers-1)) |
54538 | 2473 |
2474 (defun gdb-registers-buffer-name () | |
2475 (with-current-buffer gud-comint-buffer | |
2476 (concat "*registers of " (gdb-get-target-string) "*"))) | |
2477 | |
2478 (defun gdb-display-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2479 "Display integer register contents." |
54538 | 2480 (interactive) |
2481 (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
|
2482 (gdb-get-buffer-create 'gdb-registers-buffer) t)) |
54538 | 2483 |
2484 (defun gdb-frame-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2485 "Display integer register contents in a new frame." |
54538 | 2486 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2487 (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
|
2488 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2489 (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer)))) |
59808 | 2490 |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
2491 (defun gdb-all-registers () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2492 "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
|
2493 (interactive) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2494 (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
|
2495 (if gdb-all-registers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2496 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2497 (setq gdb-all-registers nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2498 (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
|
2499 (setq mode-name "Registers"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2500 (setq gdb-all-registers t) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2501 (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
|
2502 (setq mode-name "Registers:All"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2503 (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
|
2504 (if gdb-all-registers "en" "dis"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2505 (gdb-invalidate-registers))) |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2506 |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2507 |
59808 | 2508 ;; Memory buffer. |
2509 ;; | |
2510 (defcustom gdb-memory-repeat-count 32 | |
2511 "Number of data items in memory window." | |
2512 :type 'integer | |
2513 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2514 :version "22.1") |
59808 | 2515 |
2516 (defcustom gdb-memory-format "x" | |
2517 "Display format of data items in memory window." | |
2518 :type '(choice (const :tag "Hexadecimal" "x") | |
2519 (const :tag "Signed decimal" "d") | |
2520 (const :tag "Unsigned decimal" "u") | |
2521 (const :tag "Octal" "o") | |
2522 (const :tag "Binary" "t")) | |
2523 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2524 :version "22.1") |
59808 | 2525 |
2526 (defcustom gdb-memory-unit "w" | |
2527 "Unit size of data items in memory window." | |
2528 :type '(choice (const :tag "Byte" "b") | |
2529 (const :tag "Halfword" "h") | |
2530 (const :tag "Word" "w") | |
2531 (const :tag "Giant word" "g")) | |
2532 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2533 :version "22.1") |
59808 | 2534 |
2535 (gdb-set-buffer-rules 'gdb-memory-buffer | |
2536 'gdb-memory-buffer-name | |
2537 'gdb-memory-mode) | |
2538 | |
2539 (def-gdb-auto-updated-buffer gdb-memory-buffer | |
2540 gdb-invalidate-memory | |
2541 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count) | |
2542 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n") | |
2543 gdb-read-memory-handler | |
2544 gdb-read-memory-custom) | |
2545 | |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2546 (defun gdb-read-memory-custom () |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2547 (save-excursion |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2548 (goto-char (point-min)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2549 (if (looking-at "0x[[:xdigit:]]+") |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2550 (setq gdb-memory-address (match-string 0))))) |
59808 | 2551 |
2552 (defvar gdb-memory-mode-map | |
2553 (let ((map (make-sparse-keymap))) | |
2554 (suppress-keymap map) | |
2555 (define-key map "q" 'kill-this-buffer) | |
2556 map)) | |
2557 | |
2558 (defun gdb-memory-set-address (event) | |
2559 "Set the start memory address." | |
2560 (interactive "e") | |
2561 (save-selected-window | |
2562 (select-window (posn-window (event-start event))) | |
2563 (let ((arg (read-from-minibuffer "Memory address: "))) | |
2564 (setq gdb-memory-address arg)) | |
2565 (gdb-invalidate-memory))) | |
2566 | |
2567 (defun gdb-memory-set-repeat-count (event) | |
2568 "Set the number of data items in memory window." | |
2569 (interactive "e") | |
2570 (save-selected-window | |
2571 (select-window (posn-window (event-start event))) | |
2572 (let* ((arg (read-from-minibuffer "Repeat count: ")) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2573 (count (string-to-number arg))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2574 (if (<= count 0) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2575 (error "Positive numbers only") |
59808 | 2576 (customize-set-variable 'gdb-memory-repeat-count count) |
2577 (gdb-invalidate-memory))))) | |
2578 | |
2579 (defun gdb-memory-format-binary () | |
2580 "Set the display format to binary." | |
2581 (interactive) | |
2582 (customize-set-variable 'gdb-memory-format "t") | |
2583 (gdb-invalidate-memory)) | |
2584 | |
2585 (defun gdb-memory-format-octal () | |
2586 "Set the display format to octal." | |
2587 (interactive) | |
2588 (customize-set-variable 'gdb-memory-format "o") | |
2589 (gdb-invalidate-memory)) | |
2590 | |
2591 (defun gdb-memory-format-unsigned () | |
2592 "Set the display format to unsigned decimal." | |
2593 (interactive) | |
2594 (customize-set-variable 'gdb-memory-format "u") | |
2595 (gdb-invalidate-memory)) | |
2596 | |
2597 (defun gdb-memory-format-signed () | |
2598 "Set the display format to decimal." | |
2599 (interactive) | |
2600 (customize-set-variable 'gdb-memory-format "d") | |
2601 (gdb-invalidate-memory)) | |
2602 | |
2603 (defun gdb-memory-format-hexadecimal () | |
2604 "Set the display format to hexadecimal." | |
2605 (interactive) | |
2606 (customize-set-variable 'gdb-memory-format "x") | |
2607 (gdb-invalidate-memory)) | |
2608 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2609 (defvar gdb-memory-format-map |
59808 | 2610 (let ((map (make-sparse-keymap))) |
2611 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) | |
2612 map) | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2613 "Keymap to select format in the header line.") |
59808 | 2614 |
2615 (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
|
2616 "Menu of display formats in the header line.") |
59808 | 2617 |
2618 (define-key gdb-memory-format-menu [binary] | |
2619 '(menu-item "Binary" gdb-memory-format-binary | |
2620 :button (:radio . (equal gdb-memory-format "t")))) | |
2621 (define-key gdb-memory-format-menu [octal] | |
2622 '(menu-item "Octal" gdb-memory-format-octal | |
2623 :button (:radio . (equal gdb-memory-format "o")))) | |
2624 (define-key gdb-memory-format-menu [unsigned] | |
2625 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned | |
2626 :button (:radio . (equal gdb-memory-format "u")))) | |
2627 (define-key gdb-memory-format-menu [signed] | |
2628 '(menu-item "Signed Decimal" gdb-memory-format-signed | |
2629 :button (:radio . (equal gdb-memory-format "d")))) | |
2630 (define-key gdb-memory-format-menu [hexadecimal] | |
2631 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal | |
2632 :button (:radio . (equal gdb-memory-format "x")))) | |
2633 | |
2634 (defun gdb-memory-format-menu (event) | |
2635 (interactive "@e") | |
2636 (x-popup-menu event gdb-memory-format-menu)) | |
2637 | |
2638 (defun gdb-memory-format-menu-1 (event) | |
2639 (interactive "e") | |
2640 (save-selected-window | |
2641 (select-window (posn-window (event-start event))) | |
2642 (let* ((selection (gdb-memory-format-menu event)) | |
2643 (binding (and selection (lookup-key gdb-memory-format-menu | |
2644 (vector (car selection)))))) | |
2645 (if binding (call-interactively binding))))) | |
2646 | |
2647 (defun gdb-memory-unit-giant () | |
2648 "Set the unit size to giant words (eight bytes)." | |
2649 (interactive) | |
2650 (customize-set-variable 'gdb-memory-unit "g") | |
2651 (gdb-invalidate-memory)) | |
2652 | |
2653 (defun gdb-memory-unit-word () | |
2654 "Set the unit size to words (four bytes)." | |
2655 (interactive) | |
2656 (customize-set-variable 'gdb-memory-unit "w") | |
2657 (gdb-invalidate-memory)) | |
2658 | |
2659 (defun gdb-memory-unit-halfword () | |
2660 "Set the unit size to halfwords (two bytes)." | |
2661 (interactive) | |
2662 (customize-set-variable 'gdb-memory-unit "h") | |
2663 (gdb-invalidate-memory)) | |
2664 | |
2665 (defun gdb-memory-unit-byte () | |
2666 "Set the unit size to bytes." | |
2667 (interactive) | |
2668 (customize-set-variable 'gdb-memory-unit "b") | |
2669 (gdb-invalidate-memory)) | |
2670 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2671 (defvar gdb-memory-unit-map |
59808 | 2672 (let ((map (make-sparse-keymap))) |
2673 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) | |
2674 map) | |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2675 "Keymap to select units in the header line.") |
59808 | 2676 |
2677 (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
|
2678 "Menu of units in the header line.") |
59808 | 2679 |
2680 (define-key gdb-memory-unit-menu [giantwords] | |
2681 '(menu-item "Giant words" gdb-memory-unit-giant | |
2682 :button (:radio . (equal gdb-memory-unit "g")))) | |
2683 (define-key gdb-memory-unit-menu [words] | |
2684 '(menu-item "Words" gdb-memory-unit-word | |
2685 :button (:radio . (equal gdb-memory-unit "w")))) | |
2686 (define-key gdb-memory-unit-menu [halfwords] | |
2687 '(menu-item "Halfwords" gdb-memory-unit-halfword | |
2688 :button (:radio . (equal gdb-memory-unit "h")))) | |
2689 (define-key gdb-memory-unit-menu [bytes] | |
2690 '(menu-item "Bytes" gdb-memory-unit-byte | |
2691 :button (:radio . (equal gdb-memory-unit "b")))) | |
2692 | |
2693 (defun gdb-memory-unit-menu (event) | |
2694 (interactive "@e") | |
2695 (x-popup-menu event gdb-memory-unit-menu)) | |
2696 | |
2697 (defun gdb-memory-unit-menu-1 (event) | |
2698 (interactive "e") | |
2699 (save-selected-window | |
2700 (select-window (posn-window (event-start event))) | |
2701 (let* ((selection (gdb-memory-unit-menu event)) | |
2702 (binding (and selection (lookup-key gdb-memory-unit-menu | |
2703 (vector (car selection)))))) | |
2704 (if binding (call-interactively binding))))) | |
2705 | |
2706 ;;from make-mode-line-mouse-map | |
2707 (defun gdb-make-header-line-mouse-map (mouse function) "\ | |
2708 Return a keymap with single entry for mouse key MOUSE on the header line. | |
2709 MOUSE is defined to run function FUNCTION with no args in the buffer | |
2710 corresponding to the mode line clicked." | |
2711 (let ((map (make-sparse-keymap))) | |
2712 (define-key map (vector 'header-line mouse) function) | |
2713 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) | |
2714 map)) | |
2715 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2716 (defvar gdb-memory-font-lock-keywords |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2717 '(;; <__function.name+n> |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2718 ("<\\(\\(\\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
|
2719 ) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2720 "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
|
2721 |
59808 | 2722 (defun gdb-memory-mode () |
2723 "Major mode for examining memory. | |
2724 | |
2725 \\{gdb-memory-mode-map}" | |
2726 (kill-all-local-variables) | |
2727 (setq major-mode 'gdb-memory-mode) | |
2728 (setq mode-name "Memory") | |
2729 (setq buffer-read-only t) | |
2730 (use-local-map gdb-memory-mode-map) | |
2731 (setq header-line-format | |
2732 '(:eval | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2733 (concat |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2734 "Read address[" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2735 (propertize |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2736 "-" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2737 'face font-lock-warning-face |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2738 'help-echo "mouse-1: decrement address" |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2739 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2740 'local-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2741 (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2742 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2743 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2744 (let ((gdb-memory-address |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2745 ;; Let GDB do the arithmetic. |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2746 (concat |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2747 gdb-memory-address " - " |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2748 (number-to-string |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2749 (* gdb-memory-repeat-count |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2750 (cond ((string= gdb-memory-unit "b") 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2751 ((string= gdb-memory-unit "h") 2) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2752 ((string= gdb-memory-unit "w") 4) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2753 ((string= gdb-memory-unit "g") 8))))))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2754 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2755 "|" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2756 (propertize "+" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2757 'face font-lock-warning-face |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2758 'help-echo "mouse-1: increment address" |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2759 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2760 'local-map (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2761 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2762 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2763 (let ((gdb-memory-address nil)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2764 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2765 "]: " |
59808 | 2766 (propertize gdb-memory-address |
2767 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2768 'help-echo "mouse-1: set memory address" |
62716 | 2769 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2770 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2771 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2772 #'gdb-memory-set-address)) |
59808 | 2773 " Repeat Count: " |
2774 (propertize (number-to-string gdb-memory-repeat-count) | |
2775 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2776 'help-echo "mouse-1: set repeat count" |
62716 | 2777 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2778 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2779 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2780 #'gdb-memory-set-repeat-count)) |
59808 | 2781 " Display Format: " |
2782 (propertize gdb-memory-format | |
2783 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2784 'help-echo "mouse-3: select display format" |
62716 | 2785 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2786 'local-map gdb-memory-format-map) |
59808 | 2787 " Unit Size: " |
2788 (propertize gdb-memory-unit | |
2789 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2790 'help-echo "mouse-3: select unit size" |
62716 | 2791 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2792 '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
|
2793 (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
|
2794 '(gdb-memory-font-lock-keywords)) |
59808 | 2795 (run-mode-hooks 'gdb-memory-mode-hook) |
2796 'gdb-invalidate-memory) | |
2797 | |
2798 (defun gdb-memory-buffer-name () | |
2799 (with-current-buffer gud-comint-buffer | |
2800 (concat "*memory of " (gdb-get-target-string) "*"))) | |
2801 | |
2802 (defun gdb-display-memory-buffer () | |
2803 "Display memory contents." | |
2804 (interactive) | |
2805 (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
|
2806 (gdb-get-buffer-create 'gdb-memory-buffer) t)) |
59808 | 2807 |
2808 (defun gdb-frame-memory-buffer () | |
2809 "Display memory contents in a new frame." | |
2810 (interactive) | |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2811 (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
|
2812 (special-display-frame-alist |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2813 (cons '(left-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2814 (cons '(right-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2815 (cons '(width . 83) gdb-frame-parameters))))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2816 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) |
54538 | 2817 |
59808 | 2818 |
54538 | 2819 ;; Locals buffer. |
2820 ;; | |
2821 (gdb-set-buffer-rules 'gdb-locals-buffer | |
2822 'gdb-locals-buffer-name | |
2823 'gdb-locals-mode) | |
2824 | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2825 (def-gdb-auto-update-trigger gdb-invalidate-locals |
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2826 (gdb-get-buffer 'gdb-locals-buffer) |
54538 | 2827 "server info locals\n" |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2828 gdb-info-locals-handler) |
54538 | 2829 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2830 (defvar gdb-locals-watch-map |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2831 (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
|
2832 (suppress-keymap map) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2833 (define-key map "\r" (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2834 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2835 (gud-watch))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2836 (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
|
2837 (mouse-set-point event) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2838 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2839 (gud-watch))) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2840 map) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
2841 "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
|
2842 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2843 (defconst gdb-struct-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2844 (concat (propertize "[struct/union]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2845 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2846 '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
|
2847 '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
|
2848 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2849 (defconst gdb-array-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2850 (concat " " (propertize "[array]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2851 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2852 '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
|
2853 '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
|
2854 |
54538 | 2855 ;; Abbreviate for arrays and structures. |
2856 ;; 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
|
2857 (defun gdb-info-locals-handler () |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2858 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2859 gdb-pending-triggers)) |
54538 | 2860 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer))) |
2861 (with-current-buffer buf | |
2862 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2863 (while (re-search-forward "^[ }].*\n" nil t) |
54538 | 2864 (replace-match "" nil nil)) |
2865 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2866 (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
|
2867 (replace-match gdb-struct-string nil nil)) |
54538 | 2868 (goto-char (point-min)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2869 (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
|
2870 (replace-match gdb-array-string nil nil)))) |
54538 | 2871 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2872 (and buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2873 (with-current-buffer buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2874 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2875 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2876 (p (window-point window)) |
54538 | 2877 (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
|
2878 (erase-buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2879 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 2880 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2881 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2882 (set-window-point window p)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2883 ))) |
54538 | 2884 (run-hooks 'gdb-info-locals-hook)) |
2885 | |
2886 (defvar gdb-locals-mode-map | |
2887 (let ((map (make-sparse-keymap))) | |
2888 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2889 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2890 map)) |
54538 | 2891 |
2892 (defun gdb-locals-mode () | |
2893 "Major mode for gdb locals. | |
2894 | |
2895 \\{gdb-locals-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2896 (kill-all-local-variables) |
54538 | 2897 (setq major-mode 'gdb-locals-mode) |
62716 | 2898 (setq mode-name (concat "Locals:" gdb-selected-frame)) |
54538 | 2899 (setq buffer-read-only t) |
2900 (use-local-map gdb-locals-mode-map) | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2901 (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
|
2902 '(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
|
2903 (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
|
2904 (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
|
2905 (string-equal gdb-version "pre-6.4")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2906 'gdb-invalidate-locals |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2907 'gdb-invalidate-locals-1)) |
54538 | 2908 |
2909 (defun gdb-locals-buffer-name () | |
2910 (with-current-buffer gud-comint-buffer | |
2911 (concat "*locals of " (gdb-get-target-string) "*"))) | |
2912 | |
2913 (defun gdb-display-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2914 "Display local variables of current stack and their values." |
54538 | 2915 (interactive) |
2916 (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
|
2917 (gdb-get-buffer-create 'gdb-locals-buffer) t)) |
54538 | 2918 |
2919 (defun gdb-frame-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2920 "Display local variables of current stack and their values in a new frame." |
54538 | 2921 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2922 (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
|
2923 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2924 (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer)))) |
54538 | 2925 |
2926 | |
2927 ;;;; Window management | |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2928 (defun gdb-display-buffer (buf dedicated &optional size) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2929 (let ((answer (get-buffer-window buf 0)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2930 (must-split nil)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2931 (if answer |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
2932 (display-buffer buf nil 0) ;Deiconify the frame if necessary. |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2933 ;; The buffer is not yet displayed. |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2934 (pop-to-buffer gud-comint-buffer) ;Select the right frame. |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2935 (let ((window (get-lru-window))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2936 (if (and window |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2937 (not (memq window `(,(get-buffer-window gud-comint-buffer) |
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2938 ,gdb-source-window)))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2939 (progn |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2940 (set-window-buffer window buf) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2941 (setq answer window)) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2942 (setq must-split t))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2943 (if must-split |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2944 (let* ((largest (get-largest-window)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2945 (cur-size (window-height largest)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2946 (new-size (and size (< size cur-size) (- cur-size size)))) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2947 (setq answer (split-window largest new-size)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2948 (set-window-buffer answer buf) |
71877
28ec37c2aa2c
(gdb-display-buffer): Check for gdb-source-window. Add dedicated argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
71409
diff
changeset
|
2949 (set-window-dedicated-p answer dedicated))) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2950 answer))) |
54538 | 2951 |
2952 | |
2953 ;;; Shared keymap initialization: | |
2954 | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2955 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2956 (define-key gud-menu-map [displays] |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2957 `(menu-item "GDB-Windows" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2958 :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
|
2959 (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
|
2960 (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
|
2961 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2962 '(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
|
2963 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2964 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2965 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2966 (define-key menu [disassembly] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2967 '("Disassembly" . gdb-display-assembler-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2968 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2969 '("Breakpoints" . gdb-display-breakpoints-buffer)) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2970 (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
|
2971 (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
|
2972 |
54538 | 2973 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
2974 (define-key gud-menu-map [frames] | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2975 `(menu-item "GDB-Frames" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2976 :visible (memq gud-minor-mode '(gdbmi gdba)))) |
54538 | 2977 (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
|
2978 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
59808 | 2979 (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
|
2980 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2981 '(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
|
2982 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2983 (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
|
2984 (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
|
2985 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2986 '("Breakpoints" . gdb-frame-breakpoints-buffer)) |
54538 | 2987 (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
|
2988 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))) |
54538 | 2989 |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
2990 (let ((menu (make-sparse-keymap "GDB-UI/MI"))) |
54538 | 2991 (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
|
2992 `(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
|
2993 ,menu :visible (memq gud-minor-mode '(gdbmi gdba)))) |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
2994 (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
|
2995 '(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
|
2996 :visible (eq gud-minor-mode 'gdba) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
2997 :help "Toggle look for source frame." |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
2998 :button (:toggle . gdb-find-source-frame))) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2999 (define-key menu [gdb-use-separate-io] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
3000 '(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
|
3001 :visible (eq gud-minor-mode 'gdba) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
3002 :help "Toggle separate IO for debugged program." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3003 :button (:toggle . gdb-use-separate-io-buffer))) |
54538 | 3004 (define-key menu [gdb-many-windows] |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3005 '(menu-item "Display Other Windows" gdb-many-windows |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3006 :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
|
3007 :button (:toggle . gdb-many-windows))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
3008 (define-key menu [gdb-restore-windows] |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
3009 '(menu-item "Restore Window Layout" gdb-restore-windows |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
3010 :help "Restore standard layout for debug session."))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3011 |
54538 | 3012 (defun gdb-frame-gdb-buffer () |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3013 "Display GUD buffer in a new frame." |
54538 | 3014 (interactive) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3015 (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
|
3016 (special-display-frame-alist |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
3017 (remove '(menu-bar-lines) (remove '(tool-bar-lines) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
3018 gdb-frame-parameters))) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
3019 (same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
3020 (display-buffer gud-comint-buffer))) |
54538 | 3021 |
3022 (defun gdb-display-gdb-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3023 "Display GUD buffer." |
54538 | 3024 (interactive) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
3025 (let ((same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
3026 (pop-to-buffer gud-comint-buffer))) |
54538 | 3027 |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3028 (defun gdb-set-window-buffer (name) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3029 (set-window-buffer (selected-window) (get-buffer name)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3030 (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
|
3031 |
54538 | 3032 (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
|
3033 "Layout the window pattern for `gdb-many-windows'." |
54538 | 3034 (gdb-display-locals-buffer) |
3035 (gdb-display-stack-buffer) | |
3036 (delete-other-windows) | |
3037 (gdb-display-breakpoints-buffer) | |
3038 (delete-other-windows) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3039 ; Don't dedicate. |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3040 (pop-to-buffer gud-comint-buffer) |
54538 | 3041 (split-window nil ( / ( * (window-height) 3) 4)) |
3042 (split-window nil ( / (window-height) 3)) | |
3043 (split-window-horizontally) | |
3044 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3045 (gdb-set-window-buffer (gdb-locals-buffer-name)) |
54538 | 3046 (other-window 1) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3047 (switch-to-buffer |
54538 | 3048 (if gud-last-last-frame |
3049 (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
|
3050 (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
|
3051 (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
|
3052 ;; 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
|
3053 ;; 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
|
3054 (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
|
3055 (setq gdb-source-window (selected-window)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3056 (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
|
3057 (split-window-horizontally) |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
3058 (other-window 1) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3059 (gdb-set-window-buffer |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3060 (gdb-get-buffer-create 'gdb-inferior-io))) |
54538 | 3061 (other-window 1) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3062 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
54538 | 3063 (split-window-horizontally) |
3064 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3065 (gdb-set-window-buffer (gdb-breakpoints-buffer-name)) |
54538 | 3066 (other-window 1)) |
3067 | |
3068 (defun gdb-restore-windows () | |
3069 "Restore the basic arrangement of windows used by gdba. | |
3070 This arrangement depends on the value of `gdb-many-windows'." | |
3071 (interactive) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3072 (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
|
3073 (delete-other-windows) |
54538 | 3074 (if gdb-many-windows |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3075 (gdb-setup-windows) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3076 (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
|
3077 (split-window) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3078 (other-window 1) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3079 (switch-to-buffer |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3080 (if gud-last-last-frame |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3081 (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
|
3082 (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
|
3083 (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
|
3084 (other-window 1)))) |
54538 | 3085 |
3086 (defun gdb-reset () | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
3087 "Exit a debugging session cleanly. |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
3088 Kills the gdb buffers, and resets variables and the source buffers." |
54538 | 3089 (dolist (buffer (buffer-list)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3090 (unless (eq buffer gud-comint-buffer) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3091 (with-current-buffer buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3092 (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
|
3093 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3094 (kill-buffer nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3095 (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
|
3096 (setq gud-minor-mode nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3097 (kill-local-variable 'tool-bar-map) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3098 (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
|
3099 (setq gdb-overlay-arrow-position nil) |
54538 | 3100 (setq overlay-arrow-variable-list |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3101 (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
|
3102 (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
|
3103 (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
|
3104 (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
|
3105 (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
|
3106 (if (boundp 'speedbar-frame) (speedbar-timer-fn)) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3107 (setq gud-running nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3108 (setq gdb-active-process nil) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
3109 (setq gdb-var-list nil) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3110 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) |
54538 | 3111 |
3112 (defun gdb-source-info () | |
3113 "Find the source file where the program starts and displays it with related | |
3114 buffers." | |
3115 (goto-char (point-min)) | |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3116 (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
|
3117 (looking-at "\\S-+")) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3118 (setq gdb-main-file (match-string 0))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3119 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3120 (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
|
3121 (setq gdb-macro-info t)) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3122 (if gdb-many-windows |
54538 | 3123 (gdb-setup-windows) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3124 (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
|
3125 (if gdb-show-main |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3126 (let ((pop-up-windows t)) |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
3127 (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
|
3128 (setq gdb-ready t)) |
54538 | 3129 |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3130 (defun gdb-get-location (bptno line flag) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3131 "Find the directory containing the relevant source file. |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3132 Put in buffer and place breakpoint icon." |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3133 (goto-char (point-min)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3134 (catch 'file-not-found |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3135 (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
|
3136 (when (looking-at "\\S-+") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3137 (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
|
3138 (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
|
3139 (gdb-resync) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3140 (unless (assoc bptno gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3141 (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
|
3142 (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
|
3143 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
|
3144 (throw 'file-not-found nil)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3145 (with-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3146 (find-file-noselect (match-string 0)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3147 (save-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3148 (set (make-local-variable 'gud-minor-mode) 'gdba) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3149 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3150 ;; 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
|
3151 (save-excursion |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3152 (goto-line (string-to-number line)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3153 (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
|
3154 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3155 (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
|
3156 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3157 (defun gdb-find-file-hook () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3158 "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
|
3159 of the current session." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3160 (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
|
3161 ;; 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
|
3162 gud-comint-buffer |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3163 (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
|
3164 '(gdba gdbmi))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3165 ;;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
|
3166 (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
|
3167 (file-name-nondirectory buffer-file-name) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3168 buffer-file-name) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
3169 gdb-source-file-list) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3170 (with-current-buffer (find-buffer-visiting buffer-file-name) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3171 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3172 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3173 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map))))) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3174 |
54538 | 3175 ;;from put-image |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3176 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) |
54538 | 3177 "Put string PUTSTRING in front of POS in the current buffer. |
3178 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
|
3179 `before-string' string that has a `display' property whose value is |
54538 | 3180 PUTSTRING." |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3181 (let ((string (make-string 1 ?x)) |
54538 | 3182 (buffer (current-buffer))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3183 (setq putstring (copy-sequence putstring)) |
54538 | 3184 (let ((overlay (make-overlay pos pos buffer)) |
3185 (prop (or dprop | |
3186 (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
|
3187 (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
|
3188 (if sprops |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3189 (add-text-properties 0 1 sprops string)) |
54538 | 3190 (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
|
3191 (overlay-put overlay 'before-string string)))) |
54538 | 3192 |
3193 ;;from remove-images | |
3194 (defun gdb-remove-strings (start end &optional buffer) | |
3195 "Remove strings between START and END in BUFFER. | |
3196 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. | |
3197 BUFFER nil or omitted means use the current buffer." | |
3198 (unless buffer | |
3199 (setq buffer (current-buffer))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3200 (dolist (overlay (overlays-in start end)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
3201 (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
|
3202 (delete-overlay overlay)))) |
54538 | 3203 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3204 (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
|
3205 (if (string-match "[0-9+]+\\." bptno) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3206 (setq enabled gdb-parent-bptno-enabled)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
3207 (let ((start (- (line-beginning-position) 1)) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
3208 (end (+ (line-end-position) 1)) |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3209 (putstring (if enabled "B" "b")) |
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3210 (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
|
3211 (add-text-properties |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3212 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
|
3213 putstring) |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3214 (if enabled |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3215 (add-text-properties |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3216 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
|
3217 (add-text-properties |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3218 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) |
54538 | 3219 (gdb-remove-breakpoint-icons start end) |
3220 (if (display-images-p) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3221 (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
|
3222 (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
|
3223 gdb-buffer-fringe-width) 8) |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3224 (gdb-put-string |
54538 | 3225 nil (1+ start) |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
3226 `(left-fringe breakpoint |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3227 ,(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
|
3228 'breakpoint-enabled |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3229 'breakpoint-disabled)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3230 'gdb-bptno bptno |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3231 'gdb-enabled enabled) |
54538 | 3232 (when (< left-margin-width 2) |
3233 (save-current-buffer | |
3234 (setq left-margin-width 2) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3235 (if source-window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
3236 (set-window-margins |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3237 source-window |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
3238 left-margin-width right-margin-width)))) |
54538 | 3239 (put-image |
3240 (if enabled | |
3241 (or breakpoint-enabled-icon | |
3242 (setq breakpoint-enabled-icon | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3243 (find-image `((:type xpm :data |
54538 | 3244 ,breakpoint-xpm-data |
3245 :ascent 100 :pointer hand) | |
3246 (:type pbm :data | |
3247 ,breakpoint-enabled-pbm-data | |
3248 :ascent 100 :pointer hand))))) | |
3249 (or breakpoint-disabled-icon | |
3250 (setq breakpoint-disabled-icon | |
3251 (find-image `((:type xpm :data | |
3252 ,breakpoint-xpm-data | |
3253 :conversion disabled | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3254 :ascent 100 :pointer hand) |
54538 | 3255 (:type pbm :data |
3256 ,breakpoint-disabled-pbm-data | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3257 :ascent 100 :pointer hand)))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3258 (+ start 1) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3259 putstring |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3260 'left-margin)) |
54538 | 3261 (when (< left-margin-width 2) |
3262 (save-current-buffer | |
3263 (setq left-margin-width 2) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3264 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3265 (if window |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3266 (set-window-margins |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3267 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
|
3268 (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
|
3269 (propertize putstring |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
3270 '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
|
3271 (1+ start))))) |
54538 | 3272 |
3273 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin) | |
3274 (gdb-remove-strings start end) | |
3275 (if (display-images-p) | |
3276 (remove-images start end)) | |
3277 (when remove-margin | |
3278 (setq left-margin-width 0) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3279 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3280 (if window |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3281 (set-window-margins |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3282 window left-margin-width right-margin-width))))) |
54538 | 3283 |
3284 | |
3285 ;; | |
3286 ;; Assembler buffer. | |
3287 ;; | |
3288 (gdb-set-buffer-rules 'gdb-assembler-buffer | |
3289 'gdb-assembler-buffer-name | |
3290 'gdb-assembler-mode) | |
3291 | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3292 ;; 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
|
3293 ;; 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
|
3294 (defun gdb-assembler-handler () |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3295 (setq gdb-pending-triggers |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3296 (delq 'gdb-invalidate-assembler |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3297 gdb-pending-triggers)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3298 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3299 (and buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3300 (with-current-buffer buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3301 (let* ((window (get-buffer-window buf 0)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3302 (p (window-point window)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3303 (buffer-read-only nil)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3304 (erase-buffer) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3305 (insert-buffer-substring (gdb-get-buffer-create |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3306 'gdb-partial-output-buffer)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3307 (set-window-point window p))))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3308 ;; put customisation here |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3309 (gdb-assembler-custom)) |
54538 | 3310 |
3311 (defun gdb-assembler-custom () | |
3312 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) | |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3313 (pos 1) (address) (flag) (bptno)) |
54538 | 3314 (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
|
3315 (save-excursion |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3316 (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
|
3317 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3318 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3319 (if (and gdb-pc-address |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3320 (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
|
3321 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3322 (setq pos (point)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3323 (beginning-of-line) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3324 (setq fringe-indicator-alist |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3325 (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
|
3326 nil |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3327 '((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
|
3328 (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
|
3329 (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
|
3330 (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
|
3331 ;; 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
|
3332 (gdb-remove-breakpoint-icons (point-min) (point-max)))) |
54538 | 3333 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
3334 (goto-char (point-min)) | |
3335 (while (< (point) (- (point-max) 1)) | |
3336 (forward-line 1) | |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3337 (when (looking-at |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3338 "\\([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
|
3339 (setq bptno (match-string 1)) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3340 (setq flag (char-after (match-beginning 2))) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3341 (setq address (match-string 3)) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3342 (with-current-buffer buffer |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3343 (save-excursion |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3344 (goto-char (point-min)) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3345 (if (search-forward address nil t) |
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3346 (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
|
3347 (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
|
3348 (with-current-buffer buffer |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
3349 (set-window-point (get-buffer-window buffer 0) pos))))) |
54538 | 3350 |
3351 (defvar gdb-assembler-mode-map | |
3352 (let ((map (make-sparse-keymap))) | |
3353 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3354 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3355 map)) |
54538 | 3356 |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3357 (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
|
3358 '(;; <__function.name+n> |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3359 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3360 (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
|
3361 ;; 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
|
3362 ("^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
|
3363 (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
|
3364 ;; %register(at least i386) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3365 ("%\\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
|
3366 ("^\\(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
|
3367 (1 font-lock-comment-face) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3368 (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
|
3369 ("^\\(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
|
3370 "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
|
3371 |
54538 | 3372 (defun gdb-assembler-mode () |
3373 "Major mode for viewing code assembler. | |
3374 | |
3375 \\{gdb-assembler-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3376 (kill-all-local-variables) |
54538 | 3377 (setq major-mode 'gdb-assembler-mode) |
62716 | 3378 (setq mode-name (concat "Machine:" gdb-selected-frame)) |
54538 | 3379 (setq gdb-overlay-arrow-position nil) |
3380 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position) | |
3381 (setq fringes-outside-margins t) | |
3382 (setq buffer-read-only t) | |
3383 (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
|
3384 (gdb-invalidate-assembler) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3385 (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
|
3386 '(gdb-assembler-font-lock-keywords)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3387 (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
|
3388 'gdb-invalidate-assembler) |
54538 | 3389 |
3390 (defun gdb-assembler-buffer-name () | |
3391 (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
|
3392 (concat "*disassembly of " (gdb-get-target-string) "*"))) |
54538 | 3393 |
3394 (defun gdb-display-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3395 "Display disassembly view." |
54538 | 3396 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3397 (setq gdb-previous-frame nil) |
54538 | 3398 (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
|
3399 (gdb-get-buffer-create 'gdb-assembler-buffer) t)) |
54538 | 3400 |
3401 (defun gdb-frame-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3402 "Display disassembly view in a new frame." |
54538 | 3403 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3404 (setq gdb-previous-frame nil) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
3405 (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
|
3406 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3407 (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer)))) |
54538 | 3408 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3409 ;; modified because if gdb-pc-address has changed value a new command |
54538 | 3410 ;; must be enqueued to update the buffer with the new output |
3411 (defun gdb-invalidate-assembler (&optional ignored) | |
3412 (if (gdb-get-buffer 'gdb-assembler-buffer) | |
3413 (progn | |
62716 | 3414 (unless (and gdb-selected-frame |
3415 (string-equal gdb-selected-frame gdb-previous-frame)) | |
54538 | 3416 (if (or (not (member 'gdb-invalidate-assembler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3417 gdb-pending-triggers)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3418 (not (string-equal gdb-pc-address |
62716 | 3419 gdb-previous-frame-address))) |
54538 | 3420 (progn |
62716 | 3421 ;; take previous disassemble command, if any, off the queue |
54538 | 3422 (with-current-buffer gud-comint-buffer |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3423 (let ((queue gdb-input-queue)) |
54538 | 3424 (dolist (item queue) |
3425 (if (equal (cdr item) '(gdb-assembler-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3426 (setq gdb-input-queue |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3427 (delete item gdb-input-queue)))))) |
54538 | 3428 (gdb-enqueue-input |
62716 | 3429 (list |
3430 (concat gdb-server-prefix "disassemble " | |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3431 (if (member gdb-pc-address '(nil "main")) nil "0x") |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3432 gdb-pc-address "\n") |
54538 | 3433 'gdb-assembler-handler)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3434 (push 'gdb-invalidate-assembler gdb-pending-triggers) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3435 (setq gdb-previous-frame-address gdb-pc-address) |
62716 | 3436 (setq gdb-previous-frame gdb-selected-frame))))))) |
54538 | 3437 |
62716 | 3438 (defun gdb-get-selected-frame () |
3439 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers)) | |
54538 | 3440 (progn |
3441 (gdb-enqueue-input | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3442 (list (concat gdb-server-prefix "info frame\n") 'gdb-frame-handler)) |
62716 | 3443 (push 'gdb-get-selected-frame |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3444 gdb-pending-triggers)))) |
54538 | 3445 |
3446 (defun gdb-frame-handler () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3447 (setq gdb-pending-triggers |
62716 | 3448 (delq 'gdb-get-selected-frame gdb-pending-triggers)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3449 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3450 (when (re-search-forward |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3451 "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
|
3452 (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
|
3453 (setq gdb-frame-address (match-string 2))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3454 (goto-char (point-min)) |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
3455 (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(.*?\\)\ |
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
3456 \\(?: (\\(\\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
|
3457 nil t) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3458 (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
|
3459 (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
|
3460 (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
|
3461 (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
|
3462 (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
|
3463 (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
|
3464 (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
|
3465 (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
|
3466 (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
|
3467 (let ((buffer (marker-buffer gud-overlay-arrow-position)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3468 (position (marker-position gud-overlay-arrow-position))) |
70372
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3469 (when (and buffer |
79812
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
3470 (string-equal (file-name-nondirectory |
52bc3192a217
(gdb-dequeue-input): Make doubly sure
Nick Roberts <nickrob@snap.net.nz>
parents:
79754
diff
changeset
|
3471 (buffer-file-name buffer)) |
70372
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3472 (file-name-nondirectory (match-string 3)))) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3473 (with-current-buffer buffer |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3474 (setq fringe-indicator-alist |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3475 (if (string-equal gdb-frame-number "0") |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3476 nil |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3477 '((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
|
3478 (set-marker gud-overlay-arrow-position position)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3479 (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
|
3480 (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
|
3481 (setq gdb-current-language (match-string 1))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3482 (gdb-invalidate-assembler)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3483 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3484 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3485 ;; Code specific to GDB 6.4 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3486 (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
|
3487 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3488 (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
|
3489 "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
|
3490 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
|
3491 is set in them." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3492 (goto-char (point-min)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3493 (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
|
3494 (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
|
3495 (dolist (buffer (buffer-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3496 (with-current-buffer buffer |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3497 (when (member buffer-file-name gdb-source-file-list) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3498 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3499 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3500 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3501 (when gud-tooltip-mode |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3502 (make-local-variable 'gdb-define-alist) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3503 (gdb-create-define-alist) |
71277
99ed754e8f50
(gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
71113
diff
changeset
|
3504 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
3505 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
3506 (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
|
3507 |
79384
7420ede9df33
(gdb-parent-bptno-enabled): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
79261
diff
changeset
|
3508 ; 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
|
3509 (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
|
3510 (gdb-enqueue-input |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3511 (list |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3512 (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
|
3513 (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
|
3514 varnum "\\\"\"\n") |
6a820000a687
(gdb-var-list-children-1): Put varnum in
Nick Roberts <nickrob@snap.net.nz>
parents:
79724
diff
changeset
|
3515 (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
|
3516 `(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
|
3517 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3518 (defconst gdb-var-list-children-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3519 "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3520 numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\ |
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3521 \\(}\\|,.*?\\(type=\"\\(.+?\\)\"\\)?.*?}\\)") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3522 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3523 (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
|
3524 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3525 (let ((var-list nil)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3526 (catch 'child-already-watched |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3527 (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
|
3528 (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
|
3529 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3530 (push var var-list) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3531 (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
|
3532 (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
|
3533 (match-string 2) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3534 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3535 (match-string 7) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3536 (read (match-string 4)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3537 nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3538 (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
|
3539 (throw 'child-already-watched nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3540 (push varchild var-list)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3541 (push var var-list))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3542 (setq gdb-var-list (nreverse var-list)))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3543 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3544 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3545 ; 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
|
3546 (defun gdb-var-update-1 () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3547 (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
|
3548 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3549 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3550 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3551 (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
|
3552 "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
|
3553 "-var-update --all-values *\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3554 'gdb-var-update-handler-1)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3555 (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
|
3556 |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
3557 (defconst gdb-var-update-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3558 "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3559 in_scope=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3560 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3561 (defun gdb-var-update-handler-1 () |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3562 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3563 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3564 (goto-char (point-min)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3565 (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
|
3566 (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
|
3567 (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
|
3568 (when var |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3569 (let ((match (match-string 3))) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3570 (cond ((string-equal match "false") |
79261
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3571 (if gdb-delete-out-of-scope |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3572 (gdb-var-delete-1 varnum) |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3573 (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
|
3574 ((string-equal match "true") |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3575 (setcar (nthcdr 5 var) 'changed) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3576 (setcar (nthcdr 4 var) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3577 (read (match-string 2)))) |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
3578 ((string-equal match "invalid") |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
3579 (gdb-var-delete-1 varnum))))))) |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3580 (setq gdb-pending-triggers |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3581 (delq 'gdb-var-update gdb-pending-triggers)) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3582 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3583 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3584 ;; Registers buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3585 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3586 (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
|
3587 'gdb-registers-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3588 'gdb-registers-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3589 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3590 (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
|
3591 (gdb-get-buffer 'gdb-registers-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3592 (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
|
3593 "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
|
3594 "-data-list-register-values x\n") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3595 gdb-data-list-register-values-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3596 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3597 (defconst gdb-data-list-register-values-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3598 "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3599 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3600 (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
|
3601 (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
|
3602 gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3603 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3604 (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
|
3605 (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
|
3606 (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
|
3607 (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
|
3608 (erase-buffer) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3609 (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
|
3610 (insert err) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3611 (goto-char (point-min))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3612 (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
|
3613 (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
|
3614 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3615 (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
|
3616 (setq register (pop register-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3617 (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
|
3618 (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
|
3619 (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
|
3620 'face 'font-lock-warning-face |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3621 register-string)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3622 (setq register-values |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3623 (concat register-values register-string))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3624 (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
|
3625 (with-current-buffer buf |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3626 (let* ((window (get-buffer-window buf 0)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3627 (start (window-start window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3628 (p (window-point window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3629 (buffer-read-only nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3630 (erase-buffer) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3631 (insert register-values) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3632 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3633 (set-window-point window p)))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3634 (gdb-data-list-register-values-custom)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3635 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3636 (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
|
3637 (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
|
3638 (save-excursion |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3639 (let ((buffer-read-only nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3640 start end) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3641 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3642 (while (< (point) (point-max)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3643 (setq start (line-beginning-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3644 (setq end (line-end-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3645 (when (looking-at "^[^\t]+") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3646 (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
|
3647 (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
|
3648 '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
|
3649 (add-text-properties start end |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3650 '(help-echo "mouse-2: edit value" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3651 mouse-face highlight)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3652 (forward-line 1)))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3653 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3654 ;; 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
|
3655 (defun gdb-get-changed-registers () |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3656 (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
|
3657 (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
|
3658 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3659 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3660 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3661 (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
|
3662 "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
|
3663 "-data-list-changed-registers\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3664 'gdb-get-changed-registers-handler)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3665 (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
|
3666 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3667 (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
|
3668 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3669 (defun gdb-get-changed-registers-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3670 (setq gdb-pending-triggers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3671 (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
|
3672 (setq gdb-changed-registers nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3673 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3674 (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
|
3675 (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
|
3676 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3677 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3678 ;; Locals buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3679 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3680 ;; 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
|
3681 (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
|
3682 'gdb-locals-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3683 'gdb-locals-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3684 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3685 (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
|
3686 (gdb-get-buffer 'gdb-locals-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3687 (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
|
3688 "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
|
3689 "-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
|
3690 gdb-stack-list-locals-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3691 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3692 (defconst gdb-stack-list-locals-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3693 "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3694 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3695 (defvar gdb-locals-watch-map-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3696 (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
|
3697 (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
|
3698 (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
|
3699 (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
|
3700 map) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
3701 "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
|
3702 |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3703 (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
|
3704 (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
|
3705 (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
|
3706 (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
|
3707 (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
|
3708 map) |
80214
062c5adc0b00
(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program,
Juanma Barranquero <lekktu@gmail.com>
parents:
80167
diff
changeset
|
3709 "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
|
3710 |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3711 (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
|
3712 "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
|
3713 (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
|
3714 (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
|
3715 (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
|
3716 (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
|
3717 (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
|
3718 (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
|
3719 (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
|
3720 (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
|
3721 '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
|
3722 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3723 ;; 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
|
3724 ;; 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
|
3725 (defun gdb-stack-list-locals-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3726 (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
|
3727 gdb-pending-triggers)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3728 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3729 (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
|
3730 (let ((err (match-string 1))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3731 (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
|
3732 (let ((buffer-read-only nil)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3733 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3734 (insert err) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3735 (goto-char (point-min))))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3736 (let (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3737 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3738 (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
|
3739 (let ((local (list (match-string 1) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3740 (match-string 2) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3741 nil))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3742 (if (looking-at ",value=\\(\".*\"\\).*?}") |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3743 (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
|
3744 (push local locals-list))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3745 (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
|
3746 (and buf (with-current-buffer buf |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3747 (let* ((window (get-buffer-window buf 0)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3748 (start (window-start window)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3749 (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
|
3750 (buffer-read-only nil) (name) (value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3751 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3752 (dolist (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3753 (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
|
3754 (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
|
3755 (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
|
3756 (string-match "^\\0x" value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3757 (add-text-properties 0 (length name) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3758 `(mouse-face highlight |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3759 help-echo "mouse-2: create watch expression" |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3760 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
|
3761 name) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3762 (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
|
3763 `(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
|
3764 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
|
3765 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
|
3766 value)) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3767 (insert |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3768 (concat name "\t" (nth 1 local) |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
3769 "\t" value "\n"))) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3770 (set-window-start window start) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3771 (set-window-point window p)))))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3772 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3773 (defun gdb-get-register-names () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3774 "Create a list of register names." |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3775 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3776 (setq gdb-register-names nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3777 (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
|
3778 (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
|
3779 |
54538 | 3780 (provide 'gdb-ui) |
3781 | |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3782 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
54538 | 3783 ;;; gdb-ui.el ends here |