Mercurial > emacs
annotate lisp/progmodes/gdb-ui.el @ 74895:b136953eeaa4
(BROKEN_DATAGRAM_SOCKETS): Define it.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 25 Dec 2006 13:30:18 +0000 |
parents | 3cedab34a4b6 |
children | 83f9cf569b3f |
rev | line source |
---|---|
54538 | 1 ;;; gdb-ui.el --- User Interface for running GDB |
2 | |
54993
08b0ee9a9b35
(gdb-frame-parameters): New constant.
Nick Roberts <nickrob@snap.net.nz>
parents:
54962
diff
changeset
|
3 ;; Author: Nick Roberts <nickrob@gnu.org> |
54538 | 4 ;; Maintainer: FSF |
5 ;; Keywords: unix, tools | |
6 | |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
7 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 |
68773
dc49655f57ae
Update copyright for 2006.
Nick Roberts <nickrob@snap.net.nz>
parents:
68664
diff
changeset
|
8 ;; Free Software Foundation, Inc. |
54538 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
54538 | 26 |
27 ;;; Commentary: | |
28 | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
29 ;; This mode acts as a graphical user interface to GDB. You can interact with |
54538 | 30 ;; GDB through the GUD buffer in the usual way, but there are also further |
31 ;; buffers which control the execution and describe the state of your program. | |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
32 ;; It separates the input/output of your program from that of GDB, if |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
33 ;; required, and watches expressions in the speedbar. It also uses features of |
56258
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
34 ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar |
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
35 ;; (see the GDB Graphical Interface section in the Emacs info manual). |
54538 | 36 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
37 ;; By default, M-x gdb will start the debugger. However, if you have customised |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
38 ;; gud-gdb-command-name, then start it with M-x gdba. |
54538 | 39 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
40 ;; This file has evolved from gdba.el that was included with GDB 5.0 and |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
41 ;; written by Tom Lord and Jim Kingdon. It uses GDB's annotation interface. |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
42 ;; You don't need to know about annotations to use this mode as a debugger, |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
43 ;; 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
|
44 ;; section in the GDB info manual. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
45 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
46 ;; GDB developers plan to make the annotation interface obsolete. A new |
55850
63ca25eb73a1
(gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents:
55764
diff
changeset
|
47 ;; interface called GDB/MI (machine interface) has been designed to replace |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
48 ;; it. Some GDB/MI commands are used in this file through the CLI command |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
49 ;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included with |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
50 ;; GDB (6.2 onwards) that uses GDB/MI as the primary interface to GDB. It is |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
51 ;; still under development and is part of a process to migrate Emacs from |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
52 ;; annotations to GDB/MI. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
53 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
54 ;; 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
|
55 ;; 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
|
56 ;; 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
|
57 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
58 ;;; Windows Platforms: |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
59 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
60 ;; If you are using Emacs and GDB on Windows you will need to flush the buffer |
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
61 ;; explicitly in your program if you want timely display of I/O in Emacs. |
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
62 ;; Alternatively you can make the output stream unbuffered, for example, by |
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
63 ;; using a macro: |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
64 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
65 ;; #ifdef UNBUFFERED |
64999
e1cdc6178b3e
(toggle-gdb-use-inferior-io-buffer):
Nick Roberts <nickrob@snap.net.nz>
parents:
64993
diff
changeset
|
66 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0); |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
67 ;; #endif |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
68 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
69 ;; and compiling with -DUNBUFFERED while debugging. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
70 |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
71 ;;; Known Bugs: |
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
72 |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
73 ;; 1) Strings that are watched don't update in the speedbar when their |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
74 ;; contents change unless the first character changes. |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
75 ;; 2) Cannot handle multiple debug sessions. |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
76 ;; 3) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead. |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
77 ;; 4) M-x gdb doesn't work if the corefile is specified in the command in the |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
78 ;; minibuffer, use M-x gdba instead (or specify the core in the GUD buffer). |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
79 ;; 5) If you wish to call procedures from your program in GDB |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
80 ;; 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
|
81 ;; "gdb --annotate=2 myprog" to keep source buffer/selected frame fixed. |
74765
3cedab34a4b6
(gdb-stopped): After attaching to a process
Nick Roberts <nickrob@snap.net.nz>
parents:
74390
diff
changeset
|
82 ;; 6) After detaching from a process, clicking on the "GO" icon on toolbar |
3cedab34a4b6
(gdb-stopped): After attaching to a process
Nick Roberts <nickrob@snap.net.nz>
parents:
74390
diff
changeset
|
83 ;; (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
|
84 |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
85 ;;; Problems with watch expressions, GDB/MI: |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
86 |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
87 ;; 1) They go out of scope when the inferior is re-run. |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
88 ;; 2) -stack-list-locals has a type field but also prints type in values field. |
69666
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
89 ;; 3) VARNUM increments even when variable object is not created |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
90 ;; (maybe trivial). |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
91 |
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
|
92 ;;; TODO: |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
93 |
59808 | 94 ;; 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
|
95 ;; 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
|
96 ;; 3) Mark breakpoint locations on scroll-bar of source buffer? |
54538 | 97 |
98 ;;; Code: | |
99 | |
100 (require 'gud) | |
101 | |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
102 (defvar tool-bar-map) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
103 (defvar speedbar-initial-expansion-list-name) |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
104 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
105 (defvar gdb-pc-address nil "Initialization for Assembler buffer. |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
106 Set to \"main\" at start if gdb-show-main is t.") |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
107 (defvar gdb-frame-address nil "Identity of frame for watch expression.") |
62716 | 108 (defvar gdb-previous-frame-address nil) |
59808 | 109 (defvar gdb-memory-address "main") |
54538 | 110 (defvar gdb-previous-frame nil) |
62716 | 111 (defvar gdb-selected-frame nil) |
112 (defvar gdb-frame-number nil) | |
54538 | 113 (defvar gdb-current-language nil) |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
114 (defvar gdb-var-list nil |
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
115 "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
|
116 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP) |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
117 where STATUS is nil (unchanged), `changed' or `out-of-scope', FP the frame |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
118 address for root variables.") |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
119 (defvar gdb-main-file nil "Source file from which program execution begins.") |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
120 (defvar gud-old-arrow nil) |
54538 | 121 (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
|
122 (defvar gdb-stack-position nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
123 (defvar gdb-server-prefix nil) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
124 (defvar gdb-flush-pending-output nil) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
125 (defvar gdb-location-alist nil |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
126 "Alist of breakpoint numbers and full filenames.") |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
127 (defvar gdb-active-process nil "GUD tooltips display variable values when t, \ |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
128 and #define directives otherwise.") |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
129 (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
|
130 (defvar gdb-macro-info nil |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
131 "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
|
132 (defvar gdb-buffer-fringe-width nil) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
133 (defvar gdb-signalled nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
134 (defvar gdb-source-window nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
135 (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
|
136 (defvar gdb-continuation nil) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
137 (defvar gdb-look-up-stack nil) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
138 (defvar gdb-frame-begin nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
139 "Non-nil when GDB generates frame-begin annotation.") |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
140 (defvar gdb-printing t) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
141 |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
142 (defvar gdb-buffer-type nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
143 "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
|
144 (make-variable-buffer-local 'gdb-buffer-type) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
145 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
146 (defvar gdb-input-queue () |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
147 "A list of gdb command objects.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
148 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
149 (defvar gdb-prompting nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
150 "True when gdb is idle with no pending input.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
151 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
152 (defvar gdb-output-sink 'user |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
153 "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
|
154 Possible values are these symbols: |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
155 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
156 `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
|
157 for the user to see. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
158 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
159 `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
|
160 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
161 `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
|
162 annotation is received. Then the output-sink |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
163 becomes:... |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
164 `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
|
165 for subsequent processing by a command. This is the |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
166 disposition of output generated by commands that |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
167 gdb mode sends to gdb on its own behalf. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
168 `post-emacs' -- ignore output until the prompt annotation is |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
169 received, then go to USER disposition. |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
170 |
64702
56f44995f925
(gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents:
64697
diff
changeset
|
171 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
|
172 \(`user' and `emacs').") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
173 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
174 (defvar gdb-current-item nil |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
175 "The most recent command item sent to gdb.") |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
176 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
177 (defvar gdb-pending-triggers '() |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
178 "A list of trigger functions that have run later than their output |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
179 handlers.") |
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 |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
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 |
220 (defun gdba (command-line) | |
221 "Run gdb on program FILE in buffer *gud-FILE*. | |
222 The directory containing FILE becomes the initial working directory | |
223 and source-file directory for your debugger. | |
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 | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
268 +-----------------------------------+----------------------------------+" |
54538 | 269 ;; |
270 (interactive (list (gud-query-cmdline 'gdba))) | |
271 ;; | |
272 ;; Let's start with a basic gud-gdb buffer and then modify it a bit. | |
69666
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
273 (gdb command-line) |
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
274 (gdb-init-1)) |
54538 | 275 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
276 (defcustom gdb-debug-ring-max 128 |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
277 "Maximum size of `gdb-debug-ring'." |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
278 :group 'gud |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
279 :type 'integer |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
280 :version "22.1") |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
281 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
282 (defvar gdb-debug-ring nil |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
283 "List of commands, most recent first, sent to and replies received from GDB. |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
284 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
|
285 |
64697
7767f4fb012a
* progmodes/gdb-ui.el (gdb-enable-debug-log): Add autoload cookie.
Nick Roberts <nickrob@snap.net.nz>
parents:
64654
diff
changeset
|
286 ;;;###autoload |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
287 (defcustom gdb-enable-debug nil |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
288 "Non-nil means record the process input and output in `gdb-debug-ring'." |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
289 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
290 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
291 :version "22.1") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
292 |
62115
515e18600ed2
(gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
62065
diff
changeset
|
293 (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
|
294 "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
|
295 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
|
296 with an identifier as a tooltip. It works in a debug session with |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
297 GDB, when gud-tooltip-mode is t. |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
298 |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
299 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
|
300 predefined macros." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
301 :type 'string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
302 :group 'gud |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
303 :version "22.1") |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
304 |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
305 (defcustom gdb-cpp-define-alist-flags "" |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
306 "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
|
307 :type 'string |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
308 :group 'gud |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
309 :version "22.1") |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
310 |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
311 (defcustom gdb-show-main nil |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
312 "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
|
313 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
|
314 :type 'boolean |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
315 :group 'gud |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
316 :version "22.1") |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
317 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
318 (defcustom gdb-many-windows nil |
73890
2896142f6964
(gdb-many-windows): Start doc string
Nick Roberts <nickrob@snap.net.nz>
parents:
73883
diff
changeset
|
319 "If nil just pop up the GUD buffer unless `gdb-show-main' is t. |
2896142f6964
(gdb-many-windows): Start doc string
Nick Roberts <nickrob@snap.net.nz>
parents:
73883
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 for `gdba'." |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
324 :type 'boolean |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
325 :group 'gud |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
326 :version "22.1") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
327 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
328 (defcustom gdb-use-separate-io-buffer nil |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
329 "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
|
330 :type 'boolean |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
331 :group 'gud |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
332 :version "22.1") |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
333 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
334 (defun gdb-force-mode-line-update (status) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
335 (let ((buffer gud-comint-buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
336 (if (and buffer (buffer-name buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
337 (with-current-buffer buffer |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
338 (setq mode-line-process |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
339 (format ":%s [%s]" |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
340 (process-status (get-buffer-process buffer)) status)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
341 ;; Force mode line redisplay soon. |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
342 (force-mode-line-update))))) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
343 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
344 (defun gdb-many-windows (arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
345 "Toggle the number of windows in the basic arrangement. |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
346 With arg, display additional buffers iff arg is positive." |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
347 (interactive "P") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
348 (setq gdb-many-windows |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
349 (if (null arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
350 (not gdb-many-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
351 (> (prefix-numeric-value arg) 0))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
352 (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
|
353 (if gdb-many-windows "en" "dis"))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
354 (if (and gud-comint-buffer |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
355 (buffer-name gud-comint-buffer)) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
356 (condition-case nil |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
357 (gdb-restore-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
358 (error nil)))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
359 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
360 (defun gdb-use-separate-io-buffer (arg) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
361 "Toggle separate IO for debugged program. |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
362 With arg, use separate IO iff arg is positive." |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
363 (interactive "P") |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
364 (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
|
365 (if (null arg) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
366 (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
|
367 (> (prefix-numeric-value arg) 0))) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
368 (message (format "Separate IO %sabled" |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
369 (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
|
370 (if (and gud-comint-buffer |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
371 (buffer-name gud-comint-buffer)) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
372 (condition-case nil |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
373 (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
|
374 (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
|
375 (kill-buffer (gdb-inferior-io-name))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
376 (error nil)))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
377 |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
378 (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
|
379 |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
380 (defun gdb-create-define-alist () |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
381 "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
|
382 (let* ((file (buffer-file-name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
383 (output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
384 (with-output-to-string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
385 (with-current-buffer standard-output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
386 (call-process shell-file-name |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
387 (if (file-exists-p file) file nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
388 (list t nil) nil "-c" |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
389 (concat gdb-cpp-define-alist-program " " |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
390 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
|
391 (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
|
392 (setq gdb-define-alist nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
393 (dolist (define define-list) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
394 (setq name (nth 1 (split-string define "[( ]"))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
395 (push (cons name define) gdb-define-alist)))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
396 |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
397 (defun gdb-tooltip-print (expr) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
398 (tooltip-show |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
399 (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
|
400 (goto-char (point-min)) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
401 (let ((string |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
402 (if (search-forward "=" nil t) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
403 (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
|
404 (buffer-string)))) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
405 ;; 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
|
406 (substring string 0 (- (length string) 1)))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
407 (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
|
408 |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
409 ;; 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
|
410 ;; 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
|
411 ;; unexpected starting annotation (phase error). |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
412 (defun gdb-tooltip-print-1 (expr) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
413 (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
|
414 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
415 (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
|
416 (unless (looking-at "\\S-+.*(.*).*") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
417 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
418 (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
|
419 `(lambda () (gdb-tooltip-print ,expr)))))))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
420 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
421 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)") |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
422 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
423 (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
|
424 "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
|
425 (goto-char (point-min)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
426 (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
|
427 (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
|
428 (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
|
429 gdb-source-file-list)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
430 (dolist (buffer (buffer-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
431 (with-current-buffer buffer |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
432 (when (and buffer-file-name |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
433 (member (file-name-nondirectory buffer-file-name) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
434 gdb-source-file-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
435 (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
|
436 (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
|
437 (when gud-tooltip-mode |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
438 (make-local-variable 'gdb-define-alist) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
439 (gdb-create-define-alist) |
71277
99ed754e8f50
(gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
71113
diff
changeset
|
440 (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
|
441 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
442 (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
|
443 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
444 (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
|
445 (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
|
446 (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
|
447 (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
|
448 (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
|
449 (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
|
450 (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
|
451 (setq varnumlet (car var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
452 (dolist (component component-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
453 (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
|
454 (setq expr (concat expr |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
455 (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
|
456 (concat "[" component "]") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
457 (concat "." component)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
458 (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
|
459 expr))) |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
460 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
461 (defun gdb-init-1 () |
54538 | 462 (set (make-local-variable 'gud-minor-mode) 'gdba) |
463 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) | |
464 ;; | |
62716 | 465 (gud-def gud-break (if (not (string-match "Machine" mode-name)) |
54538 | 466 (gud-call "break %f:%l" arg) |
467 (save-excursion | |
468 (beginning-of-line) | |
469 (forward-char 2) | |
470 (gud-call "break *%a" arg))) | |
471 "\C-b" "Set breakpoint at current line or address.") | |
472 ;; | |
62716 | 473 (gud-def gud-remove (if (not (string-match "Machine" mode-name)) |
54538 | 474 (gud-call "clear %f:%l" arg) |
475 (save-excursion | |
476 (beginning-of-line) | |
477 (forward-char 2) | |
478 (gud-call "clear *%a" arg))) | |
479 "\C-d" "Remove breakpoint at current line or address.") | |
480 ;; | |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
481 (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
|
482 (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
|
483 (save-excursion |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
484 (beginning-of-line) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
485 (forward-char 2) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
486 (gud-call "until *%a" arg))) |
54538 | 487 "\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
|
488 ;; |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
489 (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
|
490 nil "Start or continue execution.") |
54538 | 491 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
492 ;; For debugging Emacs only. |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
493 (gud-def gud-pp |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
494 (gud-call |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
495 (concat |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
496 "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
|
497 '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
|
498 (gdb-find-watch-expression) "%e")) arg) |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
499 nil "Print the emacs s-expression.") |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
500 |
54538 | 501 (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
|
502 'gdb-mouse-set-clear-breakpoint) |
54538 | 503 (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
|
504 'gdb-mouse-set-clear-breakpoint) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
505 (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
|
506 'gdb-mouse-toggle-breakpoint-margin) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
507 (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
|
508 'gdb-mouse-toggle-breakpoint-fringe) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
509 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
510 (define-key gud-minor-mode-map [left-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
|
511 'gdb-mouse-until) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
512 (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
|
513 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
514 (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
|
515 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
516 (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
|
517 'gdb-mouse-until) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
518 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
519 (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
|
520 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
521 (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
|
522 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
523 (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
|
524 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
525 (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
|
526 'gdb-mouse-jump) |
54538 | 527 |
528 (setq comint-input-sender 'gdb-send) | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
529 |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
530 ;; (re-)initialize |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
531 (setq gdb-pc-address (if gdb-show-main "main" nil)) |
62716 | 532 (setq gdb-previous-frame-address nil |
533 gdb-memory-address "main" | |
534 gdb-previous-frame nil | |
535 gdb-selected-frame nil | |
536 gdb-current-language nil | |
537 gdb-frame-number nil | |
538 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
|
539 gdb-main-file nil |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
540 gdb-first-post-prompt t |
62716 | 541 gdb-prompting nil |
542 gdb-input-queue nil | |
543 gdb-current-item nil | |
544 gdb-pending-triggers nil | |
545 gdb-output-sink 'user | |
546 gdb-server-prefix "server " | |
547 gdb-flush-pending-output nil | |
548 gdb-location-alist nil | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
549 gdb-source-file-list nil |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
550 gdb-error nil |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
551 gdb-macro-info nil |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
552 gdb-buffer-fringe-width (car (window-fringes)) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
553 gdb-debug-ring nil |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
554 gdb-signalled nil |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
555 gdb-source-window nil |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
556 gdb-inferior-status nil |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
557 gdb-continuation nil |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
558 gdb-look-up-stack nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
559 gdb-frame-begin nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
560 gdb-printing t |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
561 gud-old-arrow nil) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
562 |
54538 | 563 (setq gdb-buffer-type 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
564 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
565 (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
|
566 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
567 ;; 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
|
568 (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
|
569 'gdb-get-version))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
570 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
571 (defun gdb-init-2 () |
54538 | 572 (if (eq window-system 'w32) |
573 (gdb-enqueue-input (list "set new-console off\n" 'ignore))) | |
574 (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
|
575 (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
|
576 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
577 (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
|
578 (progn |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
579 (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
|
580 '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
|
581 (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
|
582 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
583 (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
|
584 'gdb-get-register-names)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
585 ; Needs GDB 6.2 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
586 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
587 (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
|
588 '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
|
589 (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
|
590 |
69839
f91451ffdab7
(gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents:
69666
diff
changeset
|
591 ;; 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
|
592 ;; 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
|
593 (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
|
594 (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
|
595 |
54538 | 596 (run-hooks 'gdba-mode-hook)) |
597 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
598 (defun gdb-get-version () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
599 (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
|
600 (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
|
601 (setq gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
602 (setq gdb-version "6.4+")) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
603 (gdb-init-2)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
604 |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
605 (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
|
606 "Continue running until a source line past the current line. |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
607 The destination source line can be selected either by clicking with mouse-2 |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
608 on the fringe/margin or dragging the arrow with mouse-1 (default bindings)." |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
609 (interactive "e") |
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
610 (if gud-overlay-arrow-position |
66637
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
611 (let ((start (event-start event)) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
612 (end (event-end event)) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
613 (buffer (marker-buffer gud-overlay-arrow-position)) (line)) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
614 (if (not (string-match "Machine" mode-name)) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
615 (if (equal buffer (window-buffer (posn-window end))) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
616 (with-current-buffer buffer |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
617 (when (or (equal start end) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
618 (equal (posn-point start) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
619 (marker-position |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
620 gud-overlay-arrow-position))) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
621 (setq line (line-number-at-pos (posn-point end))) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
622 (gud-call (concat "until " (number-to-string line)))))) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
623 (if (equal (marker-buffer gdb-overlay-arrow-position) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
624 (window-buffer (posn-window end))) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
625 (when (or (equal start end) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
626 (equal (posn-point start) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
627 (marker-position |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
628 gdb-overlay-arrow-position))) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
629 (save-excursion |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
630 (goto-line (line-number-at-pos (posn-point end))) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
631 (forward-char 2) |
7567f8b4780e
(gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents:
66582
diff
changeset
|
632 (gud-call (concat "until *%a"))))))))) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
633 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
634 (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
|
635 "Set execution address/line. |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
636 The destination source line can be selected either by clicking with mouse-2 |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
637 on the fringe/margin or dragging the arrow with mouse-1 (default bindings). |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
638 Unlike gdb-mouse-until the destination address can be before the current |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
639 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
|
640 (interactive "e") |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
641 (if gud-overlay-arrow-position |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
642 (let ((start (event-start event)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
643 (end (event-end event)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
644 (buffer (marker-buffer gud-overlay-arrow-position)) (line)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
645 (if (not (string-match "Machine" mode-name)) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
646 (if (equal buffer (window-buffer (posn-window end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
647 (with-current-buffer buffer |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
648 (when (or (equal start end) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
649 (equal (posn-point start) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
650 (marker-position |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
651 gud-overlay-arrow-position))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
652 (setq line (line-number-at-pos (posn-point end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
653 (progn (gud-call (concat "tbreak " (number-to-string line))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
654 (gud-call (concat "jump " (number-to-string line))))))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
655 (if (equal (marker-buffer gdb-overlay-arrow-position) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
656 (window-buffer (posn-window end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
657 (when (or (equal start end) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
658 (equal (posn-point start) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
659 (marker-position |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
660 gdb-overlay-arrow-position))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
661 (save-excursion |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
662 (goto-line (line-number-at-pos (posn-point end))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
663 (forward-char 2) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
664 (progn |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
665 (gud-call (concat "tbreak *%a")) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
666 (gud-call (concat "jump *%a")))))))))) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
667 |
69042
01ec984a6ce6
(gdb-speedbar-auto-raise): Don't enable by default.
Nick Roberts <nickrob@snap.net.nz>
parents:
69023
diff
changeset
|
668 (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
|
669 "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
|
670 updated." |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
671 :type 'boolean |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
672 :group 'gud |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
673 :version "22.1") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
674 |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
675 (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
|
676 "Toggle automatic raising of the speedbar for watch expressions. |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
677 With arg, automatically raise speedbar iff arg is positive." |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
678 (interactive "P") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
679 (setq gdb-speedbar-auto-raise |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
680 (if (null arg) |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
681 (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
|
682 (> (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
|
683 (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
|
684 (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
|
685 |
54538 | 686 (defcustom gdb-use-colon-colon-notation nil |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
687 "If non-nil use FUN::VAR format to display variables in the speedbar." |
54538 | 688 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
689 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
690 :version "22.1") |
54538 | 691 |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
692 (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
|
693 (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
|
694 |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
695 (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
|
696 "Watch expression at point. |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
697 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
|
698 (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
|
699 (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
|
700 (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
|
701 (progn |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
702 (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
|
703 (require 'tooltip) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
704 (save-selected-window |
70351
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
705 (let ((expr |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
706 (if arg |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
707 (completing-read "Name of variable: " |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
708 'gud-gdb-complete-command) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
709 (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
|
710 (buffer-substring (region-beginning) (region-end)) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
711 (tooltip-identifier-from-point (point)))))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
712 (speedbar 1) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
713 (catch 'already-watched |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
714 (dolist (var gdb-var-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
715 (unless (string-match "\\." (car var)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
716 (if (string-equal expr (nth 1 var)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
717 (throw 'already-watched nil)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
718 (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
|
719 (gdb-enqueue-input |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
720 (list |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
721 (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
|
722 (concat |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
723 "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
|
724 (concat"-var-create - * " expr "\n")) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
725 `(lambda () (gdb-var-create-handler ,expr)))))))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
726 (message "gud-watch is a no-op in this mode.")))) |
54538 | 727 |
728 (defconst gdb-var-create-regexp | |
69666
164fb98f5a8e
(gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents:
69654
diff
changeset
|
729 "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",.*type=\"\\(.*?\\)\"") |
54538 | 730 |
731 (defun gdb-var-create-handler (expr) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
732 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
733 (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
|
734 (let ((var (list |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
735 (match-string 1) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
736 (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
|
737 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
|
738 (setq expr (concat gdb-selected-frame "::" expr)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
739 expr) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
740 (match-string 2) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
741 (match-string 3) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
742 nil nil gdb-frame-address))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
743 (push var gdb-var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
744 (unless (string-equal |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
745 speedbar-initial-expansion-list-name "GUD") |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
746 (speedbar-change-initial-expansion-list "GUD")) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
747 (gdb-enqueue-input |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
748 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
749 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
750 (concat "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
|
751 (car var) "\"\n") |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
752 (concat "0-var-evaluate-expression " (car var) "\n")) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
753 `(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
|
754 ,(car var) nil))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
755 (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
|
756 (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
|
757 (message-box "No symbol \"%s\" in current context." expr)))) |
54538 | 758 |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
759 (defun gdb-speedbar-update () |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
760 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
761 ;; 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
|
762 (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
|
763 ;; 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
|
764 (push 'gdb-speedbar-timer gdb-pending-triggers))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
765 |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
766 (defun gdb-speedbar-timer-fn () |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
767 (setq gdb-pending-triggers |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
768 (delq 'gdb-speedbar-timer gdb-pending-triggers)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
769 (speedbar-timer-fn)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
770 |
54538 | 771 (defun gdb-var-evaluate-expression-handler (varnum changed) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
772 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
773 (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
774 (setq gdb-pending-triggers |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
775 (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
|
776 (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
|
777 (when var |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
778 (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
|
779 (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
|
780 (gdb-speedbar-update)) |
54538 | 781 |
782 (defun gdb-var-list-children (varnum) | |
783 (gdb-enqueue-input | |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
784 (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
|
785 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
54538 | 786 |
787 (defconst gdb-var-list-children-regexp | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
788 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
789 numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)") |
54538 | 790 |
791 (defun gdb-var-list-children-handler (varnum) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
792 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
793 (let ((var-list nil)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
794 (catch 'child-already-watched |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
795 (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
|
796 (if (string-equal varnum (car var)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
797 (progn |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
798 (push var var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
799 (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
|
800 (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
|
801 (match-string 2) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
802 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
803 (match-string 6) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
804 nil nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
805 (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
|
806 (throw 'child-already-watched nil)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
807 (push varchild var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
808 (gdb-enqueue-input |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
809 (list |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
810 (concat |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
811 "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
|
812 (car varchild) "\"\n") |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
813 `(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
|
814 ,(car varchild) nil))))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
815 (push var var-list))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
816 (setq gdb-var-list (nreverse var-list))))) |
54538 | 817 |
818 (defun gdb-var-update () | |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
819 (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
|
820 (gdb-enqueue-input |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
821 (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
|
822 'gdb-var-update-handler)) |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
823 (push 'gdb-var-update gdb-pending-triggers))) |
54538 | 824 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
825 (defconst gdb-var-update-regexp |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
826 "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
827 type_changed=\".*?\".*?}") |
54538 | 828 |
829 (defun gdb-var-update-handler () | |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
830 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
831 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
832 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
833 (let ((n 0)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
834 (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
|
835 (let ((varnum (match-string 1))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
836 (if (string-equal (match-string 2) "false") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
837 (let ((var (assoc varnum gdb-var-list))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
838 (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
|
839 (setq n (1+ n)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
840 (push n gdb-pending-triggers) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
841 (gdb-enqueue-input |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
842 (list |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
843 (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
|
844 "-var-evaluate-expression " varnum "\"\n") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
845 `(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
|
846 (setq gdb-pending-triggers |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
847 (delq 'gdb-var-update gdb-pending-triggers))) |
54538 | 848 |
849 (defun gdb-var-delete () | |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
850 "Delete watch expression at point from the speedbar." |
54538 | 851 (interactive) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
852 (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
|
853 '(gdbmi gdba)) |
54538 | 854 (let ((text (speedbar-line-text))) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
855 ;; Can't use \\S-+ for whitespace because |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
856 ;; speedbar has a whacky syntax table. |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
857 (string-match "\\([^ \t]+\\)" text) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
858 (let ((expr (match-string 1 text)) var varnum) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
859 (catch 'expr-found |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
860 (dolist (var1 gdb-var-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
861 (when (string-equal expr (nth 1 var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
862 (setq var var1) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
863 (setq varnum (car var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
864 (throw 'expr-found nil)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
865 (unless (string-match "\\." (car var)) |
54538 | 866 (gdb-enqueue-input |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
867 (list |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
868 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
869 'gdba) |
55764
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
870 (concat "server interpreter mi \"-var-delete " varnum "\"\n") |
25f133a490aa
(gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
55762
diff
changeset
|
871 (concat "-var-delete " varnum "\n")) |
54538 | 872 'ignore)) |
873 (setq gdb-var-list (delq var gdb-var-list)) | |
874 (dolist (varchild gdb-var-list) | |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
875 (if (string-match (concat (car var) "\\.") (car varchild)) |
69000
0dcc5b9decbf
(gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents:
68993
diff
changeset
|
876 (setq gdb-var-list (delq varchild gdb-var-list))))))))) |
54538 | 877 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
878 (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
|
879 "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
|
880 (gdb-enqueue-input |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
881 (list |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
882 (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
|
883 (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
|
884 (concat "-var-delete -c " varnum "\n")) 'ignore))) |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
885 |
54538 | 886 (defun gdb-edit-value (text token indent) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
887 "Assign a value to a variable displayed in the speedbar." |
54538 | 888 (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
|
889 (varnum (car var)) (value)) |
54538 | 890 (setq value (read-string "New value: ")) |
891 (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
|
892 (list |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
893 (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
|
894 (concat "server interpreter mi \"-var-assign " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
895 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
|
896 (concat "-var-assign " varnum " " value "\n")) |
69325
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
897 `(lambda () (gdb-edit-value-handler ,value)))))) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
898 |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
899 (defun gdb-edit-value-handler (value) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
900 (goto-char (point-min)) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
901 (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
|
902 (message-box "Invalid number or expression (%s)" value))) |
54538 | 903 |
904 (defcustom gdb-show-changed-values t | |
68967
87bf1f965a0f
(gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68941
diff
changeset
|
905 "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
|
906 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
|
907 Changed values are highlighted with the face `font-lock-warning-face'." |
54538 | 908 :type 'boolean |
58049
fd0093bd412a
(gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
57982
diff
changeset
|
909 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
910 :version "22.1") |
54538 | 911 |
912 (defun gdb-speedbar-expand-node (text token indent) | |
913 "Expand the node the user clicked on. | |
914 TEXT is the text of the button we clicked on, a + or - item. | |
915 TOKEN is data related to this node. | |
916 INDENT is the current indentation depth." | |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
917 (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
|
918 (progn |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
919 (cond ((string-match "+" text) ;expand this node |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
920 (if (and (eq (buffer-local-value |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
921 'gud-minor-mode gud-comint-buffer) 'gdba) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
922 (string-equal gdb-version "pre-6.4")) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
923 (gdb-var-list-children token) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
924 (gdb-var-list-children-1 token))) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
925 ((string-match "-" text) ;contract this node |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
926 (dolist (var gdb-var-list) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
927 (if (string-match (concat token "\\.") (car var)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
928 (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
|
929 (gdb-var-delete-children token) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
930 (speedbar-change-expand-button-char ?+) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
931 (speedbar-delete-subblock indent)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
932 (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
|
933 (speedbar-center-buffer-smartly)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
934 (message-box "GUD session has been killed"))) |
54538 | 935 |
936 (defun gdb-get-target-string () | |
937 (with-current-buffer gud-comint-buffer | |
938 gud-target-name)) | |
939 | |
940 | |
941 ;; | |
942 ;; gdb buffers. | |
943 ;; | |
944 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
945 ;; of that particular buffer. | |
946 ;; | |
947 ;; The usual gdb interaction buffer is given the type `gdba' and | |
948 ;; is constructed specially. | |
949 ;; | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
950 ;; Others are constructed by gdb-get-buffer-create and |
54538 | 951 ;; named according to the rules set forth in the gdb-buffer-rules-assoc |
952 | |
953 (defvar gdb-buffer-rules-assoc '()) | |
954 | |
955 (defun gdb-get-buffer (key) | |
956 "Return the gdb buffer tagged with type KEY. | |
957 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
958 (save-excursion | |
959 (gdb-look-for-tagged-buffer key (buffer-list)))) | |
960 | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
961 (defun gdb-get-buffer-create (key) |
54538 | 962 "Create a new gdb buffer of the type specified by KEY. |
963 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
964 (or (gdb-get-buffer key) | |
965 (let* ((rules (assoc key gdb-buffer-rules-assoc)) | |
966 (name (funcall (gdb-rules-name-maker rules))) | |
967 (new (get-buffer-create name))) | |
968 (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
|
969 (let ((trigger)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
970 (if (cdr (cdr rules)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
971 (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
|
972 (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
|
973 (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
|
974 (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
|
975 (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
|
976 (if trigger (funcall trigger))) |
54538 | 977 new)))) |
978 | |
979 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
980 | |
981 (defun gdb-look-for-tagged-buffer (key bufs) | |
982 (let ((retval nil)) | |
983 (while (and (not retval) bufs) | |
984 (set-buffer (car bufs)) | |
985 (if (eq gdb-buffer-type key) | |
986 (setq retval (car bufs))) | |
987 (setq bufs (cdr bufs))) | |
988 retval)) | |
989 | |
990 ;; | |
991 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
992 ;; at least one and possible more functions. The functions have these | |
993 ;; roles in defining a buffer type: | |
994 ;; | |
995 ;; NAME - Return a name for this buffer type. | |
996 ;; | |
997 ;; The remaining function(s) are optional: | |
998 ;; | |
999 ;; MODE - called in a new buffer with no arguments, should establish | |
1000 ;; the proper mode for the buffer. | |
1001 ;; | |
1002 | |
1003 (defun gdb-set-buffer-rules (buffer-type &rest rules) | |
1004 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) | |
1005 (if binding | |
1006 (setcdr binding rules) | |
1007 (push (cons buffer-type rules) | |
1008 gdb-buffer-rules-assoc)))) | |
1009 | |
1010 ;; GUD buffers are an exception to the rules | |
1011 (gdb-set-buffer-rules 'gdba 'error) | |
1012 | |
1013 ;; Partial-output buffer : This accumulates output from a command executed on | |
1014 ;; behalf of emacs (rather than the user). | |
1015 ;; | |
1016 (gdb-set-buffer-rules 'gdb-partial-output-buffer | |
1017 'gdb-partial-output-name) | |
1018 | |
1019 (defun gdb-partial-output-name () | |
1020 (concat "*partial-output-" | |
1021 (gdb-get-target-string) | |
1022 "*")) | |
1023 | |
1024 | |
1025 (gdb-set-buffer-rules 'gdb-inferior-io | |
1026 'gdb-inferior-io-name | |
1027 'gdb-inferior-io-mode) | |
1028 | |
1029 (defun gdb-inferior-io-name () | |
1030 (concat "*input/output of " | |
1031 (gdb-get-target-string) | |
1032 "*")) | |
1033 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1034 (defun gdb-display-separate-io-buffer () |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1035 "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
|
1036 (interactive) |
68903
57fa3643220b
(gdb-display-separate-io-buffer): Change use of
Nick Roberts <nickrob@snap.net.nz>
parents:
68902
diff
changeset
|
1037 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1038 (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
|
1039 (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
|
1040 |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1041 (defconst gdb-frame-parameters |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1042 '((height . 14) (width . 80) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1043 (unsplittable . t) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1044 (tool-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1045 (menu-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1046 (minibuffer . nil))) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1047 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1048 (defun gdb-frame-separate-io-buffer () |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1049 "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
|
1050 (interactive) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1051 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1052 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1053 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1054 (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
|
1055 |
54538 | 1056 (defvar gdb-inferior-io-mode-map |
1057 (let ((map (make-sparse-keymap))) | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1058 (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
|
1059 (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
|
1060 (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
|
1061 (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
|
1062 (define-key map "\C-d" 'gdb-separate-io-eof) |
54538 | 1063 map)) |
1064 | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1065 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
54538 | 1066 "Major mode for gdb inferior-io." |
1067 :syntax-table nil :abbrev-table nil | |
1068 ;; We want to use comint because it has various nifty and familiar | |
1069 ;; features. We don't need a process, but comint wants one, so create | |
1070 ;; a dummy one. | |
1071 (make-comint-in-buffer | |
1072 (substring (buffer-name) 1 (- (length (buffer-name)) 1)) | |
1073 (current-buffer) "hexl") | |
1074 (setq comint-input-sender 'gdb-inferior-io-sender)) | |
1075 | |
1076 (defun gdb-inferior-io-sender (proc string) | |
1077 ;; PROC is the pseudo-process created to satisfy comint. | |
1078 (with-current-buffer (process-buffer proc) | |
1079 (setq proc (get-buffer-process gud-comint-buffer)) | |
1080 (process-send-string proc string) | |
1081 (process-send-string proc "\n"))) | |
1082 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1083 (defun gdb-separate-io-interrupt () |
54538 | 1084 "Interrupt the program being debugged." |
1085 (interactive) | |
1086 (interrupt-process | |
1087 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1088 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1089 (defun gdb-separate-io-quit () |
54538 | 1090 "Send quit signal to the program being debugged." |
1091 (interactive) | |
1092 (quit-process | |
1093 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1094 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1095 (defun gdb-separate-io-stop () |
54538 | 1096 "Stop the program being debugged." |
1097 (interactive) | |
1098 (stop-process | |
1099 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1100 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1101 (defun gdb-separate-io-eof () |
54538 | 1102 "Send end-of-file to the program being debugged." |
1103 (interactive) | |
1104 (process-send-eof | |
1105 (get-buffer-process gud-comint-buffer))) | |
1106 | |
1107 | |
1108 ;; gdb communications | |
1109 ;; | |
1110 | |
1111 ;; INPUT: things sent to gdb | |
1112 ;; | |
1113 ;; The queues are lists. Each element is either a string (indicating user or | |
1114 ;; user-like input) or a list of the form: | |
1115 ;; | |
1116 ;; (INPUT-STRING HANDLER-FN) | |
1117 ;; | |
1118 ;; The handler function will be called from the partial-output buffer when the | |
1119 ;; command completes. This is the way to write commands which invoke gdb | |
1120 ;; commands autonomously. | |
1121 ;; | |
1122 ;; These lists are consumed tail first. | |
1123 ;; | |
1124 | |
1125 (defun gdb-send (proc string) | |
1126 "A comint send filter for gdb. | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1127 This filter may simply queue input for a later time." |
63732
64e2bf63ca16
(gdb-send): Remove warning face from errors
Nick Roberts <nickrob@snap.net.nz>
parents:
63653
diff
changeset
|
1128 (with-current-buffer gud-comint-buffer |
66382
9e9e3aac0fda
(gdb-send): Bind inhibit-read-only to t
Nick Roberts <nickrob@snap.net.nz>
parents:
66162
diff
changeset
|
1129 (let ((inhibit-read-only t)) |
9e9e3aac0fda
(gdb-send): Bind inhibit-read-only to t
Nick Roberts <nickrob@snap.net.nz>
parents:
66162
diff
changeset
|
1130 (remove-text-properties (point-min) (point-max) '(face)))) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1131 (if gud-running |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1132 (progn |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1133 (let ((item (concat string "\n"))) |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
1134 (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring)) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1135 (process-send-string proc item))) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
1136 (if (and (string-match "\\\\$" string) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
1137 (not comint-input-sender-no-newline)) ;;Try to catch C-d. |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1138 (setq gdb-continuation (concat gdb-continuation string "\n")) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1139 (let ((item (concat gdb-continuation string "\n"))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1140 (gdb-enqueue-input item) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
1141 (setq gdb-continuation nil))))) |
54538 | 1142 |
1143 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
1144 ;; is a query, or other non-top-level prompt. | |
1145 | |
1146 (defun gdb-enqueue-input (item) | |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1147 (if (not gud-running) |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1148 (if gdb-prompting |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1149 (progn |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1150 (gdb-send-item item) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1151 (setq gdb-prompting nil)) |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1152 (push item gdb-input-queue)))) |
54538 | 1153 |
1154 (defun gdb-dequeue-input () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1155 (let ((queue gdb-input-queue)) |
54538 | 1156 (and queue |
1157 (let ((last (car (last queue)))) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1158 (unless (nbutlast queue) (setq gdb-input-queue '())) |
54538 | 1159 last)))) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1160 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1161 (defun gdb-send-item (item) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1162 (setq gdb-flush-pending-output nil) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1163 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-ring)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1164 (setq gdb-current-item item) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1165 (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
|
1166 (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
|
1167 (if (stringp item) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1168 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1169 (setq gdb-output-sink 'user) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1170 (process-send-string process item)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1171 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1172 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1173 (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
|
1174 (process-send-string process |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1175 (car item)))) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1176 ;; case: eq gud-minor-mode 'gdbmi |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1177 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1178 (setq gdb-output-sink 'emacs) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1179 (process-send-string process (car item))))) |
54538 | 1180 |
1181 ;; | |
1182 ;; output -- things gdb prints to emacs | |
1183 ;; | |
1184 ;; GDB output is a stream interrupted by annotations. | |
1185 ;; Annotations can be recognized by their beginning | |
1186 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
1187 ;; | |
1188 ;; The tag is a string obeying symbol syntax. | |
1189 ;; | |
1190 ;; The optional part `<opt>' can be either the empty string | |
1191 ;; or a space followed by more data relating to the annotation. | |
1192 ;; For example, the SOURCE annotation is followed by a filename, | |
1193 ;; line number and various useless goo. This data must not include | |
1194 ;; any newlines. | |
1195 ;; | |
1196 | |
1197 (defcustom gud-gdba-command-name "gdb -annotate=3" | |
1198 "Default command to execute an executable under the GDB-UI debugger." | |
1199 :type 'string | |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
1200 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1201 :version "22.1") |
54538 | 1202 |
1203 (defvar gdb-annotation-rules | |
1204 '(("pre-prompt" gdb-pre-prompt) | |
1205 ("prompt" gdb-prompt) | |
1206 ("commands" gdb-subprompt) | |
1207 ("overload-choice" gdb-subprompt) | |
1208 ("query" gdb-subprompt) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1209 ;; 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
|
1210 ("nquery" gdb-subprompt) |
54538 | 1211 ("prompt-for-continue" gdb-subprompt) |
1212 ("post-prompt" gdb-post-prompt) | |
1213 ("source" gdb-source) | |
1214 ("starting" gdb-starting) | |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1215 ("exited" gdb-exited) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1216 ("signalled" gdb-signalled) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1217 ("signal" gdb-signal) |
54538 | 1218 ("breakpoint" gdb-stopping) |
1219 ("watchpoint" gdb-stopping) | |
1220 ("frame-begin" gdb-frame-begin) | |
1221 ("stopped" gdb-stopped) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1222 ("error-begin" gdb-error) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1223 ("error" gdb-error) |
54538 | 1224 ) "An assoc mapping annotation tags to functions which process them.") |
1225 | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1226 (defun gdb-resync() |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1227 (setq gdb-flush-pending-output t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1228 (setq gud-running nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1229 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1230 (propertize "stopped"'face font-lock-warning-face)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1231 (setq gdb-output-sink 'user) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1232 (setq gdb-input-queue nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1233 (setq gdb-pending-triggers nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1234 (setq gdb-prompting t)) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1235 |
54538 | 1236 (defconst gdb-source-spec-regexp |
62716 | 1237 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)") |
54538 | 1238 |
1239 ;; Do not use this except as an annotation handler. | |
1240 (defun gdb-source (args) | |
1241 (string-match gdb-source-spec-regexp args) | |
1242 ;; Extract the frame position from the marker. | |
1243 (setq gud-last-frame | |
1244 (cons | |
1245 (match-string 1 args) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
1246 (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
|
1247 (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
|
1248 ;; cover for auto-display output which comes *before* |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1249 ;; stopped annotation |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1250 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) |
54538 | 1251 |
1252 (defun gdb-pre-prompt (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1253 "An annotation handler for `pre-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1254 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
|
1255 happens to be in effect." |
67164
c3990f178905
(gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents:
67147
diff
changeset
|
1256 (setq gdb-error nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1257 (let ((sink gdb-output-sink)) |
54538 | 1258 (cond |
1259 ((eq sink 'user) t) | |
1260 ((eq sink 'emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1261 (setq gdb-output-sink 'post-emacs)) |
54538 | 1262 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1263 (gdb-resync) |
54538 | 1264 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
1265 | |
1266 (defun gdb-prompt (ignored) | |
1267 "An annotation handler for `prompt'. | |
1268 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
|
1269 (when gdb-first-prompt |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1270 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1271 (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
|
1272 (gdb-init-1) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1273 (setq gdb-first-prompt nil)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1274 (let ((sink gdb-output-sink)) |
54538 | 1275 (cond |
1276 ((eq sink 'user) t) | |
1277 ((eq sink 'post-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1278 (setq gdb-output-sink 'user) |
54538 | 1279 (let ((handler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1280 (car (cdr gdb-current-item)))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1281 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1282 (funcall handler)))) |
1283 (t | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1284 (gdb-resync) |
54538 | 1285 (error "Phase error in gdb-prompt (got %s)" sink)))) |
1286 (let ((input (gdb-dequeue-input))) | |
1287 (if input | |
1288 (gdb-send-item input) | |
1289 (progn | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1290 (setq gdb-prompting t) |
54538 | 1291 (gud-display-frame))))) |
1292 | |
1293 (defun gdb-subprompt (ignored) | |
1294 "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
|
1295 (setq gdb-prompting t)) |
54538 | 1296 |
1297 (defun gdb-starting (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1298 "An annotation handler for `starting'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1299 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
|
1300 not GDB." |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1301 (setq gdb-active-process t) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1302 (setq gdb-printing t) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1303 (let ((sink gdb-output-sink)) |
54538 | 1304 (cond |
1305 ((eq sink 'user) | |
1306 (progn | |
1307 (setq gud-running t) | |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1308 (setq gdb-inferior-status "running") |
72492
2bf69eaa157d
(gdb-starting): Reset gdb-signalled to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
72481
diff
changeset
|
1309 (setq gdb-signalled nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1310 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1311 (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
|
1312 (gdb-remove-text-properties) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1313 (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
|
1314 (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
|
1315 (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
|
1316 (setq gdb-stack-position nil) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1317 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1318 (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
|
1319 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1320 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1321 (error "Unexpected `starting' annotation"))))) |
54538 | 1322 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1323 (defun gdb-signal (ignored) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1324 (setq gdb-inferior-status "signal") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1325 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1326 (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
|
1327 (gdb-stopping ignored)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1328 |
54538 | 1329 (defun gdb-stopping (ignored) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1330 "An annotation handler for `breakpoint' and other annotations. |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1331 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
|
1332 being debugged." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1333 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1334 (let ((sink gdb-output-sink)) |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1335 (cond |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1336 ((eq sink 'inferior) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1337 (setq gdb-output-sink 'user)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1338 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1339 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1340 (error "Unexpected stopping annotation")))))) |
54538 | 1341 |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1342 (defun gdb-exited (ignored) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1343 "An annotation handler for `exited' and `signalled'. |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1344 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
|
1345 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
|
1346 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
|
1347 directives." |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1348 (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
|
1349 (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
|
1350 (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
|
1351 (setq gdb-stack-position nil) |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
1352 (setq gud-old-arrow nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1353 (setq gdb-inferior-status "exited") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1354 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1355 (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
|
1356 (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
|
1357 |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1358 (defun gdb-signalled (ignored) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1359 (setq gdb-signalled t)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1360 |
54538 | 1361 (defun gdb-frame-begin (ignored) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1362 (setq gdb-frame-begin t) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1363 (setq gdb-printing nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1364 (let ((sink gdb-output-sink)) |
54538 | 1365 (cond |
1366 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1367 (setq gdb-output-sink 'user)) |
54538 | 1368 ((eq sink 'user) t) |
1369 ((eq sink 'emacs) t) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1370 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1371 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1372 (error "Unexpected frame-begin annotation (%S)" sink))))) |
54538 | 1373 |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1374 (defcustom gdb-same-frame focus-follows-mouse |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1375 "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
|
1376 :group 'gud |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1377 :type 'boolean |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1378 :version "22.1") |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1379 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1380 (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
|
1381 "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
|
1382 :group 'gud |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1383 :type 'boolean |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1384 :version "22.1") |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1385 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1386 (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
|
1387 "Toggle trying to find a source frame further up stack. |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1388 With arg, look for a source frame further up stack iff arg is positive." |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1389 (interactive "P") |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1390 (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
|
1391 (if (null arg) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1392 (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
|
1393 (> (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
|
1394 (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
|
1395 (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
|
1396 |
54538 | 1397 (defun gdb-stopped (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1398 "An annotation handler for `stopped'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1399 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
|
1400 sink to `user' in `gdb-stopping', that is fine." |
54538 | 1401 (setq gud-running nil) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1402 (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
|
1403 (if (and gdb-frame-begin gdb-printing) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1404 (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
|
1405 ;;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
|
1406 ;;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
|
1407 (if gdb-same-frame |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1408 (gdb-display-gdb-buffer) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1409 (gdb-frame-gdb-buffer)) |
72200
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1410 (if gdb-find-source-frame |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1411 ;;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
|
1412 (setq gdb-look-up-stack |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1413 (if (gdb-get-buffer 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1414 'keep |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1415 (progn |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1416 (gdb-get-buffer-create 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1417 (gdb-invalidate-frames) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1418 'delete)))))) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1419 (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
|
1420 (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
|
1421 (setq gdb-inferior-status "stopped") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1422 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1423 (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
|
1424 (let ((sink gdb-output-sink)) |
54538 | 1425 (cond |
1426 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1427 (setq gdb-output-sink 'user)) |
54538 | 1428 ((eq sink 'user) t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1429 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1430 (gdb-resync) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1431 (error "Unexpected stopped annotation")))) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1432 (if gdb-signalled (gdb-exited ignored))) |
54538 | 1433 |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1434 (defun gdb-error (ignored) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1435 (setq gdb-error (not gdb-error))) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1436 |
54538 | 1437 (defun gdb-post-prompt (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1438 "An annotation handler for `post-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1439 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
|
1440 happens to be appropriate." |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
1441 ;; 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
|
1442 ;; yet. |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1443 (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
|
1444 (gdb-get-selected-frame) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1445 (gdb-invalidate-frames) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1446 ;; 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
|
1447 (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
|
1448 (gdb-invalidate-breakpoints) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1449 ;; 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
|
1450 ;; so gdb-pc-address is updated. |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1451 ;; (gdb-invalidate-assembler) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1452 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1453 (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
|
1454 (gdb-invalidate-registers) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1455 (gdb-get-changed-registers) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1456 (gdb-invalidate-registers-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1457 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1458 (gdb-invalidate-memory) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1459 (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
|
1460 (gdb-invalidate-locals) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1461 (gdb-invalidate-locals-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1462 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1463 (gdb-invalidate-threads) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1464 (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
|
1465 ;; FIXME: with GDB-6 on Darwin, this might very well work. |
64654 | 1466 ;; 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
|
1467 (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
|
1468 (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
|
1469 (gdb-var-update) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1470 (gdb-var-update-1))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1471 (setq gdb-first-post-prompt nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1472 (let ((sink gdb-output-sink)) |
54538 | 1473 (cond |
1474 ((eq sink 'user) t) | |
1475 ((eq sink 'pre-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1476 (setq gdb-output-sink 'emacs)) |
54538 | 1477 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1478 (gdb-resync) |
54538 | 1479 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
1480 | |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1481 (defconst gdb-buffer-list |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1482 '(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
|
1483 |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1484 (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
|
1485 (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
|
1486 (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
|
1487 (if buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1488 (with-current-buffer buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1489 (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
|
1490 (remove-text-properties |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1491 (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
|
1492 |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1493 ;; 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
|
1494 ;; 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
|
1495 ;; visited breakpoint is, use that window. |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1496 (defun gdb-display-source-buffer (buffer) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1497 (let* ((last-window (if gud-last-last-frame |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1498 (get-buffer-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1499 (gud-find-file (car gud-last-last-frame))))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1500 (source-window (or last-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1501 (if (and gdb-source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1502 (window-live-p gdb-source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1503 gdb-source-window)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1504 (when source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1505 (setq gdb-source-window source-window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1506 (set-window-buffer source-window buffer)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1507 source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1508 |
54538 | 1509 (defun gud-gdba-marker-filter (string) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1510 "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
|
1511 (if gdb-flush-pending-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1512 nil |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1513 (when gdb-enable-debug |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1514 (push (cons 'recv string) gdb-debug-ring) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1515 (if (> (length gdb-debug-ring) gdb-debug-ring-max) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1516 (setcdr (nthcdr (1- gdb-debug-ring-max) gdb-debug-ring) nil))) |
64654 | 1517 ;; 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
|
1518 (setq gud-marker-acc (concat gud-marker-acc string)) |
64654 | 1519 ;; 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
|
1520 (let ((output "")) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1521 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1522 ;; 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
|
1523 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1524 (let ((annotation (match-string 1 gud-marker-acc))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1525 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1526 ;; Stuff prior to the match is just ordinary output. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1527 ;; It is either concatenated to OUTPUT or directed |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1528 ;; elsewhere. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1529 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1530 (gdb-concat-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1531 output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1532 (substring gud-marker-acc 0 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1533 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1534 ;; Take that stuff off the gud-marker-acc. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1535 (setq gud-marker-acc (substring gud-marker-acc (match-end 0))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1536 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1537 ;; 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
|
1538 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1539 (let* ((annotation-type (match-string 1 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1540 (annotation-arguments (match-string 2 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1541 (annotation-rule (assoc annotation-type |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1542 gdb-annotation-rules))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1543 ;; Call the handler for this annotation. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1544 (if annotation-rule |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1545 (funcall (car (cdr annotation-rule)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1546 annotation-arguments) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1547 ;; Else the annotation is not recognized. Ignore it silently, |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1548 ;; so that GDB can add new annotations without causing |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1549 ;; us to blow up. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1550 )))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1551 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1552 ;; 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
|
1553 ;; 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
|
1554 (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
|
1555 gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1556 (progn |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1557 ;; 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
|
1558 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1559 (gdb-concat-output output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1560 (substring gud-marker-acc 0 |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1561 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1562 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1563 ;; 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
|
1564 (setq gud-marker-acc (substring gud-marker-acc |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1565 (match-beginning 0)))) |
54538 | 1566 ;; |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1567 ;; In case we know the gud-marker-acc contains no partial annotations: |
54538 | 1568 (progn |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1569 (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
|
1570 (setq gud-marker-acc ""))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1571 output))) |
54538 | 1572 |
1573 (defun gdb-concat-output (so-far new) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1574 (if gdb-error |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1575 (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
|
1576 (let ((sink gdb-output-sink)) |
54538 | 1577 (cond |
1578 ((eq sink 'user) (concat so-far new)) | |
1579 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
1580 ((eq sink 'emacs) | |
1581 (gdb-append-to-partial-output new) | |
1582 so-far) | |
1583 ((eq sink 'inferior) | |
1584 (gdb-append-to-inferior-io new) | |
1585 so-far) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1586 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1587 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1588 (error "Bogon output sink %S" sink))))) |
54538 | 1589 |
1590 (defun gdb-append-to-partial-output (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1591 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1592 (goto-char (point-max)) |
1593 (insert string))) | |
1594 | |
1595 (defun gdb-clear-partial-output () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1596 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1597 (erase-buffer))) |
1598 | |
1599 (defun gdb-append-to-inferior-io (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1600 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1601 (goto-char (point-max)) |
1602 (insert-before-markers string)) | |
1603 (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
|
1604 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t))) |
54538 | 1605 |
1606 (defun gdb-clear-inferior-io () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1607 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1608 (erase-buffer))) |
1609 | |
1610 | |
1611 ;; One trick is to have a command who's output is always available in a buffer | |
1612 ;; of it's own, and is always up to date. We build several buffers of this | |
1613 ;; type. | |
1614 ;; | |
1615 ;; There are two aspects to this: gdb has to tell us when the output for that | |
1616 ;; command might have changed, and we have to be able to run the command | |
1617 ;; behind the user's back. | |
1618 ;; | |
1619 ;; The output phasing associated with the variable gdb-output-sink | |
1620 ;; help us to run commands behind the user's back. | |
1621 ;; | |
1622 ;; Below is the code for specificly managing buffers of output from one | |
1623 ;; command. | |
1624 ;; | |
1625 | |
1626 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | |
1627 ;; It adds an input for the command we are tracking. It should be the | |
1628 ;; annotation rule binding of whatever gdb sends to tell us this command | |
1629 ;; might have changed it's output. | |
1630 ;; | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1631 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
54538 | 1632 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
1633 ;; input in the input queue (see comment about ``gdb communications'' above). | |
1634 | |
1635 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command | |
1636 output-handler) | |
1637 `(defun ,name (&optional ignored) | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1638 (if (and ,demand-predicate |
54538 | 1639 (not (member ',name |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1640 gdb-pending-triggers))) |
54538 | 1641 (progn |
1642 (gdb-enqueue-input | |
1643 (list ,gdb-command ',output-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1644 (push ',name gdb-pending-triggers))))) |
54538 | 1645 |
1646 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) | |
1647 `(defun ,name () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1648 (setq gdb-pending-triggers |
54538 | 1649 (delq ',trigger |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1650 gdb-pending-triggers)) |
54538 | 1651 (let ((buf (gdb-get-buffer ',buf-key))) |
1652 (and buf | |
1653 (with-current-buffer buf | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1654 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1655 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1656 (p (window-point window)) |
54538 | 1657 (buffer-read-only nil)) |
1658 (erase-buffer) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1659 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 1660 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1661 (set-window-start window start) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1662 (set-window-point window p))))) |
54538 | 1663 ;; put customisation here |
1664 (,custom-defun))) | |
1665 | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1666 (defmacro def-gdb-auto-updated-buffer (buffer-key |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1667 trigger-name gdb-command |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1668 output-handler-name custom-defun) |
54538 | 1669 `(progn |
1670 (def-gdb-auto-update-trigger ,trigger-name | |
1671 ;; The demand predicate: | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1672 (gdb-get-buffer ',buffer-key) |
54538 | 1673 ,gdb-command |
1674 ,output-handler-name) | |
1675 (def-gdb-auto-update-handler ,output-handler-name | |
1676 ,trigger-name ,buffer-key ,custom-defun))) | |
1677 | |
1678 | |
1679 ;; | |
1680 ;; Breakpoint buffer : This displays the output of `info breakpoints'. | |
1681 ;; | |
1682 (gdb-set-buffer-rules 'gdb-breakpoints-buffer | |
1683 'gdb-breakpoints-buffer-name | |
1684 'gdb-breakpoints-mode) | |
1685 | |
1686 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
1687 ;; This defines the auto update rule for buffers of type | |
1688 ;; `gdb-breakpoints-buffer'. | |
1689 ;; | |
1690 ;; It defines a function to serve as the annotation handler that | |
1691 ;; handles the `foo-invalidated' message. That function is called: | |
1692 gdb-invalidate-breakpoints | |
1693 ;; | |
1694 ;; To update the buffer, this command is sent to gdb. | |
1695 "server info breakpoints\n" | |
1696 ;; | |
1697 ;; This also defines a function to be the handler for the output | |
1698 ;; from the command above. That function will copy the output into | |
1699 ;; the appropriately typed buffer. That function will be called: | |
1700 gdb-info-breakpoints-handler | |
1701 ;; buffer specific functions | |
1702 gdb-info-breakpoints-custom) | |
1703 | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1704 (defconst breakpoint-xpm-data |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1705 "/* XPM */ |
54538 | 1706 static char *magick[] = { |
1707 /* columns rows colors chars-per-pixel */ | |
1708 \"10 10 2 1\", | |
1709 \" c red\", | |
1710 \"+ c None\", | |
1711 /* pixels */ | |
1712 \"+++ +++\", | |
1713 \"++ ++\", | |
1714 \"+ +\", | |
1715 \" \", | |
1716 \" \", | |
1717 \" \", | |
1718 \" \", | |
1719 \"+ +\", | |
1720 \"++ ++\", | |
1721 \"+++ +++\", | |
1722 };" | |
1723 "XPM data used for breakpoint icon.") | |
1724 | |
1725 (defconst breakpoint-enabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1726 "P1 |
54538 | 1727 10 10\", |
1728 0 0 0 0 1 1 1 1 0 0 0 0 | |
1729 0 0 0 1 1 1 1 1 1 0 0 0 | |
1730 0 0 1 1 1 1 1 1 1 1 0 0 | |
1731 0 1 1 1 1 1 1 1 1 1 1 0 | |
1732 0 1 1 1 1 1 1 1 1 1 1 0 | |
1733 0 1 1 1 1 1 1 1 1 1 1 0 | |
1734 0 1 1 1 1 1 1 1 1 1 1 0 | |
1735 0 0 1 1 1 1 1 1 1 1 0 0 | |
1736 0 0 0 1 1 1 1 1 1 0 0 0 | |
1737 0 0 0 0 1 1 1 1 0 0 0 0" | |
1738 "PBM data used for enabled breakpoint icon.") | |
1739 | |
1740 (defconst breakpoint-disabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1741 "P1 |
54538 | 1742 10 10\", |
1743 0 0 1 0 1 0 1 0 0 0 | |
1744 0 1 0 1 0 1 0 1 0 0 | |
1745 1 0 1 0 1 0 1 0 1 0 | |
1746 0 1 0 1 0 1 0 1 0 1 | |
1747 1 0 1 0 1 0 1 0 1 0 | |
1748 0 1 0 1 0 1 0 1 0 1 | |
1749 1 0 1 0 1 0 1 0 1 0 | |
1750 0 1 0 1 0 1 0 1 0 1 | |
1751 0 0 1 0 1 0 1 0 1 0 | |
1752 0 0 0 1 0 1 0 1 0 0" | |
1753 "PBM data used for disabled breakpoint icon.") | |
1754 | |
1755 (defvar breakpoint-enabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1756 "Icon for enabled breakpoint in display margin.") |
54538 | 1757 |
1758 (defvar breakpoint-disabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1759 "Icon for disabled breakpoint in display margin.") |
54538 | 1760 |
57982
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1761 (and (display-images-p) |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1762 ;; 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
|
1763 (define-fringe-bitmap 'breakpoint |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1764 "\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
|
1765 ;; 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
|
1766 (define-fringe-bitmap 'hollow-right-triangle |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1767 "\xe0\x90\x88\x84\x84\x88\x90\xe0")) |
54538 | 1768 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1769 (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
|
1770 '((t |
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1771 :foreground "red" |
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1772 :weight bold)) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1773 "Face for enabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1774 :group 'gud) |
54538 | 1775 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1776 (defface breakpoint-disabled |
60810
6eef5fcb0572
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-199
Miles Bader <miles@gnu.org>
parents:
60760
diff
changeset
|
1777 ;; We use different values of grey for different background types, |
6eef5fcb0572
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-199
Miles Bader <miles@gnu.org>
parents:
60760
diff
changeset
|
1778 ;; so that on low-color displays it will end up as something visible |
60839
7a4f7626e4dc
(breakpoint-enabled, breakpoint-disabled):
Kim F. Storm <storm@cua.dk>
parents:
60810
diff
changeset
|
1779 ;; if it has to be approximated. |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
1780 '((t :foreground "grey70")) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1781 "Face for disabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1782 :group 'gud) |
54538 | 1783 |
64654 | 1784 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). |
54538 | 1785 (defun gdb-info-breakpoints-custom () |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1786 (let ((flag) (bptno)) |
64654 | 1787 ;; Remove all breakpoint-icons in source buffers but not assembler buffer. |
54538 | 1788 (dolist (buffer (buffer-list)) |
1789 (with-current-buffer buffer | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1790 (if (and (memq gud-minor-mode '(gdba gdbmi)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1791 (not (string-match "\\`\\*.+\\*\\'" (buffer-name)))) |
54538 | 1792 (gdb-remove-breakpoint-icons (point-min) (point-max))))) |
1793 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) | |
1794 (save-excursion | |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1795 (let ((buffer-read-only nil)) |
54538 | 1796 (goto-char (point-min)) |
1797 (while (< (point) (- (point-max) 1)) | |
1798 (forward-line 1) | |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1799 (if (looking-at gdb-breakpoint-regexp) |
54538 | 1800 (progn |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1801 (setq bptno (match-string 1)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1802 (setq flag (char-after (match-beginning 2))) |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1803 (add-text-properties |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1804 (match-beginning 2) (match-end 2) |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1805 (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
|
1806 '(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
|
1807 '(face font-lock-type-face))) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1808 (let ((bl (point)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1809 (el (line-end-position))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1810 (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
|
1811 (progn |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1812 (add-text-properties |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1813 (match-beginning 1) (match-end 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1814 '(face font-lock-function-name-face)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1815 (looking-at "\\(\\S-+\\):\\([0-9]+\\)") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1816 (let ((line (match-string 2)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1817 (file (match-string 1))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1818 (add-text-properties bl el |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1819 '(mouse-face highlight |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1820 help-echo "mouse-2, RET: visit breakpoint")) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1821 (unless (file-exists-p file) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1822 (setq file (cdr (assoc bptno gdb-location-alist)))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1823 (if (and file |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1824 (not (string-equal file "File not found"))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1825 (with-current-buffer |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1826 (find-file-noselect file 'nowarn) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1827 (set (make-local-variable 'gud-minor-mode) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1828 'gdba) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1829 (set (make-local-variable 'tool-bar-map) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1830 gud-tool-bar-map) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1831 ;; Only want one breakpoint icon at each |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1832 ;; location. |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1833 (save-excursion |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1834 (goto-line (string-to-number line)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1835 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1836 (gdb-enqueue-input |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1837 (list |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1838 (concat gdb-server-prefix "list " |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1839 (match-string-no-properties 1) ":1\n") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1840 'ignore)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1841 (gdb-enqueue-input |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1842 (list (concat gdb-server-prefix "info source\n") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1843 `(lambda () (gdb-get-location |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1844 ,bptno ,line ,flag))))))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1845 (if (re-search-forward |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1846 "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1847 el t) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1848 (add-text-properties |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1849 (match-beginning 1) (match-end 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1850 '(face font-lock-function-name-face)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1851 (end-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1852 (re-search-backward "\\s-\\(\\S-*\\)" |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1853 bl t) |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1854 (add-text-properties |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1855 (match-beginning 1) (match-end 1) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1856 '(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
|
1857 (end-of-line)))))) |
54962
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1858 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) |
54538 | 1859 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1860 (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
|
1861 "Set/clear breakpoint in left fringe/margin with mouse click." |
54538 | 1862 (interactive "e") |
1863 (mouse-minibuffer-check event) | |
1864 (let ((posn (event-end event))) | |
1865 (if (numberp (posn-point posn)) | |
1866 (with-selected-window (posn-window posn) | |
1867 (save-excursion | |
1868 (goto-char (posn-point posn)) | |
1869 (if (or (posn-object posn) | |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
1870 (eq (car (fringe-bitmaps-at-pos (posn-point posn))) |
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
1871 'breakpoint)) |
54538 | 1872 (gud-remove nil) |
1873 (gud-break nil))))))) | |
1874 | |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1875 (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
|
1876 "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
|
1877 (interactive "e") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1878 (mouse-minibuffer-check event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1879 (let ((posn (event-end event))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1880 (if (numberp (posn-point posn)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1881 (with-selected-window (posn-window posn) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1882 (save-excursion |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1883 (goto-char (posn-point posn)) |
64654 | 1884 (if (posn-object posn) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1885 (gdb-enqueue-input |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1886 (list |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1887 (let ((bptno (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1888 0 'gdb-bptno (car (posn-string posn))))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1889 (concat gdb-server-prefix |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1890 (if (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1891 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
|
1892 "disable " |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1893 "enable ") |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1894 bptno "\n")) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1895 'ignore)))))))) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1896 |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1897 (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
|
1898 "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
|
1899 (interactive "e") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1900 (mouse-minibuffer-check event) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1901 (let* ((posn (event-end event)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1902 (pos (posn-point posn)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1903 obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1904 (when (numberp pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1905 (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
|
1906 (save-excursion |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1907 (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
|
1908 (goto-char pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1909 (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
|
1910 (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
|
1911 (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
|
1912 (when (stringp obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1913 (gdb-enqueue-input |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1914 (list |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1915 (concat gdb-server-prefix |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1916 (if (get-text-property 0 'gdb-enabled obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1917 "disable " |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1918 "enable ") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1919 (get-text-property 0 'gdb-bptno obj) "\n") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1920 'ignore)))))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1921 |
54538 | 1922 (defun gdb-breakpoints-buffer-name () |
1923 (with-current-buffer gud-comint-buffer | |
1924 (concat "*breakpoints of " (gdb-get-target-string) "*"))) | |
1925 | |
1926 (defun gdb-display-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1927 "Display status of user-settable breakpoints." |
54538 | 1928 (interactive) |
1929 (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
|
1930 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t)) |
54538 | 1931 |
1932 (defun gdb-frame-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
1933 "Display status of user-settable breakpoints in a new frame." |
54538 | 1934 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
1935 (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
|
1936 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1937 (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer)))) |
54538 | 1938 |
1939 (defvar gdb-breakpoints-mode-map | |
1940 (let ((map (make-sparse-keymap)) | |
1941 (menu (make-sparse-keymap "Breakpoints"))) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1942 (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
|
1943 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
54538 | 1944 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1945 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
54538 | 1946 (suppress-keymap map) |
1947 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) | |
1948 (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
|
1949 (define-key map "D" 'gdb-delete-breakpoint) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1950 ;; 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
|
1951 (define-key map "q" 'gdb-delete-frame-or-window) |
54538 | 1952 (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
|
1953 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
1954 (define-key map [follow-link] 'mouse-face) |
54538 | 1955 map)) |
1956 | |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1957 (defun gdb-delete-frame-or-window () |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1958 "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
|
1959 (interactive) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1960 (if (one-window-p) (delete-frame) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1961 (delete-window))) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1962 |
54538 | 1963 (defun gdb-breakpoints-mode () |
1964 "Major mode for gdb breakpoints. | |
1965 | |
1966 \\{gdb-breakpoints-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1967 (kill-all-local-variables) |
54538 | 1968 (setq major-mode 'gdb-breakpoints-mode) |
1969 (setq mode-name "Breakpoints") | |
1970 (use-local-map gdb-breakpoints-mode-map) | |
1971 (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
|
1972 (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
|
1973 (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
|
1974 'gdb-invalidate-breakpoints |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1975 'gdbmi-invalidate-breakpoints)) |
54538 | 1976 |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1977 (defconst gdb-breakpoint-regexp |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1978 "\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\s-+\\(.\\)\\s-+") |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1979 |
54538 | 1980 (defun gdb-toggle-breakpoint () |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1981 "Enable/disable breakpoint at current line." |
54538 | 1982 (interactive) |
1983 (save-excursion | |
1984 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1985 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1986 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1987 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1988 (concat gdb-server-prefix |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1989 (if (eq ?y (char-after (match-beginning 2))) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1990 "disable " |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1991 "enable ") |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1992 (match-string 1) "\n") 'ignore)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
1993 (error "Not recognized as break/watchpoint line")))) |
54538 | 1994 |
1995 (defun gdb-delete-breakpoint () | |
1996 "Delete the breakpoint at current line." | |
1997 (interactive) | |
1998 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1999 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2000 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2001 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2002 (concat gdb-server-prefix "delete " (match-string 1) "\n") 'ignore)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2003 (error "Not recognized as break/watchpoint line"))) |
54538 | 2004 |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2005 (defun gdb-goto-breakpoint (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2006 "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
|
2007 (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
|
2008 (if event (posn-set-point (event-end event))) |
54538 | 2009 (save-excursion |
2010 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2011 (if (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2012 (let ((bptno (match-string 1)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2013 (file (match-string 2)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2014 (line (match-string 3))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2015 (save-selected-window |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2016 (let* ((buffer (find-file-noselect |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2017 (if (file-exists-p file) file |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2018 (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
|
2019 (window (or (gdb-display-source-buffer buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2020 (display-buffer buffer)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2021 (setq gdb-source-window window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2022 (with-current-buffer buffer |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2023 (goto-line (string-to-number line)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2024 (set-window-point window (point)))))) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2025 (error "No location specified.")))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2026 |
54538 | 2027 |
2028 ;; Frames buffer. This displays a perpetually correct bactracktrace | |
2029 ;; (from the command `where'). | |
2030 ;; | |
2031 ;; Alas, if your stack is deep, it is costly. | |
2032 ;; | |
2033 (gdb-set-buffer-rules 'gdb-stack-buffer | |
2034 'gdb-stack-buffer-name | |
2035 'gdb-frames-mode) | |
2036 | |
2037 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
2038 gdb-invalidate-frames | |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2039 "server info stack\n" |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2040 gdb-info-stack-handler |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2041 gdb-info-stack-custom) |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2042 |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2043 (defun gdb-info-stack-custom () |
54538 | 2044 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) |
2045 (save-excursion | |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2046 (unless (eq gdb-look-up-stack 'delete) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2047 (let ((buffer-read-only nil) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2048 bl el) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2049 (goto-char (point-min)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2050 (while (< (point) (point-max)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2051 (setq bl (line-beginning-position) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2052 el (line-end-position)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2053 (when (looking-at "#") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2054 (add-text-properties bl el |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2055 '(mouse-face highlight |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2056 help-echo "mouse-2, RET: Select frame"))) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2057 (goto-char bl) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2058 (when (looking-at "^#\\([0-9]+\\)") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2059 (when (string-equal (match-string 1) gdb-frame-number) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2060 (if (> (car (window-fringes)) 0) |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2061 (progn |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2062 (or gdb-stack-position |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2063 (setq gdb-stack-position (make-marker))) |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2064 (set-marker gdb-stack-position (point))) |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2065 (put-text-property bl (+ bl 4) |
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2066 'face '(:inverse-video t)))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2067 (when (re-search-forward |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2068 (concat |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2069 (if (string-equal (match-string 1) "0") "" " in ") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2070 "\\([^ ]+\\) (") el t) |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2071 (put-text-property (match-beginning 1) (match-end 1) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2072 'face font-lock-function-name-face) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2073 (setq bl (match-end 0)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2074 (while (re-search-forward "<\\([^>]+\\)>" el t) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2075 (put-text-property (match-beginning 1) (match-end 1) |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2076 'face font-lock-function-name-face)) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2077 (goto-char bl) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2078 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2079 (put-text-property (match-beginning 1) (match-end 1) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2080 'face font-lock-variable-name-face)))) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2081 (forward-line 1)))) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2082 (when gdb-look-up-stack |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2083 (goto-char (point-min)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2084 (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2085 (let ((start (line-beginning-position)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2086 (file (match-string 1)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2087 (line (match-string 2))) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2088 (re-search-backward "^#*\\([0-9]+\\)" start t) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2089 (gdb-enqueue-input |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2090 (list (concat gdb-server-prefix "frame " |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2091 (match-string 1) "\n") 'gdb-set-hollow)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2092 (gdb-enqueue-input |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2093 (list (concat gdb-server-prefix "frame 0\n") 'ignore))))))) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2094 (if (eq gdb-look-up-stack 'delete) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2095 (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
|
2096 (setq gdb-look-up-stack nil)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2097 |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2098 (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
|
2099 (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
|
2100 (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
|
2101 (setq fringe-indicator-alist |
6564e84a8e09
(gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents:
72200
diff
changeset
|
2102 '((overlay-arrow . hollow-right-triangle)))))) |
54538 | 2103 |
2104 (defun gdb-stack-buffer-name () | |
2105 (with-current-buffer gud-comint-buffer | |
2106 (concat "*stack frames of " (gdb-get-target-string) "*"))) | |
2107 | |
2108 (defun gdb-display-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2109 "Display backtrace of current stack." |
54538 | 2110 (interactive) |
2111 (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
|
2112 (gdb-get-buffer-create 'gdb-stack-buffer) t)) |
54538 | 2113 |
2114 (defun gdb-frame-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2115 "Display backtrace of current stack in a new frame." |
54538 | 2116 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2117 (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
|
2118 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2119 (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer)))) |
54538 | 2120 |
2121 (defvar gdb-frames-mode-map | |
2122 (let ((map (make-sparse-keymap))) | |
2123 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2124 (define-key map "q" 'kill-this-buffer) |
54538 | 2125 (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
|
2126 (define-key map [mouse-2] 'gdb-frames-select) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2127 (define-key map [follow-link] 'mouse-face) |
54538 | 2128 map)) |
2129 | |
2130 (defun gdb-frames-mode () | |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2131 "Major mode for gdb call stack. |
54538 | 2132 |
2133 \\{gdb-frames-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2134 (kill-all-local-variables) |
54538 | 2135 (setq major-mode 'gdb-frames-mode) |
2136 (setq mode-name "Frames") | |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2137 (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
|
2138 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) |
54538 | 2139 (setq buffer-read-only t) |
2140 (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
|
2141 (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
|
2142 (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
|
2143 'gdb-invalidate-frames |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2144 'gdbmi-invalidate-frames)) |
54538 | 2145 |
2146 (defun gdb-get-frame-number () | |
2147 (save-excursion | |
65861
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
2148 (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
|
2149 (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
|
2150 (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) |
54538 | 2151 (n (or (and pos (match-string-no-properties 1)) "0"))) |
2152 n))) | |
2153 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2154 (defun gdb-frames-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2155 "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
|
2156 (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
|
2157 (if event (posn-set-point (event-end event))) |
54538 | 2158 (gdb-enqueue-input |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2159 (list (concat gdb-server-prefix "frame " |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2160 (gdb-get-frame-number) "\n") 'ignore))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2161 |
54538 | 2162 |
2163 ;; Threads buffer. This displays a selectable thread list. | |
2164 ;; | |
2165 (gdb-set-buffer-rules 'gdb-threads-buffer | |
2166 'gdb-threads-buffer-name | |
2167 'gdb-threads-mode) | |
2168 | |
2169 (def-gdb-auto-updated-buffer gdb-threads-buffer | |
2170 gdb-invalidate-threads | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2171 (concat gdb-server-prefix "info threads\n") |
54538 | 2172 gdb-info-threads-handler |
2173 gdb-info-threads-custom) | |
2174 | |
2175 (defun gdb-info-threads-custom () | |
2176 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | |
2177 (let ((buffer-read-only nil)) | |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2178 (save-excursion |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2179 (goto-char (point-min)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2180 (while (< (point) (point-max)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2181 (unless (looking-at "No ") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2182 (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
|
2183 '(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
|
2184 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
|
2185 (forward-line 1)))))) |
54538 | 2186 |
2187 (defun gdb-threads-buffer-name () | |
2188 (with-current-buffer gud-comint-buffer | |
2189 (concat "*threads of " (gdb-get-target-string) "*"))) | |
2190 | |
2191 (defun gdb-display-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2192 "Display IDs of currently known threads." |
54538 | 2193 (interactive) |
2194 (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
|
2195 (gdb-get-buffer-create 'gdb-threads-buffer) t)) |
54538 | 2196 |
2197 (defun gdb-frame-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2198 "Display IDs of currently known threads in a new frame." |
54538 | 2199 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2200 (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
|
2201 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2202 (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer)))) |
54538 | 2203 |
2204 (defvar gdb-threads-mode-map | |
2205 (let ((map (make-sparse-keymap))) | |
2206 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2207 (define-key map "q" 'kill-this-buffer) |
54538 | 2208 (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
|
2209 (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
|
2210 (define-key map [follow-link] 'mouse-face) |
54538 | 2211 map)) |
2212 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2213 (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
|
2214 '((") +\\([^ ]+\\) (" (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
|
2215 ("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
|
2216 ("\\(\\(\\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
|
2217 "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
|
2218 |
54538 | 2219 (defun gdb-threads-mode () |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2220 "Major mode for gdb threads. |
54538 | 2221 |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2222 \\{gdb-threads-mode-map}" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2223 (kill-all-local-variables) |
54538 | 2224 (setq major-mode 'gdb-threads-mode) |
2225 (setq mode-name "Threads") | |
2226 (setq buffer-read-only t) | |
2227 (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
|
2228 (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
|
2229 '(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
|
2230 (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
|
2231 'gdb-invalidate-threads) |
54538 | 2232 |
2233 (defun gdb-get-thread-number () | |
2234 (save-excursion | |
2235 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) | |
2236 (match-string-no-properties 1))) | |
2237 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2238 (defun gdb-threads-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2239 "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
|
2240 (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
|
2241 (if event (posn-set-point (event-end event))) |
54538 | 2242 (gdb-enqueue-input |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2243 (list (concat gdb-server-prefix "thread " |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2244 (gdb-get-thread-number) "\n") 'ignore)) |
54538 | 2245 (gud-display-frame)) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2246 |
54538 | 2247 |
2248 ;; Registers buffer. | |
2249 ;; | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2250 (defcustom gdb-all-registers nil |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2251 "Non-nil means include floating-point registers." |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2252 :type 'boolean |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2253 :group 'gud |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2254 :version "22.1") |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2255 |
54538 | 2256 (gdb-set-buffer-rules 'gdb-registers-buffer |
2257 'gdb-registers-buffer-name | |
2258 'gdb-registers-mode) | |
2259 | |
2260 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
2261 gdb-invalidate-registers | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2262 (concat |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2263 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n") |
54538 | 2264 gdb-info-registers-handler |
2265 gdb-info-registers-custom) | |
2266 | |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2267 (defun gdb-info-registers-custom () |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2268 (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
|
2269 (save-excursion |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2270 (let ((buffer-read-only nil) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2271 start end) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2272 (goto-char (point-min)) |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2273 (while (< (point) (point-max)) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2274 (setq start (line-beginning-position)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2275 (setq end (line-end-position)) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2276 (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
|
2277 (unless (string-equal (match-string 0) "The") |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2278 (put-text-property start (match-end 0) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2279 '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
|
2280 (add-text-properties start end |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2281 '(help-echo "mouse-2: edit value" |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2282 mouse-face highlight)))) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2283 (forward-line 1)))))) |
54538 | 2284 |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2285 (defun gdb-edit-register-value (&optional event) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2286 (interactive (list last-input-event)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2287 (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
|
2288 (if event (posn-set-point (event-end event))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2289 (beginning-of-line) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2290 (let* ((register (current-word)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2291 (value (read-string (format "New value (%s): " register)))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2292 (gdb-enqueue-input |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2293 (list (concat gdb-server-prefix "set $" register "=" value "\n") |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2294 'ignore))))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2295 |
54538 | 2296 (defvar gdb-registers-mode-map |
2297 (let ((map (make-sparse-keymap))) | |
2298 (suppress-keymap map) | |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2299 (define-key map "\r" 'gdb-edit-register-value) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2300 (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
|
2301 (define-key map " " 'gdb-all-registers) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2302 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2303 map)) |
54538 | 2304 |
2305 (defun gdb-registers-mode () | |
2306 "Major mode for gdb registers. | |
2307 | |
2308 \\{gdb-registers-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2309 (kill-all-local-variables) |
54538 | 2310 (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
|
2311 (setq mode-name "Registers") |
54538 | 2312 (setq buffer-read-only t) |
2313 (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
|
2314 (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
|
2315 (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
|
2316 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2317 (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
|
2318 'gdb-invalidate-registers) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2319 'gdb-invalidate-registers-1)) |
54538 | 2320 |
2321 (defun gdb-registers-buffer-name () | |
2322 (with-current-buffer gud-comint-buffer | |
2323 (concat "*registers of " (gdb-get-target-string) "*"))) | |
2324 | |
2325 (defun gdb-display-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2326 "Display integer register contents." |
54538 | 2327 (interactive) |
2328 (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
|
2329 (gdb-get-buffer-create 'gdb-registers-buffer) t)) |
54538 | 2330 |
2331 (defun gdb-frame-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2332 "Display integer register contents in a new frame." |
54538 | 2333 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2334 (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
|
2335 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2336 (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer)))) |
59808 | 2337 |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
2338 (defun gdb-all-registers () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2339 "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
|
2340 (interactive) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2341 (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
|
2342 (if gdb-all-registers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2343 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2344 (setq gdb-all-registers nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2345 (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
|
2346 (setq mode-name "Registers"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2347 (setq gdb-all-registers t) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2348 (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
|
2349 (setq mode-name "Registers:All"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2350 (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
|
2351 (if gdb-all-registers "en" "dis"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2352 (gdb-invalidate-registers))) |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2353 |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2354 |
59808 | 2355 ;; Memory buffer. |
2356 ;; | |
2357 (defcustom gdb-memory-repeat-count 32 | |
2358 "Number of data items in memory window." | |
2359 :type 'integer | |
2360 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2361 :version "22.1") |
59808 | 2362 |
2363 (defcustom gdb-memory-format "x" | |
2364 "Display format of data items in memory window." | |
2365 :type '(choice (const :tag "Hexadecimal" "x") | |
2366 (const :tag "Signed decimal" "d") | |
2367 (const :tag "Unsigned decimal" "u") | |
2368 (const :tag "Octal" "o") | |
2369 (const :tag "Binary" "t")) | |
2370 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2371 :version "22.1") |
59808 | 2372 |
2373 (defcustom gdb-memory-unit "w" | |
2374 "Unit size of data items in memory window." | |
2375 :type '(choice (const :tag "Byte" "b") | |
2376 (const :tag "Halfword" "h") | |
2377 (const :tag "Word" "w") | |
2378 (const :tag "Giant word" "g")) | |
2379 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2380 :version "22.1") |
59808 | 2381 |
2382 (gdb-set-buffer-rules 'gdb-memory-buffer | |
2383 'gdb-memory-buffer-name | |
2384 'gdb-memory-mode) | |
2385 | |
2386 (def-gdb-auto-updated-buffer gdb-memory-buffer | |
2387 gdb-invalidate-memory | |
2388 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count) | |
2389 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n") | |
2390 gdb-read-memory-handler | |
2391 gdb-read-memory-custom) | |
2392 | |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2393 (defun gdb-read-memory-custom () |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2394 (save-excursion |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2395 (goto-char (point-min)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2396 (if (looking-at "0x[[:xdigit:]]+") |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2397 (setq gdb-memory-address (match-string 0))))) |
59808 | 2398 |
2399 (defvar gdb-memory-mode-map | |
2400 (let ((map (make-sparse-keymap))) | |
2401 (suppress-keymap map) | |
2402 (define-key map "q" 'kill-this-buffer) | |
2403 map)) | |
2404 | |
2405 (defun gdb-memory-set-address (event) | |
2406 "Set the start memory address." | |
2407 (interactive "e") | |
2408 (save-selected-window | |
2409 (select-window (posn-window (event-start event))) | |
2410 (let ((arg (read-from-minibuffer "Memory address: "))) | |
2411 (setq gdb-memory-address arg)) | |
2412 (gdb-invalidate-memory))) | |
2413 | |
2414 (defun gdb-memory-set-repeat-count (event) | |
2415 "Set the number of data items in memory window." | |
2416 (interactive "e") | |
2417 (save-selected-window | |
2418 (select-window (posn-window (event-start event))) | |
2419 (let* ((arg (read-from-minibuffer "Repeat count: ")) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2420 (count (string-to-number arg))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2421 (if (<= count 0) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2422 (error "Positive numbers only") |
59808 | 2423 (customize-set-variable 'gdb-memory-repeat-count count) |
2424 (gdb-invalidate-memory))))) | |
2425 | |
2426 (defun gdb-memory-format-binary () | |
2427 "Set the display format to binary." | |
2428 (interactive) | |
2429 (customize-set-variable 'gdb-memory-format "t") | |
2430 (gdb-invalidate-memory)) | |
2431 | |
2432 (defun gdb-memory-format-octal () | |
2433 "Set the display format to octal." | |
2434 (interactive) | |
2435 (customize-set-variable 'gdb-memory-format "o") | |
2436 (gdb-invalidate-memory)) | |
2437 | |
2438 (defun gdb-memory-format-unsigned () | |
2439 "Set the display format to unsigned decimal." | |
2440 (interactive) | |
2441 (customize-set-variable 'gdb-memory-format "u") | |
2442 (gdb-invalidate-memory)) | |
2443 | |
2444 (defun gdb-memory-format-signed () | |
2445 "Set the display format to decimal." | |
2446 (interactive) | |
2447 (customize-set-variable 'gdb-memory-format "d") | |
2448 (gdb-invalidate-memory)) | |
2449 | |
2450 (defun gdb-memory-format-hexadecimal () | |
2451 "Set the display format to hexadecimal." | |
2452 (interactive) | |
2453 (customize-set-variable 'gdb-memory-format "x") | |
2454 (gdb-invalidate-memory)) | |
2455 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2456 (defvar gdb-memory-format-map |
59808 | 2457 (let ((map (make-sparse-keymap))) |
2458 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) | |
2459 map) | |
2460 "Keymap to select format in the header line.") | |
2461 | |
2462 (defvar gdb-memory-format-menu (make-sparse-keymap "Format") | |
2463 "Menu of display formats in the header line.") | |
2464 | |
2465 (define-key gdb-memory-format-menu [binary] | |
2466 '(menu-item "Binary" gdb-memory-format-binary | |
2467 :button (:radio . (equal gdb-memory-format "t")))) | |
2468 (define-key gdb-memory-format-menu [octal] | |
2469 '(menu-item "Octal" gdb-memory-format-octal | |
2470 :button (:radio . (equal gdb-memory-format "o")))) | |
2471 (define-key gdb-memory-format-menu [unsigned] | |
2472 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned | |
2473 :button (:radio . (equal gdb-memory-format "u")))) | |
2474 (define-key gdb-memory-format-menu [signed] | |
2475 '(menu-item "Signed Decimal" gdb-memory-format-signed | |
2476 :button (:radio . (equal gdb-memory-format "d")))) | |
2477 (define-key gdb-memory-format-menu [hexadecimal] | |
2478 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal | |
2479 :button (:radio . (equal gdb-memory-format "x")))) | |
2480 | |
2481 (defun gdb-memory-format-menu (event) | |
2482 (interactive "@e") | |
2483 (x-popup-menu event gdb-memory-format-menu)) | |
2484 | |
2485 (defun gdb-memory-format-menu-1 (event) | |
2486 (interactive "e") | |
2487 (save-selected-window | |
2488 (select-window (posn-window (event-start event))) | |
2489 (let* ((selection (gdb-memory-format-menu event)) | |
2490 (binding (and selection (lookup-key gdb-memory-format-menu | |
2491 (vector (car selection)))))) | |
2492 (if binding (call-interactively binding))))) | |
2493 | |
2494 (defun gdb-memory-unit-giant () | |
2495 "Set the unit size to giant words (eight bytes)." | |
2496 (interactive) | |
2497 (customize-set-variable 'gdb-memory-unit "g") | |
2498 (gdb-invalidate-memory)) | |
2499 | |
2500 (defun gdb-memory-unit-word () | |
2501 "Set the unit size to words (four bytes)." | |
2502 (interactive) | |
2503 (customize-set-variable 'gdb-memory-unit "w") | |
2504 (gdb-invalidate-memory)) | |
2505 | |
2506 (defun gdb-memory-unit-halfword () | |
2507 "Set the unit size to halfwords (two bytes)." | |
2508 (interactive) | |
2509 (customize-set-variable 'gdb-memory-unit "h") | |
2510 (gdb-invalidate-memory)) | |
2511 | |
2512 (defun gdb-memory-unit-byte () | |
2513 "Set the unit size to bytes." | |
2514 (interactive) | |
2515 (customize-set-variable 'gdb-memory-unit "b") | |
2516 (gdb-invalidate-memory)) | |
2517 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2518 (defvar gdb-memory-unit-map |
59808 | 2519 (let ((map (make-sparse-keymap))) |
2520 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) | |
2521 map) | |
2522 "Keymap to select units in the header line.") | |
2523 | |
2524 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit") | |
2525 "Menu of units in the header line.") | |
2526 | |
2527 (define-key gdb-memory-unit-menu [giantwords] | |
2528 '(menu-item "Giant words" gdb-memory-unit-giant | |
2529 :button (:radio . (equal gdb-memory-unit "g")))) | |
2530 (define-key gdb-memory-unit-menu [words] | |
2531 '(menu-item "Words" gdb-memory-unit-word | |
2532 :button (:radio . (equal gdb-memory-unit "w")))) | |
2533 (define-key gdb-memory-unit-menu [halfwords] | |
2534 '(menu-item "Halfwords" gdb-memory-unit-halfword | |
2535 :button (:radio . (equal gdb-memory-unit "h")))) | |
2536 (define-key gdb-memory-unit-menu [bytes] | |
2537 '(menu-item "Bytes" gdb-memory-unit-byte | |
2538 :button (:radio . (equal gdb-memory-unit "b")))) | |
2539 | |
2540 (defun gdb-memory-unit-menu (event) | |
2541 (interactive "@e") | |
2542 (x-popup-menu event gdb-memory-unit-menu)) | |
2543 | |
2544 (defun gdb-memory-unit-menu-1 (event) | |
2545 (interactive "e") | |
2546 (save-selected-window | |
2547 (select-window (posn-window (event-start event))) | |
2548 (let* ((selection (gdb-memory-unit-menu event)) | |
2549 (binding (and selection (lookup-key gdb-memory-unit-menu | |
2550 (vector (car selection)))))) | |
2551 (if binding (call-interactively binding))))) | |
2552 | |
2553 ;;from make-mode-line-mouse-map | |
2554 (defun gdb-make-header-line-mouse-map (mouse function) "\ | |
2555 Return a keymap with single entry for mouse key MOUSE on the header line. | |
2556 MOUSE is defined to run function FUNCTION with no args in the buffer | |
2557 corresponding to the mode line clicked." | |
2558 (let ((map (make-sparse-keymap))) | |
2559 (define-key map (vector 'header-line mouse) function) | |
2560 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) | |
2561 map)) | |
2562 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2563 (defvar gdb-memory-font-lock-keywords |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2564 '(;; <__function.name+n> |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2565 ("<\\(\\(\\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
|
2566 ) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2567 "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
|
2568 |
59808 | 2569 (defun gdb-memory-mode () |
2570 "Major mode for examining memory. | |
2571 | |
2572 \\{gdb-memory-mode-map}" | |
2573 (kill-all-local-variables) | |
2574 (setq major-mode 'gdb-memory-mode) | |
2575 (setq mode-name "Memory") | |
2576 (setq buffer-read-only t) | |
2577 (use-local-map gdb-memory-mode-map) | |
2578 (setq header-line-format | |
2579 '(:eval | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2580 (concat |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2581 "Read address[" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2582 (propertize |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2583 "-" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2584 'face font-lock-warning-face |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2585 'help-echo "mouse-1: Decrement address" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2586 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2587 'local-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2588 (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2589 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2590 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2591 (let ((gdb-memory-address |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2592 ;; Let GDB do the arithmetic. |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2593 (concat |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2594 gdb-memory-address " - " |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2595 (number-to-string |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2596 (* gdb-memory-repeat-count |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2597 (cond ((string= gdb-memory-unit "b") 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2598 ((string= gdb-memory-unit "h") 2) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2599 ((string= gdb-memory-unit "w") 4) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2600 ((string= gdb-memory-unit "g") 8))))))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2601 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2602 "|" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2603 (propertize "+" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2604 'face font-lock-warning-face |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2605 'help-echo "mouse-1: Increment address" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2606 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2607 'local-map (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2608 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2609 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2610 (let ((gdb-memory-address nil)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2611 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2612 "]: " |
59808 | 2613 (propertize gdb-memory-address |
2614 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2615 'help-echo "mouse-1: Set memory address" |
62716 | 2616 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2617 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2618 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2619 #'gdb-memory-set-address)) |
59808 | 2620 " Repeat Count: " |
2621 (propertize (number-to-string gdb-memory-repeat-count) | |
2622 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2623 'help-echo "mouse-1: Set repeat count" |
62716 | 2624 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2625 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2626 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2627 #'gdb-memory-set-repeat-count)) |
59808 | 2628 " Display Format: " |
2629 (propertize gdb-memory-format | |
2630 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2631 'help-echo "mouse-3: Select display format" |
62716 | 2632 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2633 'local-map gdb-memory-format-map) |
59808 | 2634 " Unit Size: " |
2635 (propertize gdb-memory-unit | |
2636 'face font-lock-warning-face | |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2637 'help-echo "mouse-3: Select unit size" |
62716 | 2638 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2639 '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
|
2640 (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
|
2641 '(gdb-memory-font-lock-keywords)) |
59808 | 2642 (run-mode-hooks 'gdb-memory-mode-hook) |
2643 'gdb-invalidate-memory) | |
2644 | |
2645 (defun gdb-memory-buffer-name () | |
2646 (with-current-buffer gud-comint-buffer | |
2647 (concat "*memory of " (gdb-get-target-string) "*"))) | |
2648 | |
2649 (defun gdb-display-memory-buffer () | |
2650 "Display memory contents." | |
2651 (interactive) | |
2652 (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
|
2653 (gdb-get-buffer-create 'gdb-memory-buffer) t)) |
59808 | 2654 |
2655 (defun gdb-frame-memory-buffer () | |
2656 "Display memory contents in a new frame." | |
2657 (interactive) | |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2658 (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
|
2659 (special-display-frame-alist |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2660 (cons '(left-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2661 (cons '(right-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2662 (cons '(width . 83) gdb-frame-parameters))))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2663 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) |
54538 | 2664 |
59808 | 2665 |
54538 | 2666 ;; Locals buffer. |
2667 ;; | |
2668 (gdb-set-buffer-rules 'gdb-locals-buffer | |
2669 'gdb-locals-buffer-name | |
2670 'gdb-locals-mode) | |
2671 | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2672 (def-gdb-auto-update-trigger gdb-invalidate-locals |
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2673 (gdb-get-buffer 'gdb-locals-buffer) |
54538 | 2674 "server info locals\n" |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2675 gdb-info-locals-handler) |
54538 | 2676 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2677 (defvar gdb-locals-watch-map |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2678 (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
|
2679 (suppress-keymap map) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2680 (define-key map "\r" (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2681 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2682 (gud-watch))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2683 (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
|
2684 (mouse-set-point event) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2685 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2686 (gud-watch))) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2687 map) |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2688 "Keymap to create watch expression of a complex data type local variable.") |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2689 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2690 (defconst gdb-struct-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2691 (concat (propertize "[struct/union]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2692 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2693 '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
|
2694 '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
|
2695 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2696 (defconst gdb-array-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2697 (concat " " (propertize "[array]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2698 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2699 '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
|
2700 '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
|
2701 |
54538 | 2702 ;; Abbreviate for arrays and structures. |
2703 ;; 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
|
2704 (defun gdb-info-locals-handler () |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2705 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2706 gdb-pending-triggers)) |
54538 | 2707 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer))) |
2708 (with-current-buffer buf | |
2709 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2710 (while (re-search-forward "^[ }].*\n" nil t) |
54538 | 2711 (replace-match "" nil nil)) |
2712 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2713 (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
|
2714 (replace-match gdb-struct-string nil nil)) |
54538 | 2715 (goto-char (point-min)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2716 (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
|
2717 (replace-match gdb-array-string nil nil)))) |
54538 | 2718 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2719 (and buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2720 (with-current-buffer buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2721 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2722 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2723 (p (window-point window)) |
54538 | 2724 (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
|
2725 (erase-buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2726 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 2727 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2728 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2729 (set-window-point window p)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2730 ))) |
54538 | 2731 (run-hooks 'gdb-info-locals-hook)) |
2732 | |
2733 (defvar gdb-locals-mode-map | |
2734 (let ((map (make-sparse-keymap))) | |
2735 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2736 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2737 map)) |
54538 | 2738 |
2739 (defun gdb-locals-mode () | |
2740 "Major mode for gdb locals. | |
2741 | |
2742 \\{gdb-locals-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2743 (kill-all-local-variables) |
54538 | 2744 (setq major-mode 'gdb-locals-mode) |
62716 | 2745 (setq mode-name (concat "Locals:" gdb-selected-frame)) |
54538 | 2746 (setq buffer-read-only t) |
2747 (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
|
2748 (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
|
2749 '(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
|
2750 (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
|
2751 (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
|
2752 (string-equal gdb-version "pre-6.4")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2753 'gdb-invalidate-locals |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2754 'gdb-invalidate-locals-1)) |
54538 | 2755 |
2756 (defun gdb-locals-buffer-name () | |
2757 (with-current-buffer gud-comint-buffer | |
2758 (concat "*locals of " (gdb-get-target-string) "*"))) | |
2759 | |
2760 (defun gdb-display-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2761 "Display local variables of current stack and their values." |
54538 | 2762 (interactive) |
2763 (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
|
2764 (gdb-get-buffer-create 'gdb-locals-buffer) t)) |
54538 | 2765 |
2766 (defun gdb-frame-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2767 "Display local variables of current stack and their values in a new frame." |
54538 | 2768 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2769 (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
|
2770 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2771 (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer)))) |
54538 | 2772 |
2773 | |
2774 ;;;; 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
|
2775 (defun gdb-display-buffer (buf dedicated &optional size) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2776 (let ((answer (get-buffer-window buf 0)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2777 (must-split nil)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2778 (if answer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2779 (display-buffer buf nil 0) ;Raise the frame if necessary. |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2780 ;; The buffer is not yet displayed. |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2781 (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
|
2782 (let ((window (get-lru-window))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2783 (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
|
2784 (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
|
2785 ,gdb-source-window)))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2786 (progn |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2787 (set-window-buffer window buf) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2788 (setq answer window)) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2789 (setq must-split t))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2790 (if must-split |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2791 (let* ((largest (get-largest-window)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2792 (cur-size (window-height largest)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2793 (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
|
2794 (setq answer (split-window largest new-size)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2795 (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
|
2796 (set-window-dedicated-p answer dedicated))) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2797 answer))) |
54538 | 2798 |
2799 | |
2800 ;;; Shared keymap initialization: | |
2801 | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2802 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2803 (define-key gud-menu-map [displays] |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2804 `(menu-item "GDB-Windows" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2805 :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
|
2806 (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
|
2807 (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
|
2808 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2809 '(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
|
2810 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2811 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2812 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2813 (define-key menu [disassembly] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2814 '("Disassembly" . gdb-display-assembler-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2815 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2816 '("Breakpoints" . gdb-display-breakpoints-buffer)) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2817 (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
|
2818 (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
|
2819 |
54538 | 2820 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
2821 (define-key gud-menu-map [frames] | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2822 `(menu-item "GDB-Frames" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2823 :visible (memq gud-minor-mode '(gdbmi gdba)))) |
54538 | 2824 (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
|
2825 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
59808 | 2826 (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
|
2827 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2828 '(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
|
2829 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2830 (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
|
2831 (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
|
2832 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2833 '("Breakpoints" . gdb-frame-breakpoints-buffer)) |
54538 | 2834 (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
|
2835 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))) |
54538 | 2836 |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
2837 (let ((menu (make-sparse-keymap "GDB-UI/MI"))) |
54538 | 2838 (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
|
2839 `(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
|
2840 ,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
|
2841 (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
|
2842 '(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
|
2843 :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
|
2844 :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
|
2845 :button (:toggle . gdb-find-source-frame))) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2846 (define-key menu [gdb-use-separate-io] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2847 '(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
|
2848 :visible (eq gud-minor-mode 'gdba) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2849 :help "Toggle separate IO for debugged program." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2850 :button (:toggle . gdb-use-separate-io-buffer))) |
54538 | 2851 (define-key menu [gdb-many-windows] |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2852 '(menu-item "Display Other Windows" gdb-many-windows |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2853 :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
|
2854 :button (:toggle . gdb-many-windows))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2855 (define-key menu [gdb-restore-windows] |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2856 '(menu-item "Restore Window Layout" gdb-restore-windows |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2857 :help "Restore standard layout for debug session."))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2858 |
54538 | 2859 (defun gdb-frame-gdb-buffer () |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2860 "Display GUD buffer in a new frame." |
54538 | 2861 (interactive) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2862 (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
|
2863 (special-display-frame-alist |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
2864 (remove '(menu-bar-lines) (remove '(tool-bar-lines) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
2865 gdb-frame-parameters))) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2866 (same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2867 (display-buffer gud-comint-buffer))) |
54538 | 2868 |
2869 (defun gdb-display-gdb-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2870 "Display GUD buffer." |
54538 | 2871 (interactive) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2872 (let ((same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2873 (pop-to-buffer gud-comint-buffer))) |
54538 | 2874 |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2875 (defun gdb-set-window-buffer (name) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2876 (set-window-buffer (selected-window) (get-buffer name)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2877 (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
|
2878 |
54538 | 2879 (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
|
2880 "Layout the window pattern for `gdb-many-windows'." |
54538 | 2881 (gdb-display-locals-buffer) |
2882 (gdb-display-stack-buffer) | |
2883 (delete-other-windows) | |
2884 (gdb-display-breakpoints-buffer) | |
2885 (delete-other-windows) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2886 ; Don't dedicate. |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2887 (pop-to-buffer gud-comint-buffer) |
54538 | 2888 (split-window nil ( / ( * (window-height) 3) 4)) |
2889 (split-window nil ( / (window-height) 3)) | |
2890 (split-window-horizontally) | |
2891 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2892 (gdb-set-window-buffer (gdb-locals-buffer-name)) |
54538 | 2893 (other-window 1) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2894 (switch-to-buffer |
54538 | 2895 (if gud-last-last-frame |
2896 (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
|
2897 (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
|
2898 (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
|
2899 ;; 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
|
2900 ;; 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
|
2901 (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
|
2902 (setq gdb-source-window (selected-window)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2903 (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
|
2904 (split-window-horizontally) |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
2905 (other-window 1) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2906 (gdb-set-window-buffer |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2907 (gdb-get-buffer-create 'gdb-inferior-io))) |
54538 | 2908 (other-window 1) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2909 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
54538 | 2910 (split-window-horizontally) |
2911 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2912 (gdb-set-window-buffer (gdb-breakpoints-buffer-name)) |
54538 | 2913 (other-window 1)) |
2914 | |
2915 (defun gdb-restore-windows () | |
2916 "Restore the basic arrangement of windows used by gdba. | |
2917 This arrangement depends on the value of `gdb-many-windows'." | |
2918 (interactive) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2919 (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
|
2920 (delete-other-windows) |
54538 | 2921 (if gdb-many-windows |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2922 (gdb-setup-windows) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2923 (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
|
2924 (split-window) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2925 (other-window 1) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2926 (switch-to-buffer |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2927 (if gud-last-last-frame |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2928 (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
|
2929 (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
|
2930 (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
|
2931 (other-window 1)))) |
54538 | 2932 |
2933 (defun gdb-reset () | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
2934 "Exit a debugging session cleanly. |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
2935 Kills the gdb buffers, and resets variables and the source buffers." |
54538 | 2936 (dolist (buffer (buffer-list)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2937 (unless (eq buffer gud-comint-buffer) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2938 (with-current-buffer buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2939 (if (memq gud-minor-mode '(gdbmi gdba)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2940 (if (string-match "\\`\\*.+\\*\\'" (buffer-name)) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2941 (kill-buffer nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2942 (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
|
2943 (setq gud-minor-mode nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
2944 (kill-local-variable 'tool-bar-map) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2945 (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
|
2946 (setq gdb-overlay-arrow-position nil) |
54538 | 2947 (setq overlay-arrow-variable-list |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2948 (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
|
2949 (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
|
2950 (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
|
2951 (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
|
2952 (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
|
2953 (if (boundp 'speedbar-frame) (speedbar-timer-fn)) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2954 (setq gud-running nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2955 (setq gdb-active-process nil) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2956 (setq gdb-var-list nil) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2957 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) |
54538 | 2958 |
2959 (defun gdb-source-info () | |
2960 "Find the source file where the program starts and displays it with related | |
2961 buffers." | |
2962 (goto-char (point-min)) | |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2963 (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
|
2964 (looking-at "\\S-+")) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2965 (setq gdb-main-file (match-string 0))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2966 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2967 (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
|
2968 (setq gdb-macro-info t)) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2969 (if gdb-many-windows |
54538 | 2970 (gdb-setup-windows) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2971 (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
|
2972 (if gdb-show-main |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2973 (let ((pop-up-windows t)) |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
2974 (display-buffer (gud-find-file gdb-main-file)))))) |
54538 | 2975 |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2976 (defun gdb-get-location (bptno line flag) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2977 "Find the directory containing the relevant source file. |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2978 Put in buffer and place breakpoint icon." |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2979 (goto-char (point-min)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2980 (catch 'file-not-found |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2981 (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
|
2982 (when (looking-at "\\S-+") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2983 (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
|
2984 (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
|
2985 (gdb-resync) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2986 (unless (assoc bptno gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
2987 (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
|
2988 (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
|
2989 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
|
2990 (throw 'file-not-found nil)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2991 (with-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2992 (find-file-noselect (match-string 0)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2993 (save-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2994 (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
|
2995 (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
|
2996 ;; 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
|
2997 (save-excursion |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2998 (goto-line (string-to-number line)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
2999 (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
|
3000 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3001 (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
|
3002 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3003 (defun gdb-find-file-hook () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3004 "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
|
3005 of the current session." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3006 (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
|
3007 ;; 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
|
3008 gud-comint-buffer |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3009 (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
|
3010 '(gdba gdbmi))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3011 ;;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
|
3012 (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
|
3013 (file-name-nondirectory buffer-file-name) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3014 buffer-file-name) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3015 gdb-source-file-list) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3016 (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
|
3017 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3018 (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
|
3019 (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
|
3020 |
54538 | 3021 ;;from put-image |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3022 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) |
54538 | 3023 "Put string PUTSTRING in front of POS in the current buffer. |
3024 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
|
3025 `before-string' string that has a `display' property whose value is |
54538 | 3026 PUTSTRING." |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3027 (let ((string (make-string 1 ?x)) |
54538 | 3028 (buffer (current-buffer))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3029 (setq putstring (copy-sequence putstring)) |
54538 | 3030 (let ((overlay (make-overlay pos pos buffer)) |
3031 (prop (or dprop | |
3032 (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
|
3033 (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
|
3034 (if sprops |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3035 (add-text-properties 0 1 sprops string)) |
54538 | 3036 (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
|
3037 (overlay-put overlay 'before-string string)))) |
54538 | 3038 |
3039 ;;from remove-images | |
3040 (defun gdb-remove-strings (start end &optional buffer) | |
3041 "Remove strings between START and END in BUFFER. | |
3042 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. | |
3043 BUFFER nil or omitted means use the current buffer." | |
3044 (unless buffer | |
3045 (setq buffer (current-buffer))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3046 (dolist (overlay (overlays-in start end)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
3047 (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
|
3048 (delete-overlay overlay)))) |
54538 | 3049 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3050 (defun gdb-put-breakpoint-icon (enabled bptno) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
3051 (let ((start (- (line-beginning-position) 1)) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
3052 (end (+ (line-end-position) 1)) |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3053 (putstring (if enabled "B" "b")) |
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3054 (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
|
3055 (add-text-properties |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3056 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
|
3057 putstring) |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3058 (if enabled |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3059 (add-text-properties |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3060 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
|
3061 (add-text-properties |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3062 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) |
54538 | 3063 (gdb-remove-breakpoint-icons start end) |
3064 (if (display-images-p) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3065 (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
|
3066 (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
|
3067 gdb-buffer-fringe-width) 8) |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3068 (gdb-put-string |
54538 | 3069 nil (1+ start) |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
3070 `(left-fringe breakpoint |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3071 ,(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
|
3072 'breakpoint-enabled |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3073 'breakpoint-disabled)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3074 'gdb-bptno bptno |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3075 'gdb-enabled enabled) |
54538 | 3076 (when (< left-margin-width 2) |
3077 (save-current-buffer | |
3078 (setq left-margin-width 2) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3079 (if source-window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
3080 (set-window-margins |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3081 source-window |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
3082 left-margin-width right-margin-width)))) |
54538 | 3083 (put-image |
3084 (if enabled | |
3085 (or breakpoint-enabled-icon | |
3086 (setq breakpoint-enabled-icon | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3087 (find-image `((:type xpm :data |
54538 | 3088 ,breakpoint-xpm-data |
3089 :ascent 100 :pointer hand) | |
3090 (:type pbm :data | |
3091 ,breakpoint-enabled-pbm-data | |
3092 :ascent 100 :pointer hand))))) | |
3093 (or breakpoint-disabled-icon | |
3094 (setq breakpoint-disabled-icon | |
3095 (find-image `((:type xpm :data | |
3096 ,breakpoint-xpm-data | |
3097 :conversion disabled | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3098 :ascent 100 :pointer hand) |
54538 | 3099 (:type pbm :data |
3100 ,breakpoint-disabled-pbm-data | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3101 :ascent 100 :pointer hand)))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3102 (+ start 1) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3103 putstring |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3104 'left-margin)) |
54538 | 3105 (when (< left-margin-width 2) |
3106 (save-current-buffer | |
3107 (setq left-margin-width 2) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3108 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3109 (if window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
3110 (set-window-margins |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3111 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
|
3112 (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
|
3113 (propertize putstring |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
3114 '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
|
3115 (1+ start))))) |
54538 | 3116 |
3117 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin) | |
3118 (gdb-remove-strings start end) | |
3119 (if (display-images-p) | |
3120 (remove-images start end)) | |
3121 (when remove-margin | |
3122 (setq left-margin-width 0) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3123 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3124 (if window |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3125 (set-window-margins |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3126 window left-margin-width right-margin-width))))) |
54538 | 3127 |
3128 | |
3129 ;; | |
3130 ;; Assembler buffer. | |
3131 ;; | |
3132 (gdb-set-buffer-rules 'gdb-assembler-buffer | |
3133 'gdb-assembler-buffer-name | |
3134 'gdb-assembler-mode) | |
3135 | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3136 ;; 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
|
3137 ;; 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
|
3138 (defun gdb-assembler-handler () |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3139 (setq gdb-pending-triggers |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3140 (delq 'gdb-invalidate-assembler |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3141 gdb-pending-triggers)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3142 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3143 (and buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3144 (with-current-buffer buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3145 (let* ((window (get-buffer-window buf 0)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3146 (p (window-point window)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3147 (buffer-read-only nil)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3148 (erase-buffer) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3149 (insert-buffer-substring (gdb-get-buffer-create |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3150 'gdb-partial-output-buffer)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3151 (set-window-point window p))))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3152 ;; put customisation here |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3153 (gdb-assembler-custom)) |
54538 | 3154 |
3155 (defun gdb-assembler-custom () | |
3156 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) | |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3157 (pos 1) (address) (flag) (bptno)) |
54538 | 3158 (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
|
3159 (save-excursion |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3160 (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
|
3161 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3162 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3163 (if (and gdb-pc-address |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3164 (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
|
3165 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3166 (setq pos (point)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3167 (beginning-of-line) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3168 (setq fringe-indicator-alist |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3169 (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
|
3170 nil |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3171 '((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
|
3172 (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
|
3173 (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
|
3174 (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
|
3175 ;; 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
|
3176 (gdb-remove-breakpoint-icons (point-min) (point-max)))) |
54538 | 3177 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
3178 (goto-char (point-min)) | |
3179 (while (< (point) (- (point-max) 1)) | |
3180 (forward-line 1) | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
3181 (if (looking-at "[^\t].*?breakpoint") |
54538 | 3182 (progn |
3183 (looking-at | |
62716 | 3184 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)\\s-+0x0*\\(\\S-+\\)") |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3185 (setq bptno (match-string 1)) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3186 (setq flag (char-after (match-beginning 2))) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3187 (setq address (match-string 3)) |
54538 | 3188 (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
|
3189 (save-excursion |
54538 | 3190 (goto-char (point-min)) |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
3191 (if (search-forward address nil t) |
62845
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3192 (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
|
3193 (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
|
3194 (with-current-buffer buffer |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
3195 (set-window-point (get-buffer-window buffer 0) pos))))) |
54538 | 3196 |
3197 (defvar gdb-assembler-mode-map | |
3198 (let ((map (make-sparse-keymap))) | |
3199 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3200 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3201 map)) |
54538 | 3202 |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3203 (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
|
3204 '(;; <__function.name+n> |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3205 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3206 (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
|
3207 ;; 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
|
3208 ("^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
|
3209 (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
|
3210 ;; %register(at least i386) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3211 ("%\\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
|
3212 ("^\\(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
|
3213 (1 font-lock-comment-face) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3214 (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
|
3215 ("^\\(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
|
3216 "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
|
3217 |
54538 | 3218 (defun gdb-assembler-mode () |
3219 "Major mode for viewing code assembler. | |
3220 | |
3221 \\{gdb-assembler-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3222 (kill-all-local-variables) |
54538 | 3223 (setq major-mode 'gdb-assembler-mode) |
62716 | 3224 (setq mode-name (concat "Machine:" gdb-selected-frame)) |
54538 | 3225 (setq gdb-overlay-arrow-position nil) |
3226 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position) | |
3227 (setq fringes-outside-margins t) | |
3228 (setq buffer-read-only t) | |
3229 (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
|
3230 (gdb-invalidate-assembler) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3231 (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
|
3232 '(gdb-assembler-font-lock-keywords)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3233 (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
|
3234 'gdb-invalidate-assembler) |
54538 | 3235 |
3236 (defun gdb-assembler-buffer-name () | |
3237 (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
|
3238 (concat "*disassembly of " (gdb-get-target-string) "*"))) |
54538 | 3239 |
3240 (defun gdb-display-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3241 "Display disassembly view." |
54538 | 3242 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3243 (setq gdb-previous-frame nil) |
54538 | 3244 (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
|
3245 (gdb-get-buffer-create 'gdb-assembler-buffer) t)) |
54538 | 3246 |
3247 (defun gdb-frame-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3248 "Display disassembly view in a new frame." |
54538 | 3249 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3250 (setq gdb-previous-frame nil) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
3251 (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
|
3252 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3253 (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer)))) |
54538 | 3254 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3255 ;; modified because if gdb-pc-address has changed value a new command |
54538 | 3256 ;; must be enqueued to update the buffer with the new output |
3257 (defun gdb-invalidate-assembler (&optional ignored) | |
3258 (if (gdb-get-buffer 'gdb-assembler-buffer) | |
3259 (progn | |
62716 | 3260 (unless (and gdb-selected-frame |
3261 (string-equal gdb-selected-frame gdb-previous-frame)) | |
54538 | 3262 (if (or (not (member 'gdb-invalidate-assembler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3263 gdb-pending-triggers)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3264 (not (string-equal gdb-pc-address |
62716 | 3265 gdb-previous-frame-address))) |
54538 | 3266 (progn |
62716 | 3267 ;; take previous disassemble command, if any, off the queue |
54538 | 3268 (with-current-buffer gud-comint-buffer |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3269 (let ((queue gdb-input-queue)) |
54538 | 3270 (dolist (item queue) |
3271 (if (equal (cdr item) '(gdb-assembler-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3272 (setq gdb-input-queue |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3273 (delete item gdb-input-queue)))))) |
54538 | 3274 (gdb-enqueue-input |
62716 | 3275 (list |
3276 (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
|
3277 (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
|
3278 gdb-pc-address "\n") |
54538 | 3279 'gdb-assembler-handler)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3280 (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
|
3281 (setq gdb-previous-frame-address gdb-pc-address) |
62716 | 3282 (setq gdb-previous-frame gdb-selected-frame))))))) |
54538 | 3283 |
62716 | 3284 (defun gdb-get-selected-frame () |
3285 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers)) | |
54538 | 3286 (progn |
3287 (gdb-enqueue-input | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3288 (list (concat gdb-server-prefix "info frame\n") 'gdb-frame-handler)) |
62716 | 3289 (push 'gdb-get-selected-frame |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3290 gdb-pending-triggers)))) |
54538 | 3291 |
3292 (defun gdb-frame-handler () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3293 (setq gdb-pending-triggers |
62716 | 3294 (delq 'gdb-get-selected-frame gdb-pending-triggers)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3295 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3296 (when (re-search-forward |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3297 "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
|
3298 (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
|
3299 (setq gdb-frame-address (match-string 2))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3300 (goto-char (point-min)) |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
3301 (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
|
3302 \\(?: (\\(\\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
|
3303 nil t) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3304 (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
|
3305 (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
|
3306 (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
|
3307 (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
|
3308 (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
|
3309 (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
|
3310 (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
|
3311 (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
|
3312 (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
|
3313 (let ((buffer (marker-buffer gud-overlay-arrow-position)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3314 (position (marker-position gud-overlay-arrow-position))) |
70372
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3315 (when (and buffer |
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3316 (string-equal (buffer-name buffer) |
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3317 (file-name-nondirectory (match-string 3)))) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3318 (with-current-buffer buffer |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3319 (setq fringe-indicator-alist |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3320 (if (string-equal gdb-frame-number "0") |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3321 nil |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3322 '((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
|
3323 (set-marker gud-overlay-arrow-position position)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3324 (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
|
3325 (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
|
3326 (setq gdb-current-language (match-string 1))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3327 (gdb-invalidate-assembler)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3328 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3329 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3330 ;; Code specific to GDB 6.4 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3331 (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
|
3332 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3333 (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
|
3334 "Create list of source files for current GDB session. |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3335 If buffers already exist for any of these files, gud-minor-mode |
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3336 is set in them." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3337 (goto-char (point-min)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3338 (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
|
3339 (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
|
3340 (dolist (buffer (buffer-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3341 (with-current-buffer buffer |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3342 (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
|
3343 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3344 (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
|
3345 (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
|
3346 (when gud-tooltip-mode |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3347 (make-local-variable 'gdb-define-alist) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3348 (gdb-create-define-alist) |
71277
99ed754e8f50
(gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
71113
diff
changeset
|
3349 (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
|
3350 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
3351 (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
|
3352 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3353 ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3354 (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
|
3355 (gdb-enqueue-input |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3356 (list |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3357 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3358 (concat "server interpreter mi \"-var-list-children --all-values " |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3359 varnum "\"\n") |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3360 (concat "-var-list-children --all-values " varnum "\n")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3361 `(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
|
3362 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3363 (defconst gdb-var-list-children-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3364 "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3365 numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\ |
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3366 \\(}\\|,.*?\\(type=\"\\(.+?\\)\"\\)?.*?}\\)") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3367 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3368 (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
|
3369 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3370 (let ((var-list nil)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3371 (catch 'child-already-watched |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3372 (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
|
3373 (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
|
3374 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3375 (push var var-list) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3376 (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
|
3377 (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
|
3378 (match-string 2) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3379 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3380 (match-string 7) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3381 (read (match-string 4)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3382 nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3383 (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
|
3384 (throw 'child-already-watched nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3385 (push varchild var-list)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3386 (push var var-list))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3387 (setq gdb-var-list (nreverse var-list)))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3388 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3389 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3390 ; 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
|
3391 (defun gdb-var-update-1 () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3392 (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
|
3393 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3394 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3395 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3396 (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
|
3397 "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
|
3398 "-var-update --all-values *\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3399 'gdb-var-update-handler-1)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3400 (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
|
3401 |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
3402 (defconst gdb-var-update-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3403 "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3404 in_scope=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3405 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3406 (defun gdb-var-update-handler-1 () |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3407 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3408 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3409 (goto-char (point-min)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3410 (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
|
3411 (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
|
3412 (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
|
3413 (when var |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3414 (if (string-equal (match-string 3) "false") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3415 (setcar (nthcdr 5 var) 'out-of-scope) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3416 (setcar (nthcdr 5 var) 'changed) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3417 (setcar (nthcdr 4 var) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3418 (read (match-string 2))))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3419 (setq gdb-pending-triggers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3420 (delq 'gdb-var-update gdb-pending-triggers)) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3421 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3422 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3423 ;; Registers buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3424 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3425 (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
|
3426 'gdb-registers-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3427 'gdb-registers-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3428 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3429 (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
|
3430 (gdb-get-buffer 'gdb-registers-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3431 (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
|
3432 "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
|
3433 "-data-list-register-values x\n") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3434 gdb-data-list-register-values-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3435 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3436 (defconst gdb-data-list-register-values-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3437 "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3438 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3439 (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
|
3440 (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
|
3441 gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3442 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3443 (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
|
3444 (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
|
3445 (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
|
3446 (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
|
3447 (erase-buffer) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3448 (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
|
3449 (insert err) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3450 (goto-char (point-min))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3451 (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
|
3452 (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
|
3453 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3454 (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
|
3455 (setq register (pop register-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3456 (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
|
3457 (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
|
3458 (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
|
3459 'face 'font-lock-warning-face |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3460 register-string)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3461 (setq register-values |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3462 (concat register-values register-string))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3463 (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
|
3464 (with-current-buffer buf |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3465 (let* ((window (get-buffer-window buf 0)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3466 (start (window-start window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3467 (p (window-point window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3468 (buffer-read-only nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3469 (erase-buffer) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3470 (insert register-values) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3471 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3472 (set-window-point window p)))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3473 (gdb-data-list-register-values-custom)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3474 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3475 (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
|
3476 (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
|
3477 (save-excursion |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3478 (let ((buffer-read-only nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3479 start end) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3480 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3481 (while (< (point) (point-max)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3482 (setq start (line-beginning-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3483 (setq end (line-end-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3484 (when (looking-at "^[^\t]+") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3485 (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
|
3486 (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
|
3487 '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
|
3488 (add-text-properties start end |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3489 '(help-echo "mouse-2: edit value" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3490 mouse-face highlight)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3491 (forward-line 1)))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3492 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3493 ;; 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
|
3494 (defun gdb-get-changed-registers () |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3495 (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
|
3496 (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
|
3497 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3498 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3499 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3500 (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
|
3501 "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
|
3502 "-data-list-changed-registers\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3503 'gdb-get-changed-registers-handler)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3504 (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
|
3505 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3506 (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
|
3507 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3508 (defun gdb-get-changed-registers-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3509 (setq gdb-pending-triggers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3510 (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
|
3511 (setq gdb-changed-registers nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3512 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3513 (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
|
3514 (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
|
3515 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3516 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3517 ;; Locals buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3518 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3519 ;; 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
|
3520 (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
|
3521 'gdb-locals-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3522 'gdb-locals-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3523 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3524 (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
|
3525 (gdb-get-buffer 'gdb-locals-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3526 (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
|
3527 "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
|
3528 "-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
|
3529 gdb-stack-list-locals-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3530 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3531 (defconst gdb-stack-list-locals-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3532 "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3533 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3534 (defvar gdb-locals-watch-map-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3535 (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
|
3536 (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
|
3537 (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
|
3538 (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
|
3539 map) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3540 "Keymap to create watch expression of a complex data type local variable.") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3541 |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3542 (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
|
3543 (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
|
3544 (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
|
3545 (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
|
3546 (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
|
3547 map) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3548 "Keymap to edit value of a simple data type local variable.") |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3549 |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3550 (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
|
3551 "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
|
3552 (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
|
3553 (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
|
3554 (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
|
3555 (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
|
3556 (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
|
3557 (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
|
3558 (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
|
3559 (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
|
3560 '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
|
3561 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3562 ;; 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
|
3563 ;; 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
|
3564 (defun gdb-stack-list-locals-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3565 (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
|
3566 gdb-pending-triggers)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3567 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3568 (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
|
3569 (let ((err (match-string 1))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3570 (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
|
3571 (let ((buffer-read-only nil)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3572 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3573 (insert err) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3574 (goto-char (point-min))))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3575 (let (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3576 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3577 (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
|
3578 (let ((local (list (match-string 1) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3579 (match-string 2) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3580 nil))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3581 (if (looking-at ",value=\\(\".*\"\\).*?}") |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3582 (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
|
3583 (push local locals-list))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3584 (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
|
3585 (and buf (with-current-buffer buf |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3586 (let* ((window (get-buffer-window buf 0)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3587 (start (window-start window)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3588 (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
|
3589 (buffer-read-only nil) (name) (value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3590 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3591 (dolist (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3592 (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
|
3593 (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
|
3594 (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
|
3595 (string-match "^\\0x" value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3596 (add-text-properties 0 (length name) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3597 `(mouse-face highlight |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3598 help-echo "mouse-2: create watch expression" |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3599 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
|
3600 name) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3601 (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
|
3602 `(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
|
3603 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
|
3604 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
|
3605 value)) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3606 (insert |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3607 (concat name "\t" (nth 1 local) |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
3608 "\t" value "\n"))) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3609 (set-window-start window start) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3610 (set-window-point window p)))))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3611 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3612 (defun gdb-get-register-names () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3613 "Create a list of register names." |
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 (setq gdb-register-names nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3616 (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
|
3617 (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
|
3618 |
54538 | 3619 (provide 'gdb-ui) |
3620 | |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3621 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
54538 | 3622 ;;; gdb-ui.el ends here |