Mercurial > emacs
annotate lisp/progmodes/gdb-ui.el @ 79261:9963a1e6e29f
(gdb-delete-out-of-scope): New option.
(gdb-var-update-handler-1): Use it.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Tue, 30 Oct 2007 05:37:34 +0000 |
parents | ef2bf5b448b2 |
children | 7420ede9df33 d3e87ee5aa0e |
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 | |
75347 | 7 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 |
68773
dc49655f57ae
Update copyright for 2006.
Nick Roberts <nickrob@snap.net.nz>
parents:
68664
diff
changeset
|
8 ;; Free Software Foundation, Inc. |
54538 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
78234
c1ec1c8a8d2e
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
78112
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
54538 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
54538 | 26 |
27 ;;; Commentary: | |
28 | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
29 ;; This mode acts as a graphical user interface to GDB. You can interact with |
54538 | 30 ;; GDB through the GUD buffer in the usual way, but there are also further |
31 ;; buffers which control the execution and describe the state of your program. | |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
32 ;; It separates the input/output of your program from that of GDB, if |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
33 ;; required, and watches expressions in the speedbar. It also uses features of |
56258
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
34 ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar |
3b1880995ace
(gdb-toggle-breakpoint)
Nick Roberts <nickrob@snap.net.nz>
parents:
55850
diff
changeset
|
35 ;; (see the GDB Graphical Interface section in the Emacs info manual). |
54538 | 36 |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
37 ;; By default, M-x gdb will start the debugger. |
54538 | 38 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
39 ;; This file has evolved from gdba.el that was included with GDB 5.0 and |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
40 ;; written by Tom Lord and Jim Kingdon. It uses GDB's annotation interface. |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
41 ;; You don't need to know about annotations to use this mode as a debugger, |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
42 ;; but if you are interested developing the mode itself, see the Annotations |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
43 ;; section in the GDB info manual. |
67233
f8729e3300dc
(gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents:
67164
diff
changeset
|
44 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
45 ;; GDB developers plan to make the annotation interface obsolete. A new |
55850
63ca25eb73a1
(gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents:
55764
diff
changeset
|
46 ;; interface called GDB/MI (machine interface) has been designed to replace |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
47 ;; it. Some GDB/MI commands are used in this file through the CLI command |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
48 ;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included with |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
49 ;; GDB (6.2 onwards) that uses GDB/MI as the primary interface to GDB. It is |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
50 ;; still under development and is part of a process to migrate Emacs from |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
51 ;; annotations to GDB/MI. |
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
|
52 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
53 ;; 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
|
54 ;; 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
|
55 ;; 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
|
56 |
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 ;;; 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
|
58 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
59 ;; 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
|
60 ;; 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
|
61 ;; 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
|
62 ;; 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
|
63 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
64 ;; #ifdef UNBUFFERED |
64999
e1cdc6178b3e
(toggle-gdb-use-inferior-io-buffer):
Nick Roberts <nickrob@snap.net.nz>
parents:
64993
diff
changeset
|
65 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0); |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
66 ;; #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
|
67 |
64241
a19a23509f95
Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
68 ;; 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
|
69 |
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 ;;; 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
|
71 |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
72 ;; 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
|
73 ;; 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
|
74 ;; 2) Cannot handle multiple debug sessions. |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
75 ;; 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
|
76 ;; 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
|
77 ;; 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
|
78 ;; 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
|
79 ;; 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
|
80 ;; "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
|
81 ;; 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
|
82 ;; (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
|
83 |
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
84 ;;; Problems with watch expressions, GDB/MI: |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
85 |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
86 ;; 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
|
87 ;; 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
|
88 ;; 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
|
89 ;; (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
|
90 |
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
|
91 ;;; TODO: |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
92 |
59808 | 93 ;; 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
|
94 ;; 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
|
95 ;; 3) Mark breakpoint locations on scroll-bar of source buffer? |
54538 | 96 |
97 ;;; Code: | |
98 | |
99 (require 'gud) | |
100 | |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
101 (defvar tool-bar-map) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
102 (defvar speedbar-initial-expansion-list-name) |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
103 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
104 (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
|
105 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
|
106 (defvar gdb-frame-address nil "Identity of frame for watch expression.") |
62716 | 107 (defvar gdb-previous-frame-address nil) |
59808 | 108 (defvar gdb-memory-address "main") |
54538 | 109 (defvar gdb-previous-frame nil) |
62716 | 110 (defvar gdb-selected-frame nil) |
111 (defvar gdb-frame-number nil) | |
54538 | 112 (defvar gdb-current-language nil) |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
113 (defvar gdb-var-list nil |
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
114 "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
|
115 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP) |
75589
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
116 where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
117 address for root variables.") |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
118 (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
|
119 (defvar gud-old-arrow nil) |
54538 | 120 (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
|
121 (defvar gdb-stack-position nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
122 (defvar gdb-server-prefix nil) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
123 (defvar gdb-flush-pending-output nil) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
124 (defvar gdb-location-alist nil |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
125 "Alist of breakpoint numbers and full filenames. Only used for files that |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
126 Emacs can't find.") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
127 (defvar gdb-active-process nil |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
128 "GUD tooltips display variable values when t, and macro definitions otherwise.") |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
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 |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
220 (defun gdb (command-line) |
54538 | 221 "Run gdb on program FILE in buffer *gud-FILE*. |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
222 The directory containing FILE becomes the initial working |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
223 directory and source-file directory for your debugger. |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
224 |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
225 |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
226 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
|
227 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
|
228 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
|
229 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
|
230 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
231 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
|
232 `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
|
233 `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
|
234 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
|
235 some of the buffers. |
54538 | 236 |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
237 Watch expressions appear in the speedbar/slowbar. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
238 |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
239 The following commands help control operation : |
54901
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
240 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
241 `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
|
242 `gdb-restore-windows' - To restore the window layout. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
243 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
244 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
|
245 detailed description of this mode. |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
246 |
fa4feb8b3c34
(gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
54760
diff
changeset
|
247 |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
248 +----------------------------------------------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
249 | GDB Toolbar | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
250 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
251 | GUD buffer (I/O of GDB) | Locals buffer | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
252 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
253 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
254 | | | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
255 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
256 | Source buffer | I/O buffer (of debugged program) | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
257 | | (comint-mode) | |
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 +-----------------------------------+----------------------------------+ |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
265 | Stack buffer | Breakpoints buffer | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
266 | RET gdb-frames-select | SPC gdb-toggle-breakpoint | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
267 | | RET gdb-goto-breakpoint | |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
268 | | D gdb-delete-breakpoint | |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
269 +-----------------------------------+----------------------------------+ |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
270 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
271 To run GDB in text command mode, replace the GDB \"--annotate=3\" |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
272 option with \"--fullname\" either in the minibuffer for the |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
273 current Emacs session, or the custom variable |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
274 `gud-gdb-command-name' for all future sessions. You need to use |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
275 text command mode to debug multiple programs within one Emacs |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
276 session." |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
277 (interactive (list (gud-query-cmdline 'gdb))) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
278 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
279 (when (and gud-comint-buffer |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
280 (buffer-name gud-comint-buffer) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
281 (get-buffer-process gud-comint-buffer) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
282 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
283 (gdb-restore-windows) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
284 (error |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
285 "Multiple debugging requires restarting in text command mode")) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
286 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
287 (gud-common-init command-line nil 'gud-gdba-marker-filter) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
288 (set (make-local-variable 'gud-minor-mode) 'gdba) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
289 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
290 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
291 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
292 "Set temporary breakpoint at current line.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
293 (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
294 (gud-def gud-step "step %p" "\C-s" "Step one source line with display.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
295 (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
296 (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
297 (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
298 (gud-def gud-cont "cont" "\C-r" "Continue with display.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
299 (gud-def gud-finish "finish" "\C-f" "Finish executing current function.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
300 (gud-def gud-jump |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
301 (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l")) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
302 "\C-j" "Set execution address to current line.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
303 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
304 (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
305 (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
306 (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
307 (gud-def gud-pstar "print* %e" nil |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
308 "Evaluate C dereferenced pointer expression at point.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
309 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
310 ;; For debugging Emacs only. |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
311 (gud-def gud-pv "pv1 %e" "\C-v" "Print the value of the lisp variable.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
312 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
313 (gud-def gud-until "until %l" "\C-u" "Continue to current line.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
314 (gud-def gud-run "run" nil "Run the program.") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
315 |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
316 (local-set-key "\C-i" 'gud-gdb-complete-command) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
317 (setq comint-prompt-regexp "^(.*gdb[+]?) *") |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
318 (setq paragraph-start comint-prompt-regexp) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
319 (setq gdb-first-prompt t) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
320 (setq gud-running nil) |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
321 (setq gdb-ready nil) |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
322 (setq gud-filter-pending-text nil) |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
323 (run-hooks 'gdb-mode-hook)) |
54538 | 324 |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
325 (defcustom gdb-debug-log-max 128 |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
326 "Maximum size of `gdb-debug-log'. If nil, size is unlimited." |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
327 :group 'gud |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
328 :type '(choice (integer :tag "Number of elements") |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
329 (const :tag "Unlimited" nil)) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
330 :version "22.1") |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
331 |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
332 (defvar gdb-debug-log nil |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
333 "List of commands sent to and replies received from GDB. Most |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
334 recent commands are listed first. This list stores only the last |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
335 'gdb-debug-log-max' values. This variable is used to debug |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
336 GDB-UI.") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
337 |
64697
7767f4fb012a
* progmodes/gdb-ui.el (gdb-enable-debug-log): Add autoload cookie.
Nick Roberts <nickrob@snap.net.nz>
parents:
64654
diff
changeset
|
338 ;;;###autoload |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
339 (defcustom gdb-enable-debug nil |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
340 "Non-nil means record the process input and output in `gdb-debug-log'." |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
341 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
342 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
343 :version "22.1") |
54616
47c4cb867a84
(gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents:
54538
diff
changeset
|
344 |
62115
515e18600ed2
(gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
62065
diff
changeset
|
345 (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
|
346 "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
|
347 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
|
348 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
|
349 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
|
350 |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
351 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
|
352 predefined macros." |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
353 :type 'string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
354 :group 'gud |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
355 :version "22.1") |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
356 |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
357 (defcustom gdb-cpp-define-alist-flags "" |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
358 "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
|
359 :type 'string |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
360 :group 'gud |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
361 :version "22.1") |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
362 |
62723
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
363 (defcustom gdb-show-main nil |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
364 "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
|
365 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
|
366 :type 'boolean |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
367 :group 'gud |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
368 :version "22.1") |
0ae5fe9ca759
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
62716
diff
changeset
|
369 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
370 (defcustom gdb-many-windows nil |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
371 "If nil, just pop up the GUD buffer unless `gdb-show-main' is t. |
73890
2896142f6964
(gdb-many-windows): Start doc string
Nick Roberts <nickrob@snap.net.nz>
parents:
73883
diff
changeset
|
372 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
|
373 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
|
374 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
|
375 for `gdba'." |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
376 :type 'boolean |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
377 :group 'gud |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
378 :version "22.1") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
379 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
380 (defcustom gdb-use-separate-io-buffer nil |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
381 "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
|
382 :type 'boolean |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
383 :group 'gud |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
384 :version "22.1") |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
385 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
386 (defun gdb-force-mode-line-update (status) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
387 (let ((buffer gud-comint-buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
388 (if (and buffer (buffer-name buffer)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
389 (with-current-buffer buffer |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
390 (setq mode-line-process |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
391 (format ":%s [%s]" |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
392 (process-status (get-buffer-process buffer)) status)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
393 ;; Force mode line redisplay soon. |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
394 (force-mode-line-update))))) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
395 |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
396 (defun gdb-many-windows (arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
397 "Toggle the number of windows in the basic arrangement. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
398 With prefix argument ARG, display additional buffers if ARG is positive, |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
399 otherwise use a single window." |
69438
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
400 (interactive "P") |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
401 (setq gdb-many-windows |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
402 (if (null arg) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
403 (not gdb-many-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
404 (> (prefix-numeric-value arg) 0))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
405 (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
|
406 (if gdb-many-windows "en" "dis"))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
407 (if (and gud-comint-buffer |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
408 (buffer-name gud-comint-buffer)) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
409 (condition-case nil |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
410 (gdb-restore-windows) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
411 (error nil)))) |
d7680d58bec3
(gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents:
69359
diff
changeset
|
412 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
413 (defun gdb-use-separate-io-buffer (arg) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
414 "Toggle separate IO for debugged program. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
415 With prefix argument ARG, use separate IO if ARG is positive, |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
416 otherwise do not." |
66582
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
417 (interactive "P") |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
418 (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
|
419 (if (null arg) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
420 (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
|
421 (> (prefix-numeric-value arg) 0))) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
422 (message (format "Separate IO %sabled" |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
423 (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
|
424 (if (and gud-comint-buffer |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
425 (buffer-name gud-comint-buffer)) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
426 (condition-case nil |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
427 (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
|
428 (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
|
429 (kill-buffer (gdb-inferior-io-name))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
430 (error nil)))) |
89dec7a16b7a
(gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66577
diff
changeset
|
431 |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
432 (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
|
433 |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
434 (defun gdb-create-define-alist () |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
435 "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
|
436 (let* ((file (buffer-file-name)) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
437 (output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
438 (with-output-to-string |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
439 (with-current-buffer standard-output |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
440 (call-process shell-file-name |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
441 (if (file-exists-p file) file nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
442 (list t nil) nil "-c" |
62065
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
443 (concat gdb-cpp-define-alist-program " " |
115b0152e8bb
(gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62050
diff
changeset
|
444 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
|
445 (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
|
446 (setq gdb-define-alist nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
447 (dolist (define define-list) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
448 (setq name (nth 1 (split-string define "[( ]"))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
449 (push (cons name define) gdb-define-alist)))) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
450 |
67891
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
451 (defun gdb-tooltip-print (expr) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
452 (tooltip-show |
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
453 (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
|
454 (goto-char (point-min)) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
455 (let ((string |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
456 (if (search-forward "=" nil t) |
c6d86f53dcf3
(gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents:
67591
diff
changeset
|
457 (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
|
458 (buffer-string)))) |
62136
69b9edc69fe5
(gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents:
62115
diff
changeset
|
459 ;; 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
|
460 (substring string 0 (- (length string) 1)))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
461 (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
|
462 |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
463 ;; 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
|
464 ;; 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
|
465 ;; unexpected starting annotation (phase error). |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
466 (defun gdb-tooltip-print-1 (expr) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
467 (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
|
468 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
469 (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
|
470 (unless (looking-at "\\S-+.*(.*).*") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
471 (gdb-enqueue-input |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
472 (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
|
473 `(lambda () (gdb-tooltip-print ,expr)))))))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
474 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
475 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)") |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
476 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
477 (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
|
478 "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
|
479 (goto-char (point-min)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
480 (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
|
481 (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
|
482 (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
|
483 gdb-source-file-list)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
484 (dolist (buffer (buffer-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
485 (with-current-buffer buffer |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
486 (when (and buffer-file-name |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
487 (member (file-name-nondirectory buffer-file-name) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
488 gdb-source-file-list)) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
489 (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
|
490 (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
|
491 (when gud-tooltip-mode |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
492 (make-local-variable 'gdb-define-alist) |
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
493 (gdb-create-define-alist) |
71277
99ed754e8f50
(gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
71113
diff
changeset
|
494 (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
|
495 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
496 (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
|
497 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
498 (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
|
499 (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
|
500 (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
|
501 (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
|
502 (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
|
503 (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
|
504 (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
|
505 (setq varnumlet (car var1)) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
506 (dolist (component component-list) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
507 (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
|
508 (setq expr (concat expr |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
509 (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
|
510 (concat "[" component "]") |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
511 (concat "." component)))) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
512 (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
|
513 expr))) |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
514 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
515 (defun gdb-init-1 () |
62716 | 516 (gud-def gud-break (if (not (string-match "Machine" mode-name)) |
54538 | 517 (gud-call "break %f:%l" arg) |
518 (save-excursion | |
519 (beginning-of-line) | |
520 (forward-char 2) | |
521 (gud-call "break *%a" arg))) | |
522 "\C-b" "Set breakpoint at current line or address.") | |
523 ;; | |
62716 | 524 (gud-def gud-remove (if (not (string-match "Machine" mode-name)) |
54538 | 525 (gud-call "clear %f:%l" arg) |
526 (save-excursion | |
527 (beginning-of-line) | |
528 (forward-char 2) | |
529 (gud-call "clear *%a" arg))) | |
530 "\C-d" "Remove breakpoint at current line or address.") | |
531 ;; | |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
532 (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
|
533 (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
|
534 (save-excursion |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
535 (beginning-of-line) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
536 (forward-char 2) |
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
537 (gud-call "until *%a" arg))) |
54538 | 538 "\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
|
539 ;; |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
540 (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
|
541 nil "Start or continue execution.") |
54538 | 542 |
66977
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
543 ;; For debugging Emacs only. |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
544 (gud-def gud-pp |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
545 (gud-call |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
546 (concat |
6ea7a5538417
(gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents:
66886
diff
changeset
|
547 "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
|
548 '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
|
549 (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
|
550 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
|
551 |
54538 | 552 (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
|
553 'gdb-mouse-set-clear-breakpoint) |
54538 | 554 (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
|
555 'gdb-mouse-set-clear-breakpoint) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
556 (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
|
557 'gdb-mouse-toggle-breakpoint-margin) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
558 (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
|
559 'gdb-mouse-toggle-breakpoint-fringe) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
560 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
561 (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
|
562 'gdb-mouse-until) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
563 (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
|
564 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
565 (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
|
566 'gdb-mouse-until) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
567 (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
|
568 'gdb-mouse-until) |
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
569 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
570 (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
|
571 'gdb-mouse-jump) |
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
572 (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
|
573 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
574 (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
|
575 'gdb-mouse-jump) |
71090
d135a47c9bbe
Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents:
70587
diff
changeset
|
576 (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
|
577 'gdb-mouse-jump) |
54538 | 578 |
579 (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
|
580 |
57664
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
581 ;; (re-)initialize |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
582 (setq gdb-pc-address (if gdb-show-main "main" nil)) |
62716 | 583 (setq gdb-previous-frame-address nil |
584 gdb-memory-address "main" | |
585 gdb-previous-frame nil | |
586 gdb-selected-frame nil | |
587 gdb-current-language nil | |
588 gdb-frame-number nil | |
589 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
|
590 gdb-main-file nil |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
591 gdb-first-post-prompt t |
62716 | 592 gdb-prompting nil |
593 gdb-input-queue nil | |
594 gdb-current-item nil | |
595 gdb-pending-triggers nil | |
596 gdb-output-sink 'user | |
597 gdb-server-prefix "server " | |
598 gdb-flush-pending-output nil | |
599 gdb-location-alist nil | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
600 gdb-source-file-list nil |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
601 gdb-error nil |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
602 gdb-macro-info nil |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
603 gdb-buffer-fringe-width (car (window-fringes)) |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
604 gdb-debug-log nil |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
605 gdb-signalled nil |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
606 gdb-source-window nil |
69526
c32efda6ab27
(gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69510
diff
changeset
|
607 gdb-inferior-status nil |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
608 gdb-continuation nil |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
609 gdb-look-up-stack nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
610 gdb-frame-begin nil |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
611 gdb-printing t |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
612 gud-old-arrow nil) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
613 |
54538 | 614 (setq gdb-buffer-type 'gdba) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
615 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
616 (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
|
617 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
618 ;; 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
|
619 (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
|
620 'gdb-get-version))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
621 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
622 (defun gdb-init-2 () |
54538 | 623 (if (eq window-system 'w32) |
624 (gdb-enqueue-input (list "set new-console off\n" 'ignore))) | |
625 (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
|
626 (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
|
627 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
628 (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
|
629 (progn |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
630 (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
|
631 '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
|
632 (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
|
633 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
634 (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
|
635 'gdb-get-register-names)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
636 ; Needs GDB 6.2 onwards. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
637 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
638 (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
|
639 '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
|
640 (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
|
641 |
69839
f91451ffdab7
(gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents:
69666
diff
changeset
|
642 ;; 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
|
643 ;; 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
|
644 (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
|
645 (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
|
646 |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
647 (run-hooks 'gdb-mode-hook)) |
54538 | 648 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
649 (defun gdb-get-version () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
650 (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
|
651 (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
|
652 (setq gdb-version "pre-6.4") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
653 (setq gdb-version "6.4+")) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
654 (gdb-init-2)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
655 |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
656 (defmacro gdb-if-arrow (arrow-position &rest body) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
657 `(if ,arrow-position |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
658 (let ((buffer (marker-buffer ,arrow-position)) (line)) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
659 (if (equal buffer (window-buffer (posn-window end))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
660 (with-current-buffer buffer |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
661 (when (or (equal start end) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
662 (equal (posn-point start) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
663 (marker-position ,arrow-position))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
664 ,@body)))))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
665 |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
666 (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
|
667 "Continue running until a source line past the current line. |
76238
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
668 The destination source line can be selected either by clicking |
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
669 with mouse-3 on the fringe/margin or dragging the arrow |
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
670 with mouse-1 (default bindings)." |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
671 (interactive "e") |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
672 (let ((start (event-start event)) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
673 (end (event-end event))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
674 (gdb-if-arrow gud-overlay-arrow-position |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
675 (setq line (line-number-at-pos (posn-point end))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
676 (gud-call (concat "until " (number-to-string line)))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
677 (gdb-if-arrow gdb-overlay-arrow-position |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
678 (save-excursion |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
679 (goto-line (line-number-at-pos (posn-point end))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
680 (forward-char 2) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
681 (gud-call (concat "until *%a")))))) |
66419
5da1cd84fb2c
(gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
66417
diff
changeset
|
682 |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
683 (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
|
684 "Set execution address/line. |
76238
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
685 The destination source line can be selected either by clicking with C-mouse-3 |
65ce5be5f7ca
(gdb-mouse-until, gdb-mouse-jump):
Nick Roberts <nickrob@snap.net.nz>
parents:
75716
diff
changeset
|
686 on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings). |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
687 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
|
688 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
|
689 (interactive "e") |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
690 (let ((start (event-start event)) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
691 (end (event-end event))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
692 (gdb-if-arrow gud-overlay-arrow-position |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
693 (setq line (line-number-at-pos (posn-point end))) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
694 (progn |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
695 (gud-call (concat "tbreak " (number-to-string line))) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
696 (gud-call (concat "jump " (number-to-string line))))) |
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
697 (gdb-if-arrow gdb-overlay-arrow-position |
75714
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
698 (save-excursion |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
699 (goto-line (line-number-at-pos (posn-point end))) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
700 (forward-char 2) |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
701 (progn |
9ed49c89489b
(gdb-mouse-until, gdb-mouse-jump): Make them
Nick Roberts <nickrob@snap.net.nz>
parents:
75690
diff
changeset
|
702 (gud-call (concat "tbreak *%a")) |
75716
8bfa58061d79
(gdb-if-arrow): New macro.
Nick Roberts <nickrob@snap.net.nz>
parents:
75714
diff
changeset
|
703 (gud-call (concat "jump *%a"))))))) |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
704 |
69042
01ec984a6ce6
(gdb-speedbar-auto-raise): Don't enable by default.
Nick Roberts <nickrob@snap.net.nz>
parents:
69023
diff
changeset
|
705 (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
|
706 "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
|
707 updated." |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
708 :type 'boolean |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
709 :group 'gud |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
710 :version "22.1") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
711 |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
712 (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
|
713 "Toggle automatic raising of the speedbar for watch expressions. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
714 With prefix argument ARG, automatically raise speedbar if ARG is |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
715 positive, otherwise don't automatically raise it." |
67096
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
716 (interactive "P") |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
717 (setq gdb-speedbar-auto-raise |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
718 (if (null arg) |
ca31f8486563
(gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67077
diff
changeset
|
719 (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
|
720 (> (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
|
721 (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
|
722 (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
|
723 |
54538 | 724 (defcustom gdb-use-colon-colon-notation nil |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
725 "If non-nil use FUN::VAR format to display variables in the speedbar." |
54538 | 726 :type 'boolean |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
727 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
728 :version "22.1") |
54538 | 729 |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
730 (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
|
731 (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
|
732 |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
733 (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
|
734 "Watch expression at point. |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
735 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
|
736 (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
|
737 (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
|
738 (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
|
739 (progn |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
740 (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
|
741 (require 'tooltip) |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
742 (save-selected-window |
70351
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
743 (let ((expr |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
744 (if arg |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
745 (completing-read "Name of variable: " |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
746 'gud-gdb-complete-command) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
747 (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
|
748 (buffer-substring (region-beginning) (region-end)) |
8e55901472d6
(gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents:
70141
diff
changeset
|
749 (tooltip-identifier-from-point (point)))))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
750 (speedbar 1) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
751 (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
|
752 (gdb-enqueue-input |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
753 (list |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
754 (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
|
755 (concat |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
756 "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
|
757 (concat"-var-create - * " expr "\n")) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
758 `(lambda () (gdb-var-create-handler ,expr))))))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
759 (message "gud-watch is a no-op in this mode.")))) |
54538 | 760 |
761 (defconst gdb-var-create-regexp | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
762 "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",\\(?:.*value=\\(\".*\"\\),\\)?.*type=\"\\(.*?\\)\"") |
54538 | 763 |
764 (defun gdb-var-create-handler (expr) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
765 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
766 (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
|
767 (let ((var (list |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
768 (match-string 1) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
769 (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
|
770 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
|
771 (setq expr (concat gdb-selected-frame "::" expr)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
772 expr) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
773 (match-string 2) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
774 (match-string 4) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
775 (if (match-string 3) (read (match-string 3))) |
75589
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
776 nil gdb-frame-address))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
777 (push var gdb-var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
778 (unless (string-equal |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
779 speedbar-initial-expansion-list-name "GUD") |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
780 (speedbar-change-initial-expansion-list "GUD")) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
781 (unless (nth 4 var) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
782 (gdb-enqueue-input |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
783 (list |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
784 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
785 'gdba) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
786 (concat "server interpreter mi \"0-var-evaluate-expression " |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
787 (car var) "\"\n") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
788 (concat "0-var-evaluate-expression " (car var) "\n")) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
789 `(lambda () (gdb-var-evaluate-expression-handler |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
790 ,(car var) nil)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
791 (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
|
792 (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
|
793 (message-box "No symbol \"%s\" in current context." expr)))) |
54538 | 794 |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
795 (defun gdb-speedbar-update () |
75589
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
796 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame) |
409b8dd974d3
(gdb-speedbar-update): Avoid duplication
Nick Roberts <nickrob@snap.net.nz>
parents:
75554
diff
changeset
|
797 (not (member 'gdb-speedbar-timer gdb-pending-triggers))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
798 ;; 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
|
799 (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
|
800 ;; 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
|
801 (push 'gdb-speedbar-timer gdb-pending-triggers))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
802 |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
803 (defun gdb-speedbar-timer-fn () |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
804 (setq gdb-pending-triggers |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
805 (delq 'gdb-speedbar-timer gdb-pending-triggers)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
806 (speedbar-timer-fn)) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
807 |
54538 | 808 (defun gdb-var-evaluate-expression-handler (varnum changed) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
809 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
810 (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
811 (setq gdb-pending-triggers |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
812 (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
|
813 (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
|
814 (when var |
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
815 (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
|
816 (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
|
817 (gdb-speedbar-update)) |
54538 | 818 |
819 (defun gdb-var-list-children (varnum) | |
820 (gdb-enqueue-input | |
60477
2b7513e741b1
(gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents:
60326
diff
changeset
|
821 (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
|
822 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
54538 | 823 |
824 (defconst gdb-var-list-children-regexp | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
825 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
826 numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)") |
54538 | 827 |
828 (defun gdb-var-list-children-handler (varnum) | |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
829 (goto-char (point-min)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
830 (let ((var-list nil)) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
831 (catch 'child-already-watched |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
832 (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
|
833 (if (string-equal varnum (car var)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
834 (progn |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
835 (push var var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
836 (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
|
837 (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
|
838 (match-string 2) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
839 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
840 (match-string 6) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
841 nil nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
842 (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
|
843 (throw 'child-already-watched nil)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
844 (push varchild var-list) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
845 (gdb-enqueue-input |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
846 (list |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
847 (concat |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
848 "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
|
849 (car varchild) "\"\n") |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
850 `(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
|
851 ,(car varchild) nil))))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
852 (push var var-list))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
853 (setq gdb-var-list (nreverse var-list))))) |
54538 | 854 |
855 (defun gdb-var-update () | |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
856 (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
|
857 (gdb-enqueue-input |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
858 (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
|
859 'gdb-var-update-handler)) |
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
860 (push 'gdb-var-update gdb-pending-triggers))) |
54538 | 861 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
862 (defconst gdb-var-update-regexp |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
863 "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
864 type_changed=\".*?\".*?}") |
54538 | 865 |
866 (defun gdb-var-update-handler () | |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
867 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
868 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
869 (goto-char (point-min)) |
70587
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
870 (let ((n 0)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
871 (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
|
872 (let ((varnum (match-string 1))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
873 (if (string-equal (match-string 2) "false") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
874 (let ((var (assoc varnum gdb-var-list))) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
875 (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
|
876 (setq n (1+ n)) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
877 (push n gdb-pending-triggers) |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
878 (gdb-enqueue-input |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
879 (list |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
880 (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
|
881 "-var-evaluate-expression " varnum "\"\n") |
5bf70421e7ea
(gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents:
70503
diff
changeset
|
882 `(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
|
883 (setq gdb-pending-triggers |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
884 (delq 'gdb-var-update gdb-pending-triggers))) |
54538 | 885 |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
886 (defun gdb-var-delete-1 (varnum) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
887 (gdb-enqueue-input |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
888 (list |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
889 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
890 'gdba) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
891 (concat "server interpreter mi \"-var-delete " varnum "\"\n") |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
892 (concat "-var-delete " varnum "\n")) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
893 'ignore)) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
894 (setq gdb-var-list (delq var gdb-var-list)) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
895 (dolist (varchild gdb-var-list) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
896 (if (string-match (concat (car var) "\\.") (car varchild)) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
897 (setq gdb-var-list (delq varchild gdb-var-list))))) |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
898 |
54538 | 899 (defun gdb-var-delete () |
64346
ef82d5d73c0d
(gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
64241
diff
changeset
|
900 "Delete watch expression at point from the speedbar." |
54538 | 901 (interactive) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
902 (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
|
903 '(gdbmi gdba)) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
904 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
905 (varnum (car var))) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
906 (if (string-match "\\." (car var)) |
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
907 (message-box "Can only delete a root expression") |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
908 (gdb-var-delete-1 varnum))))) |
54538 | 909 |
74390
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
910 (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
|
911 "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
|
912 (gdb-enqueue-input |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
913 (list |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
914 (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
|
915 (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
|
916 (concat "-var-delete -c " varnum "\n")) 'ignore))) |
5de20af288db
(gdb-var-delete-children): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
73890
diff
changeset
|
917 |
54538 | 918 (defun gdb-edit-value (text token indent) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
919 "Assign a value to a variable displayed in the speedbar." |
54538 | 920 (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
|
921 (varnum (car var)) (value)) |
54538 | 922 (setq value (read-string "New value: ")) |
923 (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
|
924 (list |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
925 (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
|
926 (concat "server interpreter mi \"-var-assign " |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
927 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
|
928 (concat "-var-assign " varnum " " value "\n")) |
69325
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
929 `(lambda () (gdb-edit-value-handler ,value)))))) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
930 |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
931 (defun gdb-edit-value-handler (value) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
932 (goto-char (point-min)) |
806b0c0e3bd1
(gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69234
diff
changeset
|
933 (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
|
934 (message-box "Invalid number or expression (%s)" value))) |
54538 | 935 |
936 (defcustom gdb-show-changed-values t | |
68967
87bf1f965a0f
(gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68941
diff
changeset
|
937 "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
|
938 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
|
939 Changed values are highlighted with the face `font-lock-warning-face'." |
54538 | 940 :type 'boolean |
58049
fd0093bd412a
(gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
57982
diff
changeset
|
941 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
942 :version "22.1") |
54538 | 943 |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
944 (defcustom gdb-max-children 40 |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
945 "Maximum number of children before expansion requires confirmation." |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
946 :type 'integer |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
947 :group 'gud |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
948 :version "22.1") |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
949 |
79261
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
950 (defcustom gdb-delete-out-of-scope t |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
951 "If non-nil delete watch expressions automatically when they go out of scope." |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
952 :type 'boolean |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
953 :group 'gud |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
954 :version "22.2") |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
955 |
54538 | 956 (defun gdb-speedbar-expand-node (text token indent) |
957 "Expand the node the user clicked on. | |
958 TEXT is the text of the button we clicked on, a + or - item. | |
959 TOKEN is data related to this node. | |
960 INDENT is the current indentation depth." | |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
961 (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
|
962 (progn |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
963 (cond ((string-match "+" text) ;expand this node |
75093
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
964 (let* ((var (assoc token gdb-var-list)) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
965 (expr (nth 1 var)) (children (nth 2 var))) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
966 (if (or (<= (string-to-number children) gdb-max-children) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
967 (y-or-n-p |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
968 (format |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
969 "%s has %s children. Continue? " expr children))) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
970 (if (and (eq (buffer-local-value |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
971 'gud-minor-mode gud-comint-buffer) 'gdba) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
972 (string-equal gdb-version "pre-6.4")) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
973 (gdb-var-list-children token) |
5b3d80ea3c0e
(gdb-max-children): New customizable variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
74924
diff
changeset
|
974 (gdb-var-list-children-1 token))))) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
975 ((string-match "-" text) ;contract this node |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
976 (dolist (var gdb-var-list) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
977 (if (string-match (concat token "\\.") (car var)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
978 (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
|
979 (gdb-var-delete-children token) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
980 (speedbar-change-expand-button-char ?+) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
981 (speedbar-delete-subblock indent)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
982 (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
|
983 (speedbar-center-buffer-smartly)) |
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
984 (message-box "GUD session has been killed"))) |
54538 | 985 |
986 (defun gdb-get-target-string () | |
987 (with-current-buffer gud-comint-buffer | |
988 gud-target-name)) | |
989 | |
990 | |
991 ;; | |
992 ;; gdb buffers. | |
993 ;; | |
994 ;; Each buffer has a TYPE -- a symbol that identifies the function | |
995 ;; of that particular buffer. | |
996 ;; | |
997 ;; The usual gdb interaction buffer is given the type `gdba' and | |
998 ;; is constructed specially. | |
999 ;; | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1000 ;; Others are constructed by gdb-get-buffer-create and |
54538 | 1001 ;; named according to the rules set forth in the gdb-buffer-rules-assoc |
1002 | |
1003 (defvar gdb-buffer-rules-assoc '()) | |
1004 | |
1005 (defun gdb-get-buffer (key) | |
1006 "Return the gdb buffer tagged with type KEY. | |
1007 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
1008 (save-excursion | |
1009 (gdb-look-for-tagged-buffer key (buffer-list)))) | |
1010 | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1011 (defun gdb-get-buffer-create (key) |
54538 | 1012 "Create a new gdb buffer of the type specified by KEY. |
1013 The key should be one of the cars in `gdb-buffer-rules-assoc'." | |
1014 (or (gdb-get-buffer key) | |
1015 (let* ((rules (assoc key gdb-buffer-rules-assoc)) | |
1016 (name (funcall (gdb-rules-name-maker rules))) | |
1017 (new (get-buffer-create name))) | |
1018 (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
|
1019 (let ((trigger)) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1020 (if (cdr (cdr rules)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
1021 (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
|
1022 (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
|
1023 (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
|
1024 (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
|
1025 (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
|
1026 (if trigger (funcall trigger))) |
54538 | 1027 new)))) |
1028 | |
1029 (defun gdb-rules-name-maker (rules) (car (cdr rules))) | |
1030 | |
1031 (defun gdb-look-for-tagged-buffer (key bufs) | |
1032 (let ((retval nil)) | |
1033 (while (and (not retval) bufs) | |
1034 (set-buffer (car bufs)) | |
1035 (if (eq gdb-buffer-type key) | |
1036 (setq retval (car bufs))) | |
1037 (setq bufs (cdr bufs))) | |
1038 retval)) | |
1039 | |
1040 ;; | |
1041 ;; This assoc maps buffer type symbols to rules. Each rule is a list of | |
1042 ;; at least one and possible more functions. The functions have these | |
1043 ;; roles in defining a buffer type: | |
1044 ;; | |
1045 ;; NAME - Return a name for this buffer type. | |
1046 ;; | |
1047 ;; The remaining function(s) are optional: | |
1048 ;; | |
1049 ;; MODE - called in a new buffer with no arguments, should establish | |
1050 ;; the proper mode for the buffer. | |
1051 ;; | |
1052 | |
1053 (defun gdb-set-buffer-rules (buffer-type &rest rules) | |
1054 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc))) | |
1055 (if binding | |
1056 (setcdr binding rules) | |
1057 (push (cons buffer-type rules) | |
1058 gdb-buffer-rules-assoc)))) | |
1059 | |
1060 ;; GUD buffers are an exception to the rules | |
1061 (gdb-set-buffer-rules 'gdba 'error) | |
1062 | |
1063 ;; Partial-output buffer : This accumulates output from a command executed on | |
1064 ;; behalf of emacs (rather than the user). | |
1065 ;; | |
1066 (gdb-set-buffer-rules 'gdb-partial-output-buffer | |
1067 'gdb-partial-output-name) | |
1068 | |
1069 (defun gdb-partial-output-name () | |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
1070 (concat " *partial-output-" |
54538 | 1071 (gdb-get-target-string) |
1072 "*")) | |
1073 | |
1074 | |
1075 (gdb-set-buffer-rules 'gdb-inferior-io | |
1076 'gdb-inferior-io-name | |
1077 'gdb-inferior-io-mode) | |
1078 | |
1079 (defun gdb-inferior-io-name () | |
1080 (concat "*input/output of " | |
1081 (gdb-get-target-string) | |
1082 "*")) | |
1083 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1084 (defun gdb-display-separate-io-buffer () |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1085 "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
|
1086 (interactive) |
68903
57fa3643220b
(gdb-display-separate-io-buffer): Change use of
Nick Roberts <nickrob@snap.net.nz>
parents:
68902
diff
changeset
|
1087 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1088 (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
|
1089 (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
|
1090 |
65231
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1091 (defconst gdb-frame-parameters |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1092 '((height . 14) (width . 80) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1093 (unsplittable . t) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1094 (tool-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1095 (menu-bar-lines . nil) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1096 (minibuffer . nil))) |
cdfa3b89c6bb
(tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64999
diff
changeset
|
1097 |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1098 (defun gdb-frame-separate-io-buffer () |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1099 "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
|
1100 (interactive) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1101 (if gdb-use-separate-io-buffer |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1102 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
1103 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1104 (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
|
1105 |
54538 | 1106 (defvar gdb-inferior-io-mode-map |
1107 (let ((map (make-sparse-keymap))) | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1108 (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
|
1109 (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
|
1110 (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
|
1111 (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
|
1112 (define-key map "\C-d" 'gdb-separate-io-eof) |
54538 | 1113 map)) |
1114 | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1115 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
54538 | 1116 "Major mode for gdb inferior-io." |
1117 :syntax-table nil :abbrev-table nil | |
1118 ;; We want to use comint because it has various nifty and familiar | |
1119 ;; features. We don't need a process, but comint wants one, so create | |
1120 ;; a dummy one. | |
1121 (make-comint-in-buffer | |
1122 (substring (buffer-name) 1 (- (length (buffer-name)) 1)) | |
1123 (current-buffer) "hexl") | |
1124 (setq comint-input-sender 'gdb-inferior-io-sender)) | |
1125 | |
1126 (defun gdb-inferior-io-sender (proc string) | |
1127 ;; PROC is the pseudo-process created to satisfy comint. | |
1128 (with-current-buffer (process-buffer proc) | |
1129 (setq proc (get-buffer-process gud-comint-buffer)) | |
1130 (process-send-string proc string) | |
1131 (process-send-string proc "\n"))) | |
1132 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1133 (defun gdb-separate-io-interrupt () |
54538 | 1134 "Interrupt the program being debugged." |
1135 (interactive) | |
1136 (interrupt-process | |
1137 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1138 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1139 (defun gdb-separate-io-quit () |
54538 | 1140 "Send quit signal to the program being debugged." |
1141 (interactive) | |
1142 (quit-process | |
1143 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1144 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1145 (defun gdb-separate-io-stop () |
54538 | 1146 "Stop the program being debugged." |
1147 (interactive) | |
1148 (stop-process | |
1149 (get-buffer-process gud-comint-buffer) comint-ptyp)) | |
1150 | |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1151 (defun gdb-separate-io-eof () |
54538 | 1152 "Send end-of-file to the program being debugged." |
1153 (interactive) | |
1154 (process-send-eof | |
1155 (get-buffer-process gud-comint-buffer))) | |
1156 | |
1157 | |
1158 ;; gdb communications | |
1159 ;; | |
1160 | |
1161 ;; INPUT: things sent to gdb | |
1162 ;; | |
1163 ;; The queues are lists. Each element is either a string (indicating user or | |
1164 ;; user-like input) or a list of the form: | |
1165 ;; | |
1166 ;; (INPUT-STRING HANDLER-FN) | |
1167 ;; | |
1168 ;; The handler function will be called from the partial-output buffer when the | |
1169 ;; command completes. This is the way to write commands which invoke gdb | |
1170 ;; commands autonomously. | |
1171 ;; | |
1172 ;; These lists are consumed tail first. | |
1173 ;; | |
1174 | |
1175 (defun gdb-send (proc string) | |
1176 "A comint send filter for gdb. | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1177 This filter may simply queue input for a later time." |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1178 (when gdb-ready |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1179 (with-current-buffer gud-comint-buffer |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1180 (let ((inhibit-read-only t)) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1181 (remove-text-properties (point-min) (point-max) '(face)))) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1182 (if gud-running |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1183 (progn |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1184 (let ((item (concat string "\n"))) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1185 (if gdb-enable-debug (push (cons 'send item) gdb-debug-log)) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1186 (process-send-string proc item))) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1187 (if (string-match "\\\\\\'" string) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1188 (setq gdb-continuation (concat gdb-continuation string "\n")) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1189 (let ((item (concat gdb-continuation string |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1190 (if (not comint-input-sender-no-newline) "\n")))) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1191 (gdb-enqueue-input item) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
1192 (setq gdb-continuation nil)))))) |
54538 | 1193 |
1194 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it | |
1195 ;; is a query, or other non-top-level prompt. | |
1196 | |
1197 (defun gdb-enqueue-input (item) | |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1198 (if (not gud-running) |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1199 (if gdb-prompting |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1200 (progn |
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1201 (gdb-send-item item) |
73294
f11ea9f277ca
(gdb-speedbar-expand-node): Burp if
Nick Roberts <nickrob@snap.net.nz>
parents:
72668
diff
changeset
|
1202 (setq gdb-prompting nil)) |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1203 (push item gdb-input-queue)))) |
54538 | 1204 |
1205 (defun gdb-dequeue-input () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1206 (let ((queue gdb-input-queue)) |
54538 | 1207 (and queue |
1208 (let ((last (car (last queue)))) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1209 (unless (nbutlast queue) (setq gdb-input-queue '())) |
54538 | 1210 last)))) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1211 |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1212 (defun gdb-send-item (item) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1213 (setq gdb-flush-pending-output nil) |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1214 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1215 (setq gdb-current-item item) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1216 (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
|
1217 (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
|
1218 (if (stringp item) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1219 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1220 (setq gdb-output-sink 'user) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1221 (process-send-string process item)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1222 (progn |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1223 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1224 (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
|
1225 (process-send-string process |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1226 (car item)))) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1227 ;; case: eq gud-minor-mode 'gdbmi |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1228 (gdb-clear-partial-output) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1229 (setq gdb-output-sink 'emacs) |
66726
04a53d446ab1
(gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents:
66681
diff
changeset
|
1230 (process-send-string process (car item))))) |
54538 | 1231 |
1232 ;; | |
1233 ;; output -- things gdb prints to emacs | |
1234 ;; | |
1235 ;; GDB output is a stream interrupted by annotations. | |
1236 ;; Annotations can be recognized by their beginning | |
1237 ;; with \C-j\C-z\C-z<tag><opt>\C-j | |
1238 ;; | |
1239 ;; The tag is a string obeying symbol syntax. | |
1240 ;; | |
1241 ;; The optional part `<opt>' can be either the empty string | |
1242 ;; or a space followed by more data relating to the annotation. | |
1243 ;; For example, the SOURCE annotation is followed by a filename, | |
1244 ;; line number and various useless goo. This data must not include | |
1245 ;; any newlines. | |
1246 ;; | |
1247 | |
78957
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
1248 (defcustom gud-gdb-command-name "gdb --annotate=3" |
47523d623a1c
(gud-gdb-command-name, gdb): Move here from gud.el and adapt doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
78946
diff
changeset
|
1249 "Default command to execute an executable under the GDB debugger." |
54538 | 1250 :type 'string |
57851
67b88e92a24d
(gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents:
57791
diff
changeset
|
1251 :group 'gud |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
1252 :version "22.1") |
54538 | 1253 |
1254 (defvar gdb-annotation-rules | |
1255 '(("pre-prompt" gdb-pre-prompt) | |
1256 ("prompt" gdb-prompt) | |
1257 ("commands" gdb-subprompt) | |
1258 ("overload-choice" gdb-subprompt) | |
1259 ("query" gdb-subprompt) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1260 ;; 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
|
1261 ("nquery" gdb-subprompt) |
54538 | 1262 ("prompt-for-continue" gdb-subprompt) |
1263 ("post-prompt" gdb-post-prompt) | |
1264 ("source" gdb-source) | |
1265 ("starting" gdb-starting) | |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1266 ("exited" gdb-exited) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1267 ("signalled" gdb-signalled) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1268 ("signal" gdb-signal) |
54538 | 1269 ("breakpoint" gdb-stopping) |
1270 ("watchpoint" gdb-stopping) | |
1271 ("frame-begin" gdb-frame-begin) | |
1272 ("stopped" gdb-stopped) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1273 ("error-begin" gdb-error) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1274 ("error" gdb-error) |
54538 | 1275 ) "An assoc mapping annotation tags to functions which process them.") |
1276 | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1277 (defun gdb-resync() |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1278 (setq gdb-flush-pending-output t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1279 (setq gud-running nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1280 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1281 (propertize "stopped"'face font-lock-warning-face)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1282 (setq gdb-output-sink 'user) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1283 (setq gdb-input-queue nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1284 (setq gdb-pending-triggers nil) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1285 (setq gdb-prompting t)) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1286 |
54538 | 1287 (defconst gdb-source-spec-regexp |
62716 | 1288 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)") |
54538 | 1289 |
1290 ;; Do not use this except as an annotation handler. | |
1291 (defun gdb-source (args) | |
1292 (string-match gdb-source-spec-regexp args) | |
1293 ;; Extract the frame position from the marker. | |
1294 (setq gud-last-frame | |
1295 (cons | |
1296 (match-string 1 args) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
1297 (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
|
1298 (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
|
1299 ;; cover for auto-display output which comes *before* |
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1300 ;; stopped annotation |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1301 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) |
54538 | 1302 |
1303 (defun gdb-pre-prompt (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1304 "An annotation handler for `pre-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1305 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
|
1306 happens to be in effect." |
67164
c3990f178905
(gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents:
67147
diff
changeset
|
1307 (setq gdb-error nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1308 (let ((sink gdb-output-sink)) |
54538 | 1309 (cond |
1310 ((eq sink 'user) t) | |
1311 ((eq sink 'emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1312 (setq gdb-output-sink 'post-emacs)) |
54538 | 1313 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1314 (gdb-resync) |
54538 | 1315 (error "Phase error in gdb-pre-prompt (got %s)" sink))))) |
1316 | |
1317 (defun gdb-prompt (ignored) | |
1318 "An annotation handler for `prompt'. | |
1319 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
|
1320 (when gdb-first-prompt |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1321 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1322 (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
|
1323 (gdb-init-1) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1324 (setq gdb-first-prompt nil)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1325 (let ((sink gdb-output-sink)) |
54538 | 1326 (cond |
1327 ((eq sink 'user) t) | |
1328 ((eq sink 'post-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1329 (setq gdb-output-sink 'user) |
54538 | 1330 (let ((handler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1331 (car (cdr gdb-current-item)))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1332 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1333 (funcall handler)))) |
1334 (t | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1335 (gdb-resync) |
54538 | 1336 (error "Phase error in gdb-prompt (got %s)" sink)))) |
1337 (let ((input (gdb-dequeue-input))) | |
1338 (if input | |
1339 (gdb-send-item input) | |
1340 (progn | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1341 (setq gdb-prompting t) |
54538 | 1342 (gud-display-frame))))) |
1343 | |
1344 (defun gdb-subprompt (ignored) | |
1345 "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
|
1346 (setq gdb-prompting t)) |
54538 | 1347 |
1348 (defun gdb-starting (ignored) | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1349 "An annotation handler for `starting'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1350 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
|
1351 not GDB." |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1352 (setq gdb-active-process t) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1353 (setq gdb-printing t) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1354 (let ((sink gdb-output-sink)) |
54538 | 1355 (cond |
1356 ((eq sink 'user) | |
1357 (progn | |
1358 (setq gud-running t) | |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1359 (setq gdb-inferior-status "running") |
72492
2bf69eaa157d
(gdb-starting): Reset gdb-signalled to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
72481
diff
changeset
|
1360 (setq gdb-signalled nil) |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1361 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1362 (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
|
1363 (gdb-remove-text-properties) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1364 (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
|
1365 (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
|
1366 (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
|
1367 (setq gdb-stack-position nil) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1368 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1369 (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
|
1370 (t |
58420
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 `starting' annotation"))))) |
54538 | 1373 |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1374 (defun gdb-signal (ignored) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1375 (setq gdb-inferior-status "signal") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1376 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1377 (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
|
1378 (gdb-stopping ignored)) |
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1379 |
54538 | 1380 (defun gdb-stopping (ignored) |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1381 "An annotation handler for `breakpoint' and other annotations. |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1382 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
|
1383 being debugged." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
1384 (if gdb-use-separate-io-buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1385 (let ((sink gdb-output-sink)) |
54729
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1386 (cond |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
1387 ((eq sink 'inferior) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1388 (setq gdb-output-sink 'user)) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1389 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1390 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1391 (error "Unexpected stopping annotation")))))) |
54538 | 1392 |
61896
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1393 (defun gdb-exited (ignored) |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1394 "An annotation handler for `exited' and `signalled'. |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1395 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
|
1396 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
|
1397 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
|
1398 directives." |
e8b38798dd7b
(gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
61870
diff
changeset
|
1399 (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
|
1400 (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
|
1401 (setq gdb-overlay-arrow-position nil) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
1402 (setq gdb-stack-position nil) |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
1403 (setq gud-old-arrow nil) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1404 (setq gdb-inferior-status "exited") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1405 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1406 (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
|
1407 (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
|
1408 |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1409 (defun gdb-signalled (ignored) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1410 (setq gdb-signalled t)) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1411 |
54538 | 1412 (defun gdb-frame-begin (ignored) |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1413 (setq gdb-frame-begin t) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1414 (setq gdb-printing nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1415 (let ((sink gdb-output-sink)) |
54538 | 1416 (cond |
1417 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1418 (setq gdb-output-sink 'user)) |
54538 | 1419 ((eq sink 'user) t) |
1420 ((eq sink 'emacs) t) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1421 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1422 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1423 (error "Unexpected frame-begin annotation (%S)" sink))))) |
54538 | 1424 |
71348
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1425 (defcustom gdb-same-frame focus-follows-mouse |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1426 "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
|
1427 :group 'gud |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1428 :type 'boolean |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1429 :version "22.1") |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1430 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1431 (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
|
1432 "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
|
1433 :group 'gud |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1434 :type 'boolean |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1435 :version "22.1") |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1436 |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1437 (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
|
1438 "Toggle trying to find a source frame further up stack. |
78487
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
1439 With prefix argument ARG, look for a source frame further up |
419c5c316b51
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78234
diff
changeset
|
1440 stack if ARG is positive, otherwise don't look further up." |
72235
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1441 (interactive "P") |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1442 (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
|
1443 (if (null arg) |
589dd2ca13b2
(gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents:
72224
diff
changeset
|
1444 (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
|
1445 (> (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
|
1446 (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
|
1447 (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
|
1448 |
54538 | 1449 (defun gdb-stopped (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1450 "An annotation handler for `stopped'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1451 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
|
1452 sink to `user' in `gdb-stopping', that is fine." |
54538 | 1453 (setq gud-running nil) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1454 (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
|
1455 (if (and gdb-frame-begin gdb-printing) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1456 (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
|
1457 ;;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
|
1458 ;;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
|
1459 (if gdb-same-frame |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1460 (gdb-display-gdb-buffer) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
1461 (gdb-frame-gdb-buffer)) |
72200
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1462 (if gdb-find-source-frame |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
1463 ;;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
|
1464 (setq gdb-look-up-stack |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1465 (if (gdb-get-buffer 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1466 'keep |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1467 (progn |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1468 (gdb-get-buffer-create 'gdb-stack-buffer) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1469 (gdb-invalidate-frames) |
46549662dfe0
(gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
72158
diff
changeset
|
1470 'delete)))))) |
69510
43a2ed622bbd
(gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69475
diff
changeset
|
1471 (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
|
1472 (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
|
1473 (setq gdb-inferior-status "stopped") |
72113
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1474 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
1475 (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
|
1476 (let ((sink gdb-output-sink)) |
54538 | 1477 (cond |
1478 ((eq sink 'inferior) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1479 (setq gdb-output-sink 'user)) |
54538 | 1480 ((eq sink 'user) t) |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1481 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1482 (gdb-resync) |
69106
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1483 (error "Unexpected stopped annotation")))) |
3f5044e40e3e
(gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents:
69042
diff
changeset
|
1484 (if gdb-signalled (gdb-exited ignored))) |
54538 | 1485 |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1486 (defun gdb-error (ignored) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1487 (setq gdb-error (not gdb-error))) |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1488 |
54538 | 1489 (defun gdb-post-prompt (ignored) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1490 "An annotation handler for `post-prompt'. |
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1491 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
|
1492 happens to be appropriate." |
69234
67e921172c0d
(gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents:
69214
diff
changeset
|
1493 ;; 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
|
1494 ;; yet. |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1495 (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
|
1496 (gdb-get-selected-frame) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1497 (gdb-invalidate-frames) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
1498 ;; 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
|
1499 (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
|
1500 (gdb-invalidate-breakpoints) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1501 ;; 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
|
1502 ;; so gdb-pc-address is updated. |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1503 ;; (gdb-invalidate-assembler) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1504 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1505 (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
|
1506 (gdb-invalidate-registers) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1507 (gdb-get-changed-registers) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1508 (gdb-invalidate-registers-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1509 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1510 (gdb-invalidate-memory) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1511 (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
|
1512 (gdb-invalidate-locals) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1513 (gdb-invalidate-locals-1)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1514 |
63358
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1515 (gdb-invalidate-threads) |
7d3302b1aa9b
(gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents:
63033
diff
changeset
|
1516 (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
|
1517 ;; FIXME: with GDB-6 on Darwin, this might very well work. |
64654 | 1518 ;; 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
|
1519 (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
|
1520 (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
|
1521 (gdb-var-update) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1522 (gdb-var-update-1))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
1523 (setq gdb-first-post-prompt nil) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1524 (let ((sink gdb-output-sink)) |
54538 | 1525 (cond |
1526 ((eq sink 'user) t) | |
1527 ((eq sink 'pre-emacs) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1528 (setq gdb-output-sink 'emacs)) |
54538 | 1529 (t |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1530 (gdb-resync) |
54538 | 1531 (error "Phase error in gdb-post-prompt (got %s)" sink))))) |
1532 | |
69350
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1533 (defconst gdb-buffer-list |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1534 '(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
|
1535 |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1536 (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
|
1537 (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
|
1538 (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
|
1539 (if buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1540 (with-current-buffer buffer |
d3742811a570
(gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents:
69325
diff
changeset
|
1541 (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
|
1542 (remove-text-properties |
69359
e184d816a2b1
(gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69350
diff
changeset
|
1543 (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
|
1544 |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1545 ;; 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
|
1546 ;; 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
|
1547 ;; visited breakpoint is, use that window. |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1548 (defun gdb-display-source-buffer (buffer) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1549 (let* ((last-window (if gud-last-last-frame |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1550 (get-buffer-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1551 (gud-find-file (car gud-last-last-frame))))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1552 (source-window (or last-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1553 (if (and gdb-source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1554 (window-live-p gdb-source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1555 gdb-source-window)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1556 (when source-window |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1557 (setq gdb-source-window source-window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1558 (set-window-buffer source-window buffer)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1559 source-window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1560 |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1561 ;; Derived from gud-gdb-marker-regexp |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1562 (defvar gdb-fullname-regexp |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1563 (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*")) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1564 |
54538 | 1565 (defun gud-gdba-marker-filter (string) |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1566 "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
|
1567 (if gdb-flush-pending-output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1568 nil |
69108
8ff0077b3342
(gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents:
69106
diff
changeset
|
1569 (when gdb-enable-debug |
75367
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1570 (push (cons 'recv string) gdb-debug-log) |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1571 (if (and gdb-debug-log-max |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1572 (> (length gdb-debug-log) gdb-debug-log-max)) |
bab23bcfde6e
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75354
diff
changeset
|
1573 (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil))) |
64654 | 1574 ;; 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
|
1575 (setq gud-marker-acc (concat gud-marker-acc string)) |
64654 | 1576 ;; 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
|
1577 (let ((output "")) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1578 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1579 ;; 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
|
1580 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1581 (let ((annotation (match-string 1 gud-marker-acc)) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1582 (before (substring gud-marker-acc 0 (match-beginning 0))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1583 (after (substring gud-marker-acc (match-end 0)))) |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1584 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1585 ;; 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
|
1586 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1587 (let* ((annotation-type (match-string 1 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1588 (annotation-arguments (match-string 2 annotation)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1589 (annotation-rule (assoc annotation-type |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1590 gdb-annotation-rules)) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1591 (fullname (string-match gdb-fullname-regexp annotation-type))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1592 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1593 ;; Stuff prior to the match is just ordinary output. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1594 ;; It is either concatenated to OUTPUT or directed |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1595 ;; elsewhere. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1596 (setq output |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1597 (gdb-concat-output output |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1598 (concat before (if fullname "\n")))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1599 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1600 ;; Take that stuff off the gud-marker-acc. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1601 (setq gud-marker-acc after) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1602 |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1603 ;; Call the handler for this annotation. |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1604 (if annotation-rule |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1605 (funcall (car (cdr annotation-rule)) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1606 annotation-arguments) |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1607 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1608 ;; Switch to gud-gdb-marker-filter if appropriate. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1609 (when fullname |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1610 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1611 ;; Extract the frame position from the marker. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1612 (setq gud-last-frame (cons (match-string 1 annotation) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1613 (string-to-number |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1614 (match-string 2 annotation)))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1615 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1616 (set (make-local-variable 'gud-minor-mode) 'gdb) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1617 (set (make-local-variable 'gud-marker-filter) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1618 'gud-gdb-marker-filter))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1619 |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1620 ;; Else the annotation is not recognized. Ignore it silently, |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1621 ;; so that GDB can add new annotations without causing |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1622 ;; us to blow up. |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1623 ))) |
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
1624 |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1625 ;; 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
|
1626 ;; 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
|
1627 (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
|
1628 gud-marker-acc) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1629 (progn |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1630 ;; 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
|
1631 (setq output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1632 (gdb-concat-output output |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1633 (substring gud-marker-acc 0 |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1634 (match-beginning 0)))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1635 ;; |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1636 ;; 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
|
1637 (setq gud-marker-acc (substring gud-marker-acc |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1638 (match-beginning 0)))) |
54538 | 1639 ;; |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1640 ;; In case we know the gud-marker-acc contains no partial annotations: |
54538 | 1641 (progn |
58431
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1642 (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
|
1643 (setq gud-marker-acc ""))) |
da65edef151e
(gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
58420
diff
changeset
|
1644 output))) |
54538 | 1645 |
1646 (defun gdb-concat-output (so-far new) | |
63653
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1647 (if gdb-error |
ec766f32b118
(gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
63443
diff
changeset
|
1648 (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
|
1649 (let ((sink gdb-output-sink)) |
54538 | 1650 (cond |
1651 ((eq sink 'user) (concat so-far new)) | |
1652 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far) | |
1653 ((eq sink 'emacs) | |
1654 (gdb-append-to-partial-output new) | |
1655 so-far) | |
1656 ((eq sink 'inferior) | |
1657 (gdb-append-to-inferior-io new) | |
1658 so-far) | |
58420
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1659 (t |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1660 (gdb-resync) |
97e4fc5c7297
(gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
58049
diff
changeset
|
1661 (error "Bogon output sink %S" sink))))) |
54538 | 1662 |
1663 (defun gdb-append-to-partial-output (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1664 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1665 (goto-char (point-max)) |
1666 (insert string))) | |
1667 | |
1668 (defun gdb-clear-partial-output () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1669 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
54538 | 1670 (erase-buffer))) |
1671 | |
1672 (defun gdb-append-to-inferior-io (string) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1673 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1674 (goto-char (point-max)) |
1675 (insert-before-markers string)) | |
1676 (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
|
1677 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t))) |
54538 | 1678 |
1679 (defun gdb-clear-inferior-io () | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1680 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
54538 | 1681 (erase-buffer))) |
1682 | |
1683 | |
1684 ;; One trick is to have a command who's output is always available in a buffer | |
1685 ;; of it's own, and is always up to date. We build several buffers of this | |
1686 ;; type. | |
1687 ;; | |
1688 ;; There are two aspects to this: gdb has to tell us when the output for that | |
1689 ;; command might have changed, and we have to be able to run the command | |
1690 ;; behind the user's back. | |
1691 ;; | |
1692 ;; The output phasing associated with the variable gdb-output-sink | |
1693 ;; help us to run commands behind the user's back. | |
1694 ;; | |
1695 ;; Below is the code for specificly managing buffers of output from one | |
1696 ;; command. | |
1697 ;; | |
1698 | |
1699 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | |
1700 ;; It adds an input for the command we are tracking. It should be the | |
1701 ;; annotation rule binding of whatever gdb sends to tell us this command | |
1702 ;; might have changed it's output. | |
1703 ;; | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1704 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
54538 | 1705 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
1706 ;; input in the input queue (see comment about ``gdb communications'' above). | |
1707 | |
1708 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command | |
1709 output-handler) | |
1710 `(defun ,name (&optional ignored) | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1711 (if (and ,demand-predicate |
54538 | 1712 (not (member ',name |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1713 gdb-pending-triggers))) |
54538 | 1714 (progn |
1715 (gdb-enqueue-input | |
1716 (list ,gdb-command ',output-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1717 (push ',name gdb-pending-triggers))))) |
54538 | 1718 |
1719 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun) | |
1720 `(defun ,name () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1721 (setq gdb-pending-triggers |
54538 | 1722 (delq ',trigger |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
1723 gdb-pending-triggers)) |
54538 | 1724 (let ((buf (gdb-get-buffer ',buf-key))) |
1725 (and buf | |
1726 (with-current-buffer buf | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1727 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1728 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1729 (p (window-point window)) |
54538 | 1730 (buffer-read-only nil)) |
1731 (erase-buffer) | |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1732 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 1733 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
1734 (set-window-start window start) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
1735 (set-window-point window p))))) |
54538 | 1736 ;; put customisation here |
1737 (,custom-defun))) | |
1738 | |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1739 (defmacro def-gdb-auto-updated-buffer (buffer-key |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1740 trigger-name gdb-command |
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
1741 output-handler-name custom-defun) |
54538 | 1742 `(progn |
1743 (def-gdb-auto-update-trigger ,trigger-name | |
1744 ;; The demand predicate: | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
1745 (gdb-get-buffer ',buffer-key) |
54538 | 1746 ,gdb-command |
1747 ,output-handler-name) | |
1748 (def-gdb-auto-update-handler ,output-handler-name | |
1749 ,trigger-name ,buffer-key ,custom-defun))) | |
1750 | |
1751 | |
1752 ;; | |
1753 ;; Breakpoint buffer : This displays the output of `info breakpoints'. | |
1754 ;; | |
1755 (gdb-set-buffer-rules 'gdb-breakpoints-buffer | |
1756 'gdb-breakpoints-buffer-name | |
1757 'gdb-breakpoints-mode) | |
1758 | |
1759 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer | |
1760 ;; This defines the auto update rule for buffers of type | |
1761 ;; `gdb-breakpoints-buffer'. | |
1762 ;; | |
1763 ;; It defines a function to serve as the annotation handler that | |
1764 ;; handles the `foo-invalidated' message. That function is called: | |
1765 gdb-invalidate-breakpoints | |
1766 ;; | |
1767 ;; To update the buffer, this command is sent to gdb. | |
1768 "server info breakpoints\n" | |
1769 ;; | |
1770 ;; This also defines a function to be the handler for the output | |
1771 ;; from the command above. That function will copy the output into | |
1772 ;; the appropriately typed buffer. That function will be called: | |
1773 gdb-info-breakpoints-handler | |
1774 ;; buffer specific functions | |
1775 gdb-info-breakpoints-custom) | |
1776 | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1777 (defconst breakpoint-xpm-data |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1778 "/* XPM */ |
54538 | 1779 static char *magick[] = { |
1780 /* columns rows colors chars-per-pixel */ | |
1781 \"10 10 2 1\", | |
1782 \" c red\", | |
1783 \"+ c None\", | |
1784 /* pixels */ | |
1785 \"+++ +++\", | |
1786 \"++ ++\", | |
1787 \"+ +\", | |
1788 \" \", | |
1789 \" \", | |
1790 \" \", | |
1791 \" \", | |
1792 \"+ +\", | |
1793 \"++ ++\", | |
1794 \"+++ +++\", | |
1795 };" | |
1796 "XPM data used for breakpoint icon.") | |
1797 | |
1798 (defconst breakpoint-enabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1799 "P1 |
54538 | 1800 10 10\", |
1801 0 0 0 0 1 1 1 1 0 0 0 0 | |
1802 0 0 0 1 1 1 1 1 1 0 0 0 | |
1803 0 0 1 1 1 1 1 1 1 1 0 0 | |
1804 0 1 1 1 1 1 1 1 1 1 1 0 | |
1805 0 1 1 1 1 1 1 1 1 1 1 0 | |
1806 0 1 1 1 1 1 1 1 1 1 1 0 | |
1807 0 1 1 1 1 1 1 1 1 1 1 0 | |
1808 0 0 1 1 1 1 1 1 1 1 0 0 | |
1809 0 0 0 1 1 1 1 1 1 0 0 0 | |
1810 0 0 0 0 1 1 1 1 0 0 0 0" | |
1811 "PBM data used for enabled breakpoint icon.") | |
1812 | |
1813 (defconst breakpoint-disabled-pbm-data | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1814 "P1 |
54538 | 1815 10 10\", |
1816 0 0 1 0 1 0 1 0 0 0 | |
1817 0 1 0 1 0 1 0 1 0 0 | |
1818 1 0 1 0 1 0 1 0 1 0 | |
1819 0 1 0 1 0 1 0 1 0 1 | |
1820 1 0 1 0 1 0 1 0 1 0 | |
1821 0 1 0 1 0 1 0 1 0 1 | |
1822 1 0 1 0 1 0 1 0 1 0 | |
1823 0 1 0 1 0 1 0 1 0 1 | |
1824 0 0 1 0 1 0 1 0 1 0 | |
1825 0 0 0 1 0 1 0 1 0 0" | |
1826 "PBM data used for disabled breakpoint icon.") | |
1827 | |
1828 (defvar breakpoint-enabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1829 "Icon for enabled breakpoint in display margin.") |
54538 | 1830 |
1831 (defvar breakpoint-disabled-icon nil | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
1832 "Icon for disabled breakpoint in display margin.") |
54538 | 1833 |
57982
641cb7192482
Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents:
57851
diff
changeset
|
1834 (and (display-images-p) |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1835 ;; 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
|
1836 (define-fringe-bitmap 'breakpoint |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1837 "\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
|
1838 ;; 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
|
1839 (define-fringe-bitmap 'hollow-right-triangle |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
1840 "\xe0\x90\x88\x84\x84\x88\x90\xe0")) |
54538 | 1841 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1842 (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
|
1843 '((t |
78112
6ad309ee5f4e
* replace.el (match): Use yellow1 instead of yellow.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76955
diff
changeset
|
1844 :foreground "red1" |
60869
88ef15014617
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents:
60839
diff
changeset
|
1845 :weight bold)) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1846 "Face for enabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1847 :group 'gud) |
54538 | 1848 |
60760
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
1849 (defface breakpoint-disabled |
76955
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1850 '((((class color) (min-colors 88)) :foreground "grey70") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1851 ;; Ensure that on low-color displays that we end up something visible. |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1852 (((class color) (min-colors 8) (background light)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1853 :foreground "black") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1854 (((class color) (min-colors 8) (background dark)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1855 :foreground "white") |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1856 (((type tty) (class mono)) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1857 :inverse-video t) |
1056094c2006
(breakpoint-disabled): Tweak face (again)
Nick Roberts <nickrob@snap.net.nz>
parents:
76238
diff
changeset
|
1858 (t :background "gray")) |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1859 "Face for disabled breakpoint icon in fringe." |
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
1860 :group 'gud) |
54538 | 1861 |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
1862 (defconst gdb-breakpoint-regexp |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
1863 "\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\s-+\\(.\\)\\s-+") |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
1864 |
64654 | 1865 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). |
54538 | 1866 (defun gdb-info-breakpoints-custom () |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1867 (let ((flag) (bptno)) |
64654 | 1868 ;; Remove all breakpoint-icons in source buffers but not assembler buffer. |
54538 | 1869 (dolist (buffer (buffer-list)) |
1870 (with-current-buffer buffer | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
1871 (if (and (memq gud-minor-mode '(gdba gdbmi)) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
1872 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name)))) |
54538 | 1873 (gdb-remove-breakpoint-icons (point-min) (point-max))))) |
1874 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) | |
1875 (save-excursion | |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1876 (let ((buffer-read-only nil)) |
54538 | 1877 (goto-char (point-min)) |
1878 (while (< (point) (- (point-max) 1)) | |
1879 (forward-line 1) | |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1880 (if (looking-at gdb-breakpoint-regexp) |
54538 | 1881 (progn |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1882 (setq bptno (match-string 1)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1883 (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
|
1884 (add-text-properties |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1885 (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
|
1886 (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
|
1887 '(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
|
1888 '(face font-lock-type-face))) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1889 (let ((bl (point)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1890 (el (line-end-position))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1891 (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
|
1892 (progn |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1893 (add-text-properties |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1894 (match-beginning 1) (match-end 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1895 '(face font-lock-function-name-face)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1896 (looking-at "\\(\\S-+\\):\\([0-9]+\\)") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1897 (let ((line (match-string 2)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1898 (file (match-string 1))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1899 (add-text-properties bl el |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1900 '(mouse-face highlight |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1901 help-echo "mouse-2, RET: visit breakpoint")) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1902 (unless (file-exists-p file) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1903 (setq file (cdr (assoc bptno gdb-location-alist)))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1904 (if (and file |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1905 (not (string-equal file "File not found"))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1906 (with-current-buffer |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1907 (find-file-noselect file 'nowarn) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1908 (set (make-local-variable 'gud-minor-mode) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1909 'gdba) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1910 (set (make-local-variable 'tool-bar-map) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1911 gud-tool-bar-map) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1912 ;; Only want one breakpoint icon at each |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1913 ;; location. |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1914 (save-excursion |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1915 (goto-line (string-to-number line)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1916 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1917 (gdb-enqueue-input |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1918 (list |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1919 (concat gdb-server-prefix "list " |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1920 (match-string-no-properties 1) ":1\n") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1921 'ignore)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1922 (gdb-enqueue-input |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1923 (list (concat gdb-server-prefix "info source\n") |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1924 `(lambda () (gdb-get-location |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1925 ,bptno ,line ,flag))))))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1926 (if (re-search-forward |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1927 "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1928 el t) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1929 (add-text-properties |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1930 (match-beginning 1) (match-end 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1931 '(face font-lock-function-name-face)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1932 (end-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1933 (re-search-backward "\\s-\\(\\S-*\\)" |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1934 bl t) |
72158
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1935 (add-text-properties |
89c27eb47328
(gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents:
72113
diff
changeset
|
1936 (match-beginning 1) (match-end 1) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
1937 '(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
|
1938 (end-of-line)))))) |
54962
c3272c09f927
(gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents:
54901
diff
changeset
|
1939 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) |
54538 | 1940 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1941 (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
|
1942 "Set/clear breakpoint in left fringe/margin with mouse click." |
54538 | 1943 (interactive "e") |
1944 (mouse-minibuffer-check event) | |
1945 (let ((posn (event-end event))) | |
1946 (if (numberp (posn-point posn)) | |
1947 (with-selected-window (posn-window posn) | |
1948 (save-excursion | |
1949 (goto-char (posn-point posn)) | |
1950 (if (or (posn-object posn) | |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
1951 (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
|
1952 'breakpoint)) |
54538 | 1953 (gud-remove nil) |
1954 (gud-break nil))))))) | |
1955 | |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1956 (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
|
1957 "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
|
1958 (interactive "e") |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1959 (mouse-minibuffer-check event) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1960 (let ((posn (event-end event))) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1961 (if (numberp (posn-point posn)) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1962 (with-selected-window (posn-window posn) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1963 (save-excursion |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1964 (goto-char (posn-point posn)) |
64654 | 1965 (if (posn-object posn) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1966 (gdb-enqueue-input |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1967 (list |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1968 (let ((bptno (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1969 0 'gdb-bptno (car (posn-string posn))))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1970 (concat gdb-server-prefix |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1971 (if (get-text-property |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1972 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
|
1973 "disable " |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
1974 "enable ") |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1975 bptno "\n")) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1976 'ignore)))))))) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1977 |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1978 (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
|
1979 "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
|
1980 (interactive "e") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1981 (mouse-minibuffer-check event) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1982 (let* ((posn (event-end event)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1983 (pos (posn-point posn)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1984 obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1985 (when (numberp pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1986 (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
|
1987 (save-excursion |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1988 (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
|
1989 (goto-char pos) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1990 (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
|
1991 (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
|
1992 (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
|
1993 (when (stringp obj) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1994 (gdb-enqueue-input |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1995 (list |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
1996 (concat gdb-server-prefix |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1997 (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
|
1998 "disable " |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
1999 "enable ") |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
2000 (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
|
2001 'ignore)))))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2002 |
54538 | 2003 (defun gdb-breakpoints-buffer-name () |
2004 (with-current-buffer gud-comint-buffer | |
2005 (concat "*breakpoints of " (gdb-get-target-string) "*"))) | |
2006 | |
2007 (defun gdb-display-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2008 "Display status of user-settable breakpoints." |
54538 | 2009 (interactive) |
2010 (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
|
2011 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t)) |
54538 | 2012 |
2013 (defun gdb-frame-breakpoints-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2014 "Display status of user-settable breakpoints in a new frame." |
54538 | 2015 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2016 (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
|
2017 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2018 (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer)))) |
54538 | 2019 |
2020 (defvar gdb-breakpoints-mode-map | |
2021 (let ((map (make-sparse-keymap)) | |
2022 (menu (make-sparse-keymap "Breakpoints"))) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2023 (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
|
2024 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
54538 | 2025 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2026 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
54538 | 2027 (suppress-keymap map) |
2028 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) | |
2029 (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
|
2030 (define-key map "D" 'gdb-delete-breakpoint) |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2031 ;; 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
|
2032 (define-key map "q" 'gdb-delete-frame-or-window) |
54538 | 2033 (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
|
2034 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2035 (define-key map [follow-link] 'mouse-face) |
54538 | 2036 map)) |
2037 | |
68664
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2038 (defun gdb-delete-frame-or-window () |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2039 "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
|
2040 (interactive) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2041 (if (one-window-p) (delete-frame) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2042 (delete-window))) |
e444fe32e1b4
(gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents:
67891
diff
changeset
|
2043 |
54538 | 2044 (defun gdb-breakpoints-mode () |
2045 "Major mode for gdb breakpoints. | |
2046 | |
2047 \\{gdb-breakpoints-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2048 (kill-all-local-variables) |
54538 | 2049 (setq major-mode 'gdb-breakpoints-mode) |
2050 (setq mode-name "Breakpoints") | |
2051 (use-local-map gdb-breakpoints-mode-map) | |
2052 (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
|
2053 (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
|
2054 (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
|
2055 'gdb-invalidate-breakpoints |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2056 'gdbmi-invalidate-breakpoints)) |
54538 | 2057 |
2058 (defun gdb-toggle-breakpoint () | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
2059 "Enable/disable breakpoint at current line." |
54538 | 2060 (interactive) |
2061 (save-excursion | |
2062 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2063 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2064 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2065 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2066 (concat gdb-server-prefix |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2067 (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
|
2068 "disable " |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2069 "enable ") |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2070 (match-string 1) "\n") 'ignore)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2071 (error "Not recognized as break/watchpoint line")))) |
54538 | 2072 |
2073 (defun gdb-delete-breakpoint () | |
2074 "Delete the breakpoint at current line." | |
2075 (interactive) | |
2076 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2077 (if (looking-at gdb-breakpoint-regexp) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2078 (gdb-enqueue-input |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2079 (list |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2080 (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
|
2081 (error "Not recognized as break/watchpoint line"))) |
54538 | 2082 |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2083 (defun gdb-goto-breakpoint (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2084 "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
|
2085 (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
|
2086 (if event (posn-set-point (event-end event))) |
54538 | 2087 (save-excursion |
2088 (beginning-of-line 1) | |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2089 (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
|
2090 (let ((bptno (match-string 1)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2091 (file (match-string 2)) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
2092 (line (match-string 3))) |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2093 (save-selected-window |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2094 (let* ((buffer (find-file-noselect |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2095 (if (file-exists-p file) file |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
2096 (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
|
2097 (window (or (gdb-display-source-buffer buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2098 (display-buffer buffer)))) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2099 (setq gdb-source-window window) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2100 (with-current-buffer buffer |
56330
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2101 (goto-line (string-to-number line)) |
a76e88488fd7
(gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents:
56285
diff
changeset
|
2102 (set-window-point window (point)))))) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2103 (error "No location specified.")))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2104 |
54538 | 2105 |
2106 ;; Frames buffer. This displays a perpetually correct bactracktrace | |
2107 ;; (from the command `where'). | |
2108 ;; | |
2109 ;; Alas, if your stack is deep, it is costly. | |
2110 ;; | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2111 (defcustom gdb-max-frames 40 |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2112 "Maximum number of frames displayed in call stack." |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2113 :type 'integer |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2114 :group 'gud |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2115 :version "22.1") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2116 |
54538 | 2117 (gdb-set-buffer-rules 'gdb-stack-buffer |
2118 'gdb-stack-buffer-name | |
2119 'gdb-frames-mode) | |
2120 | |
2121 (def-gdb-auto-updated-buffer gdb-stack-buffer | |
2122 gdb-invalidate-frames | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2123 (concat "server info stack " (number-to-string gdb-max-frames) "\n") |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2124 gdb-info-stack-handler |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2125 gdb-info-stack-custom) |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2126 |
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2127 (defun gdb-info-stack-custom () |
54538 | 2128 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2129 (let (move-to) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2130 (save-excursion |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2131 (unless (eq gdb-look-up-stack 'delete) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2132 (let ((buffer-read-only nil) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2133 bl el) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2134 (goto-char (point-min)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2135 (while (< (point) (point-max)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2136 (setq bl (line-beginning-position) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2137 el (line-end-position)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2138 (when (looking-at "#") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2139 (add-text-properties bl el |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2140 '(mouse-face highlight |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2141 help-echo "mouse-2, RET: Select frame"))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2142 (goto-char bl) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2143 (when (looking-at "^#\\([0-9]+\\)") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2144 (when (string-equal (match-string 1) gdb-frame-number) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2145 (if (> (car (window-fringes)) 0) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2146 (progn |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2147 (or gdb-stack-position |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2148 (setq gdb-stack-position (make-marker))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2149 (set-marker gdb-stack-position (point)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2150 (setq move-to gdb-stack-position)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2151 (put-text-property bl (+ bl 4) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2152 'face '(:inverse-video t)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2153 (setq move-to bl))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2154 (when (re-search-forward |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2155 (concat |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2156 (if (string-equal (match-string 1) "0") "" " in ") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2157 "\\([^ ]+\\) (") el t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2158 (put-text-property (match-beginning 1) (match-end 1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2159 'face font-lock-function-name-face) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2160 (setq bl (match-end 0)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2161 (while (re-search-forward "<\\([^>]+\\)>" el t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2162 (put-text-property (match-beginning 1) (match-end 1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2163 'face font-lock-function-name-face)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2164 (goto-char bl) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2165 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2166 (put-text-property (match-beginning 1) (match-end 1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2167 'face font-lock-variable-name-face)))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2168 (forward-line 1)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2169 (forward-line -1) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2170 (when (looking-at "(More stack frames follow...)") |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2171 (add-text-properties (match-beginning 0) (match-end 0) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2172 '(mouse-face highlight |
79036
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2173 gdb-max-frames t |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2174 help-echo |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2175 "mouse-2, RET: customize gdb-max-frames to see more frames"))))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2176 (when gdb-look-up-stack |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2177 (goto-char (point-min)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2178 (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2179 (let ((start (line-beginning-position)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2180 (file (match-string 1)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2181 (line (match-string 2))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2182 (re-search-backward "^#*\\([0-9]+\\)" start t) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2183 (gdb-enqueue-input |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2184 (list (concat gdb-server-prefix "frame " |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2185 (match-string 1) "\n") 'gdb-set-hollow)) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2186 (gdb-enqueue-input |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2187 (list (concat gdb-server-prefix "frame 0\n") 'ignore)))))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2188 (when move-to |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2189 (let ((window (get-buffer-window (current-buffer) 0))) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2190 (when window |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2191 (with-selected-window window |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2192 (goto-char move-to) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2193 (unless (pos-visible-in-window-p) |
ef2bf5b448b2
(gdb-info-stack-custom): Ensure current frame is visible.
Nick Roberts <nickrob@snap.net.nz>
parents:
78957
diff
changeset
|
2194 (recenter '(center))))))))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2195 (if (eq gdb-look-up-stack 'delete) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2196 (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
|
2197 (setq gdb-look-up-stack nil)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2198 |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2199 (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
|
2200 (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
|
2201 (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
|
2202 (setq fringe-indicator-alist |
6564e84a8e09
(gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents:
72200
diff
changeset
|
2203 '((overlay-arrow . hollow-right-triangle)))))) |
54538 | 2204 |
2205 (defun gdb-stack-buffer-name () | |
2206 (with-current-buffer gud-comint-buffer | |
2207 (concat "*stack frames of " (gdb-get-target-string) "*"))) | |
2208 | |
2209 (defun gdb-display-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2210 "Display backtrace of current stack." |
54538 | 2211 (interactive) |
2212 (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
|
2213 (gdb-get-buffer-create 'gdb-stack-buffer) t)) |
54538 | 2214 |
2215 (defun gdb-frame-stack-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2216 "Display backtrace of current stack in a new frame." |
54538 | 2217 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2218 (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
|
2219 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2220 (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer)))) |
54538 | 2221 |
2222 (defvar gdb-frames-mode-map | |
2223 (let ((map (make-sparse-keymap))) | |
2224 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2225 (define-key map "q" 'kill-this-buffer) |
54538 | 2226 (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
|
2227 (define-key map [mouse-2] 'gdb-frames-select) |
60946
a44ce059d2d1
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
60869
diff
changeset
|
2228 (define-key map [follow-link] 'mouse-face) |
54538 | 2229 map)) |
2230 | |
2231 (defun gdb-frames-mode () | |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2232 "Major mode for gdb call stack. |
54538 | 2233 |
2234 \\{gdb-frames-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2235 (kill-all-local-variables) |
54538 | 2236 (setq major-mode 'gdb-frames-mode) |
2237 (setq mode-name "Frames") | |
75690
cb2393a69028
(gdb-frames-mode): Truncate lines in stack
Nick Roberts <nickrob@snap.net.nz>
parents:
75589
diff
changeset
|
2238 (setq gdb-stack-position nil) |
72392
17d65e848c72
(gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents:
72380
diff
changeset
|
2239 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) |
75690
cb2393a69028
(gdb-frames-mode): Truncate lines in stack
Nick Roberts <nickrob@snap.net.nz>
parents:
75589
diff
changeset
|
2240 (setq truncate-lines t) ;; Make it easier to see overlay arrow. |
54538 | 2241 (setq buffer-read-only t) |
2242 (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
|
2243 (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
|
2244 (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
|
2245 'gdb-invalidate-frames |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2246 'gdbmi-invalidate-frames)) |
54538 | 2247 |
2248 (defun gdb-get-frame-number () | |
2249 (save-excursion | |
65861
8063c9277e58
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65859
diff
changeset
|
2250 (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
|
2251 (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
|
2252 (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2253 (n (or (and pos (match-string 1)) "0"))) |
54538 | 2254 n))) |
2255 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2256 (defun gdb-frames-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2257 "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
|
2258 (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
|
2259 (if event (posn-set-point (event-end event))) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2260 (if (get-text-property (point) 'gdb-max-frames) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2261 (progn |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2262 (message-box "After setting gdb-max-frames, you need to enter\n\ |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2263 another GDB command e.g pwd, to see new frames") |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2264 (customize-variable-other-window 'gdb-max-frames)) |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2265 (gdb-enqueue-input |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2266 (list (concat gdb-server-prefix "frame " |
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2267 (gdb-get-frame-number) "\n") 'ignore)))) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2268 |
54538 | 2269 |
2270 ;; Threads buffer. This displays a selectable thread list. | |
2271 ;; | |
2272 (gdb-set-buffer-rules 'gdb-threads-buffer | |
2273 'gdb-threads-buffer-name | |
2274 'gdb-threads-mode) | |
2275 | |
2276 (def-gdb-auto-updated-buffer gdb-threads-buffer | |
2277 gdb-invalidate-threads | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2278 (concat gdb-server-prefix "info threads\n") |
54538 | 2279 gdb-info-threads-handler |
2280 gdb-info-threads-custom) | |
2281 | |
2282 (defun gdb-info-threads-custom () | |
2283 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | |
2284 (let ((buffer-read-only nil)) | |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2285 (save-excursion |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2286 (goto-char (point-min)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2287 (while (< (point) (point-max)) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2288 (unless (looking-at "No ") |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
2289 (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
|
2290 '(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
|
2291 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
|
2292 (forward-line 1)))))) |
54538 | 2293 |
2294 (defun gdb-threads-buffer-name () | |
2295 (with-current-buffer gud-comint-buffer | |
2296 (concat "*threads of " (gdb-get-target-string) "*"))) | |
2297 | |
2298 (defun gdb-display-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2299 "Display IDs of currently known threads." |
54538 | 2300 (interactive) |
2301 (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
|
2302 (gdb-get-buffer-create 'gdb-threads-buffer) t)) |
54538 | 2303 |
2304 (defun gdb-frame-threads-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2305 "Display IDs of currently known threads in a new frame." |
54538 | 2306 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2307 (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
|
2308 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2309 (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer)))) |
54538 | 2310 |
2311 (defvar gdb-threads-mode-map | |
2312 (let ((map (make-sparse-keymap))) | |
2313 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2314 (define-key map "q" 'kill-this-buffer) |
54538 | 2315 (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
|
2316 (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
|
2317 (define-key map [follow-link] 'mouse-face) |
54538 | 2318 map)) |
2319 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2320 (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
|
2321 '((") +\\([^ ]+\\) (" (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
|
2322 ("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
|
2323 ("\\(\\(\\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
|
2324 "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
|
2325 |
54538 | 2326 (defun gdb-threads-mode () |
69609
eba3995e301f
(hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents:
69585
diff
changeset
|
2327 "Major mode for gdb threads. |
54538 | 2328 |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2329 \\{gdb-threads-mode-map}" |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2330 (kill-all-local-variables) |
54538 | 2331 (setq major-mode 'gdb-threads-mode) |
2332 (setq mode-name "Threads") | |
2333 (setq buffer-read-only t) | |
2334 (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
|
2335 (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
|
2336 '(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
|
2337 (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
|
2338 'gdb-invalidate-threads) |
54538 | 2339 |
2340 (defun gdb-get-thread-number () | |
2341 (save-excursion | |
2342 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t) | |
2343 (match-string-no-properties 1))) | |
2344 | |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2345 (defun gdb-threads-select (&optional event) |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2346 "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
|
2347 (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
|
2348 (if event (posn-set-point (event-end event))) |
54538 | 2349 (gdb-enqueue-input |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2350 (list (concat gdb-server-prefix "thread " |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2351 (gdb-get-thread-number) "\n") 'ignore)) |
54538 | 2352 (gud-display-frame)) |
59708
9ce7d8f69f2c
(gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents:
59635
diff
changeset
|
2353 |
54538 | 2354 |
2355 ;; Registers buffer. | |
2356 ;; | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2357 (defcustom gdb-all-registers nil |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2358 "Non-nil means include floating-point registers." |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2359 :type 'boolean |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2360 :group 'gud |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2361 :version "22.1") |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2362 |
54538 | 2363 (gdb-set-buffer-rules 'gdb-registers-buffer |
2364 'gdb-registers-buffer-name | |
2365 'gdb-registers-mode) | |
2366 | |
2367 (def-gdb-auto-updated-buffer gdb-registers-buffer | |
2368 gdb-invalidate-registers | |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2369 (concat |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2370 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n") |
54538 | 2371 gdb-info-registers-handler |
2372 gdb-info-registers-custom) | |
2373 | |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2374 (defun gdb-info-registers-custom () |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2375 (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
|
2376 (save-excursion |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2377 (let ((buffer-read-only nil) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2378 start end) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2379 (goto-char (point-min)) |
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2380 (while (< (point) (point-max)) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2381 (setq start (line-beginning-position)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2382 (setq end (line-end-position)) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2383 (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
|
2384 (unless (string-equal (match-string 0) "The") |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2385 (put-text-property start (match-end 0) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2386 '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
|
2387 (add-text-properties start end |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2388 '(help-echo "mouse-2: edit value" |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2389 mouse-face highlight)))) |
66554
ba2cdafde956
(gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents:
66456
diff
changeset
|
2390 (forward-line 1)))))) |
54538 | 2391 |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2392 (defun gdb-edit-register-value (&optional event) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2393 (interactive (list last-input-event)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2394 (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
|
2395 (if event (posn-set-point (event-end event))) |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2396 (beginning-of-line) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2397 (let* ((register (current-word)) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2398 (value (read-string (format "New value (%s): " register)))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2399 (gdb-enqueue-input |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2400 (list (concat gdb-server-prefix "set $" register "=" value "\n") |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2401 'ignore))))) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2402 |
54538 | 2403 (defvar gdb-registers-mode-map |
2404 (let ((map (make-sparse-keymap))) | |
2405 (suppress-keymap map) | |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2406 (define-key map "\r" 'gdb-edit-register-value) |
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2407 (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
|
2408 (define-key map " " 'gdb-all-registers) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2409 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2410 map)) |
54538 | 2411 |
2412 (defun gdb-registers-mode () | |
2413 "Major mode for gdb registers. | |
2414 | |
2415 \\{gdb-registers-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2416 (kill-all-local-variables) |
54538 | 2417 (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
|
2418 (setq mode-name "Registers") |
54538 | 2419 (setq buffer-read-only t) |
2420 (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
|
2421 (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
|
2422 (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
|
2423 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2424 (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
|
2425 'gdb-invalidate-registers) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2426 'gdb-invalidate-registers-1)) |
54538 | 2427 |
2428 (defun gdb-registers-buffer-name () | |
2429 (with-current-buffer gud-comint-buffer | |
2430 (concat "*registers of " (gdb-get-target-string) "*"))) | |
2431 | |
2432 (defun gdb-display-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2433 "Display integer register contents." |
54538 | 2434 (interactive) |
2435 (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
|
2436 (gdb-get-buffer-create 'gdb-registers-buffer) t)) |
54538 | 2437 |
2438 (defun gdb-frame-registers-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2439 "Display integer register contents in a new frame." |
54538 | 2440 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2441 (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
|
2442 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2443 (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer)))) |
59808 | 2444 |
67309
ee8894ca3f64
(gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents:
67233
diff
changeset
|
2445 (defun gdb-all-registers () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2446 "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
|
2447 (interactive) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2448 (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
|
2449 (if gdb-all-registers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2450 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2451 (setq gdb-all-registers nil) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2452 (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
|
2453 (setq mode-name "Registers"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2454 (setq gdb-all-registers t) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2455 (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
|
2456 (setq mode-name "Registers:All"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2457 (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
|
2458 (if gdb-all-registers "en" "dis"))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2459 (gdb-invalidate-registers))) |
62826
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2460 |
787677122f52
(gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62723
diff
changeset
|
2461 |
59808 | 2462 ;; Memory buffer. |
2463 ;; | |
2464 (defcustom gdb-memory-repeat-count 32 | |
2465 "Number of data items in memory window." | |
2466 :type 'integer | |
2467 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2468 :version "22.1") |
59808 | 2469 |
2470 (defcustom gdb-memory-format "x" | |
2471 "Display format of data items in memory window." | |
2472 :type '(choice (const :tag "Hexadecimal" "x") | |
2473 (const :tag "Signed decimal" "d") | |
2474 (const :tag "Unsigned decimal" "u") | |
2475 (const :tag "Octal" "o") | |
2476 (const :tag "Binary" "t")) | |
2477 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2478 :version "22.1") |
59808 | 2479 |
2480 (defcustom gdb-memory-unit "w" | |
2481 "Unit size of data items in memory window." | |
2482 :type '(choice (const :tag "Byte" "b") | |
2483 (const :tag "Halfword" "h") | |
2484 (const :tag "Word" "w") | |
2485 (const :tag "Giant word" "g")) | |
2486 :group 'gud | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2487 :version "22.1") |
59808 | 2488 |
2489 (gdb-set-buffer-rules 'gdb-memory-buffer | |
2490 'gdb-memory-buffer-name | |
2491 'gdb-memory-mode) | |
2492 | |
2493 (def-gdb-auto-updated-buffer gdb-memory-buffer | |
2494 gdb-invalidate-memory | |
2495 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count) | |
2496 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n") | |
2497 gdb-read-memory-handler | |
2498 gdb-read-memory-custom) | |
2499 | |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2500 (defun gdb-read-memory-custom () |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2501 (save-excursion |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2502 (goto-char (point-min)) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2503 (if (looking-at "0x[[:xdigit:]]+") |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2504 (setq gdb-memory-address (match-string 0))))) |
59808 | 2505 |
2506 (defvar gdb-memory-mode-map | |
2507 (let ((map (make-sparse-keymap))) | |
2508 (suppress-keymap map) | |
2509 (define-key map "q" 'kill-this-buffer) | |
2510 map)) | |
2511 | |
2512 (defun gdb-memory-set-address (event) | |
2513 "Set the start memory address." | |
2514 (interactive "e") | |
2515 (save-selected-window | |
2516 (select-window (posn-window (event-start event))) | |
2517 (let ((arg (read-from-minibuffer "Memory address: "))) | |
2518 (setq gdb-memory-address arg)) | |
2519 (gdb-invalidate-memory))) | |
2520 | |
2521 (defun gdb-memory-set-repeat-count (event) | |
2522 "Set the number of data items in memory window." | |
2523 (interactive "e") | |
2524 (save-selected-window | |
2525 (select-window (posn-window (event-start event))) | |
2526 (let* ((arg (read-from-minibuffer "Repeat count: ")) | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2527 (count (string-to-number arg))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2528 (if (<= count 0) |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2529 (error "Positive numbers only") |
59808 | 2530 (customize-set-variable 'gdb-memory-repeat-count count) |
2531 (gdb-invalidate-memory))))) | |
2532 | |
2533 (defun gdb-memory-format-binary () | |
2534 "Set the display format to binary." | |
2535 (interactive) | |
2536 (customize-set-variable 'gdb-memory-format "t") | |
2537 (gdb-invalidate-memory)) | |
2538 | |
2539 (defun gdb-memory-format-octal () | |
2540 "Set the display format to octal." | |
2541 (interactive) | |
2542 (customize-set-variable 'gdb-memory-format "o") | |
2543 (gdb-invalidate-memory)) | |
2544 | |
2545 (defun gdb-memory-format-unsigned () | |
2546 "Set the display format to unsigned decimal." | |
2547 (interactive) | |
2548 (customize-set-variable 'gdb-memory-format "u") | |
2549 (gdb-invalidate-memory)) | |
2550 | |
2551 (defun gdb-memory-format-signed () | |
2552 "Set the display format to decimal." | |
2553 (interactive) | |
2554 (customize-set-variable 'gdb-memory-format "d") | |
2555 (gdb-invalidate-memory)) | |
2556 | |
2557 (defun gdb-memory-format-hexadecimal () | |
2558 "Set the display format to hexadecimal." | |
2559 (interactive) | |
2560 (customize-set-variable 'gdb-memory-format "x") | |
2561 (gdb-invalidate-memory)) | |
2562 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2563 (defvar gdb-memory-format-map |
59808 | 2564 (let ((map (make-sparse-keymap))) |
2565 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) | |
2566 map) | |
2567 "Keymap to select format in the header line.") | |
2568 | |
2569 (defvar gdb-memory-format-menu (make-sparse-keymap "Format") | |
2570 "Menu of display formats in the header line.") | |
2571 | |
2572 (define-key gdb-memory-format-menu [binary] | |
2573 '(menu-item "Binary" gdb-memory-format-binary | |
2574 :button (:radio . (equal gdb-memory-format "t")))) | |
2575 (define-key gdb-memory-format-menu [octal] | |
2576 '(menu-item "Octal" gdb-memory-format-octal | |
2577 :button (:radio . (equal gdb-memory-format "o")))) | |
2578 (define-key gdb-memory-format-menu [unsigned] | |
2579 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned | |
2580 :button (:radio . (equal gdb-memory-format "u")))) | |
2581 (define-key gdb-memory-format-menu [signed] | |
2582 '(menu-item "Signed Decimal" gdb-memory-format-signed | |
2583 :button (:radio . (equal gdb-memory-format "d")))) | |
2584 (define-key gdb-memory-format-menu [hexadecimal] | |
2585 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal | |
2586 :button (:radio . (equal gdb-memory-format "x")))) | |
2587 | |
2588 (defun gdb-memory-format-menu (event) | |
2589 (interactive "@e") | |
2590 (x-popup-menu event gdb-memory-format-menu)) | |
2591 | |
2592 (defun gdb-memory-format-menu-1 (event) | |
2593 (interactive "e") | |
2594 (save-selected-window | |
2595 (select-window (posn-window (event-start event))) | |
2596 (let* ((selection (gdb-memory-format-menu event)) | |
2597 (binding (and selection (lookup-key gdb-memory-format-menu | |
2598 (vector (car selection)))))) | |
2599 (if binding (call-interactively binding))))) | |
2600 | |
2601 (defun gdb-memory-unit-giant () | |
2602 "Set the unit size to giant words (eight bytes)." | |
2603 (interactive) | |
2604 (customize-set-variable 'gdb-memory-unit "g") | |
2605 (gdb-invalidate-memory)) | |
2606 | |
2607 (defun gdb-memory-unit-word () | |
2608 "Set the unit size to words (four bytes)." | |
2609 (interactive) | |
2610 (customize-set-variable 'gdb-memory-unit "w") | |
2611 (gdb-invalidate-memory)) | |
2612 | |
2613 (defun gdb-memory-unit-halfword () | |
2614 "Set the unit size to halfwords (two bytes)." | |
2615 (interactive) | |
2616 (customize-set-variable 'gdb-memory-unit "h") | |
2617 (gdb-invalidate-memory)) | |
2618 | |
2619 (defun gdb-memory-unit-byte () | |
2620 "Set the unit size to bytes." | |
2621 (interactive) | |
2622 (customize-set-variable 'gdb-memory-unit "b") | |
2623 (gdb-invalidate-memory)) | |
2624 | |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2625 (defvar gdb-memory-unit-map |
59808 | 2626 (let ((map (make-sparse-keymap))) |
2627 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) | |
2628 map) | |
2629 "Keymap to select units in the header line.") | |
2630 | |
2631 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit") | |
2632 "Menu of units in the header line.") | |
2633 | |
2634 (define-key gdb-memory-unit-menu [giantwords] | |
2635 '(menu-item "Giant words" gdb-memory-unit-giant | |
2636 :button (:radio . (equal gdb-memory-unit "g")))) | |
2637 (define-key gdb-memory-unit-menu [words] | |
2638 '(menu-item "Words" gdb-memory-unit-word | |
2639 :button (:radio . (equal gdb-memory-unit "w")))) | |
2640 (define-key gdb-memory-unit-menu [halfwords] | |
2641 '(menu-item "Halfwords" gdb-memory-unit-halfword | |
2642 :button (:radio . (equal gdb-memory-unit "h")))) | |
2643 (define-key gdb-memory-unit-menu [bytes] | |
2644 '(menu-item "Bytes" gdb-memory-unit-byte | |
2645 :button (:radio . (equal gdb-memory-unit "b")))) | |
2646 | |
2647 (defun gdb-memory-unit-menu (event) | |
2648 (interactive "@e") | |
2649 (x-popup-menu event gdb-memory-unit-menu)) | |
2650 | |
2651 (defun gdb-memory-unit-menu-1 (event) | |
2652 (interactive "e") | |
2653 (save-selected-window | |
2654 (select-window (posn-window (event-start event))) | |
2655 (let* ((selection (gdb-memory-unit-menu event)) | |
2656 (binding (and selection (lookup-key gdb-memory-unit-menu | |
2657 (vector (car selection)))))) | |
2658 (if binding (call-interactively binding))))) | |
2659 | |
2660 ;;from make-mode-line-mouse-map | |
2661 (defun gdb-make-header-line-mouse-map (mouse function) "\ | |
2662 Return a keymap with single entry for mouse key MOUSE on the header line. | |
2663 MOUSE is defined to run function FUNCTION with no args in the buffer | |
2664 corresponding to the mode line clicked." | |
2665 (let ((map (make-sparse-keymap))) | |
2666 (define-key map (vector 'header-line mouse) function) | |
2667 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) | |
2668 map)) | |
2669 | |
65855
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2670 (defvar gdb-memory-font-lock-keywords |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2671 '(;; <__function.name+n> |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2672 ("<\\(\\(\\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
|
2673 ) |
97ab21c68453
2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents:
65231
diff
changeset
|
2674 "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
|
2675 |
59808 | 2676 (defun gdb-memory-mode () |
2677 "Major mode for examining memory. | |
2678 | |
2679 \\{gdb-memory-mode-map}" | |
2680 (kill-all-local-variables) | |
2681 (setq major-mode 'gdb-memory-mode) | |
2682 (setq mode-name "Memory") | |
2683 (setq buffer-read-only t) | |
2684 (use-local-map gdb-memory-mode-map) | |
2685 (setq header-line-format | |
2686 '(:eval | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59988
diff
changeset
|
2687 (concat |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2688 "Read address[" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2689 (propertize |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2690 "-" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2691 'face font-lock-warning-face |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2692 'help-echo "mouse-1: decrement address" |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2693 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2694 'local-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2695 (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2696 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2697 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2698 (let ((gdb-memory-address |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2699 ;; Let GDB do the arithmetic. |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2700 (concat |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2701 gdb-memory-address " - " |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2702 (number-to-string |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2703 (* gdb-memory-repeat-count |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2704 (cond ((string= gdb-memory-unit "b") 1) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2705 ((string= gdb-memory-unit "h") 2) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2706 ((string= gdb-memory-unit "w") 4) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2707 ((string= gdb-memory-unit "g") 8))))))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2708 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2709 "|" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2710 (propertize "+" |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2711 'face font-lock-warning-face |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2712 'help-echo "mouse-1: increment address" |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2713 'mouse-face 'mode-line-highlight |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2714 'local-map (gdb-make-header-line-mouse-map |
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2715 'mouse-1 |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2716 (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2717 (let ((gdb-memory-address nil)) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2718 (gdb-invalidate-memory))))) |
62867
366567a93053
(gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents:
62845
diff
changeset
|
2719 "]: " |
59808 | 2720 (propertize gdb-memory-address |
2721 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2722 'help-echo "mouse-1: set memory address" |
62716 | 2723 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2724 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2725 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2726 #'gdb-memory-set-address)) |
59808 | 2727 " Repeat Count: " |
2728 (propertize (number-to-string gdb-memory-repeat-count) | |
2729 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2730 'help-echo "mouse-1: set repeat count" |
62716 | 2731 'mouse-face 'mode-line-highlight |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2732 'local-map (gdb-make-header-line-mouse-map |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2733 'mouse-1 |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2734 #'gdb-memory-set-repeat-count)) |
59808 | 2735 " Display Format: " |
2736 (propertize gdb-memory-format | |
2737 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2738 'help-echo "mouse-3: select display format" |
62716 | 2739 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2740 'local-map gdb-memory-format-map) |
59808 | 2741 " Unit Size: " |
2742 (propertize gdb-memory-unit | |
2743 'face font-lock-warning-face | |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
2744 'help-echo "mouse-3: select unit size" |
62716 | 2745 'mouse-face 'mode-line-highlight |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2746 '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
|
2747 (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
|
2748 '(gdb-memory-font-lock-keywords)) |
59808 | 2749 (run-mode-hooks 'gdb-memory-mode-hook) |
2750 'gdb-invalidate-memory) | |
2751 | |
2752 (defun gdb-memory-buffer-name () | |
2753 (with-current-buffer gud-comint-buffer | |
2754 (concat "*memory of " (gdb-get-target-string) "*"))) | |
2755 | |
2756 (defun gdb-display-memory-buffer () | |
2757 "Display memory contents." | |
2758 (interactive) | |
2759 (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
|
2760 (gdb-get-buffer-create 'gdb-memory-buffer) t)) |
59808 | 2761 |
2762 (defun gdb-frame-memory-buffer () | |
2763 "Display memory contents in a new frame." | |
2764 (interactive) | |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2765 (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
|
2766 (special-display-frame-alist |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2767 (cons '(left-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2768 (cons '(right-fringe . 0) |
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
2769 (cons '(width . 83) gdb-frame-parameters))))) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2770 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) |
54538 | 2771 |
59808 | 2772 |
54538 | 2773 ;; Locals buffer. |
2774 ;; | |
2775 (gdb-set-buffer-rules 'gdb-locals-buffer | |
2776 'gdb-locals-buffer-name | |
2777 'gdb-locals-mode) | |
2778 | |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2779 (def-gdb-auto-update-trigger gdb-invalidate-locals |
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2780 (gdb-get-buffer 'gdb-locals-buffer) |
54538 | 2781 "server info locals\n" |
66456
885272126a8e
(def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
66419
diff
changeset
|
2782 gdb-info-locals-handler) |
54538 | 2783 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
2784 (defvar gdb-locals-watch-map |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2785 (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
|
2786 (suppress-keymap map) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2787 (define-key map "\r" (lambda () (interactive) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2788 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2789 (gud-watch))) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2790 (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
|
2791 (mouse-set-point event) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2792 (beginning-of-line) |
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2793 (gud-watch))) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2794 map) |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2795 "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
|
2796 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2797 (defconst gdb-struct-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2798 (concat (propertize "[struct/union]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2799 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2800 '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
|
2801 '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
|
2802 |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2803 (defconst gdb-array-string |
67125
39c6d2fd1f63
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
67111
diff
changeset
|
2804 (concat " " (propertize "[array]" |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2805 'mouse-face 'highlight |
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
2806 '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
|
2807 '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
|
2808 |
54538 | 2809 ;; Abbreviate for arrays and structures. |
2810 ;; 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
|
2811 (defun gdb-info-locals-handler () |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2812 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
2813 gdb-pending-triggers)) |
54538 | 2814 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer))) |
2815 (with-current-buffer buf | |
2816 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2817 (while (re-search-forward "^[ }].*\n" nil t) |
54538 | 2818 (replace-match "" nil nil)) |
2819 (goto-char (point-min)) | |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2820 (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
|
2821 (replace-match gdb-struct-string nil nil)) |
54538 | 2822 (goto-char (point-min)) |
62614
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
2823 (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
|
2824 (replace-match gdb-array-string nil nil)))) |
54538 | 2825 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2826 (and buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2827 (with-current-buffer buf |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2828 (let* ((window (get-buffer-window buf 0)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2829 (start (window-start window)) |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
2830 (p (window-point window)) |
54538 | 2831 (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
|
2832 (erase-buffer) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2833 (insert-buffer-substring (gdb-get-buffer-create |
54538 | 2834 'gdb-partial-output-buffer)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2835 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2836 (set-window-point window p)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2837 ))) |
54538 | 2838 (run-hooks 'gdb-info-locals-hook)) |
2839 | |
2840 (defvar gdb-locals-mode-map | |
2841 (let ((map (make-sparse-keymap))) | |
2842 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2843 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2844 map)) |
54538 | 2845 |
2846 (defun gdb-locals-mode () | |
2847 "Major mode for gdb locals. | |
2848 | |
2849 \\{gdb-locals-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
2850 (kill-all-local-variables) |
54538 | 2851 (setq major-mode 'gdb-locals-mode) |
62716 | 2852 (setq mode-name (concat "Locals:" gdb-selected-frame)) |
54538 | 2853 (setq buffer-read-only t) |
2854 (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
|
2855 (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
|
2856 '(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
|
2857 (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
|
2858 (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
|
2859 (string-equal gdb-version "pre-6.4")) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2860 'gdb-invalidate-locals |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
2861 'gdb-invalidate-locals-1)) |
54538 | 2862 |
2863 (defun gdb-locals-buffer-name () | |
2864 (with-current-buffer gud-comint-buffer | |
2865 (concat "*locals of " (gdb-get-target-string) "*"))) | |
2866 | |
2867 (defun gdb-display-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2868 "Display local variables of current stack and their values." |
54538 | 2869 (interactive) |
2870 (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
|
2871 (gdb-get-buffer-create 'gdb-locals-buffer) t)) |
54538 | 2872 |
2873 (defun gdb-frame-locals-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2874 "Display local variables of current stack and their values in a new frame." |
54538 | 2875 (interactive) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
2876 (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
|
2877 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
2878 (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer)))) |
54538 | 2879 |
2880 | |
2881 ;;;; 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
|
2882 (defun gdb-display-buffer (buf dedicated &optional size) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2883 (let ((answer (get-buffer-window buf 0)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2884 (must-split nil)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2885 (if answer |
78946
b70291074dcf
(gdb-init-1): Don't set the values
Nick Roberts <nickrob@snap.net.nz>
parents:
78794
diff
changeset
|
2886 (display-buffer buf nil 0) ;Deiconify the frame if necessary. |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2887 ;; The buffer is not yet displayed. |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2888 (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
|
2889 (let ((window (get-lru-window))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2890 (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
|
2891 (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
|
2892 ,gdb-source-window)))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2893 (progn |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2894 (set-window-buffer window buf) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2895 (setq answer window)) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2896 (setq must-split t))) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2897 (if must-split |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2898 (let* ((largest (get-largest-window)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2899 (cur-size (window-height largest)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2900 (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
|
2901 (setq answer (split-window largest new-size)) |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2902 (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
|
2903 (set-window-dedicated-p answer dedicated))) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2904 answer))) |
54538 | 2905 |
2906 | |
2907 ;;; Shared keymap initialization: | |
2908 | |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2909 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2910 (define-key gud-menu-map [displays] |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2911 `(menu-item "GDB-Windows" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2912 :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
|
2913 (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
|
2914 (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
|
2915 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2916 '(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
|
2917 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2918 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2919 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2920 (define-key menu [disassembly] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2921 '("Disassembly" . gdb-display-assembler-buffer)) |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2922 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2923 '("Breakpoints" . gdb-display-breakpoints-buffer)) |
59922
79e9767b47c8
Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents:
59852
diff
changeset
|
2924 (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
|
2925 (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
|
2926 |
54538 | 2927 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
2928 (define-key gud-menu-map [frames] | |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2929 `(menu-item "GDB-Frames" ,menu |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
2930 :visible (memq gud-minor-mode '(gdbmi gdba)))) |
54538 | 2931 (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
|
2932 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
59808 | 2933 (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
|
2934 (define-key menu [inferior] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2935 '(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
|
2936 :enable gdb-use-separate-io-buffer)) |
68938
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2937 (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
|
2938 (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
|
2939 (define-key menu [breakpoints] |
32eebeb631d6
(gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents:
68903
diff
changeset
|
2940 '("Breakpoints" . gdb-frame-breakpoints-buffer)) |
54538 | 2941 (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
|
2942 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))) |
54538 | 2943 |
66886
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
2944 (let ((menu (make-sparse-keymap "GDB-UI/MI"))) |
54538 | 2945 (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
|
2946 `(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
|
2947 ,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
|
2948 (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
|
2949 '(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
|
2950 :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
|
2951 :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
|
2952 :button (:toggle . gdb-find-source-frame))) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2953 (define-key menu [gdb-use-separate-io] |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2954 '(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
|
2955 :visible (eq gud-minor-mode 'gdba) |
72380
37cc9e9df5a4
(gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
72235
diff
changeset
|
2956 :help "Toggle separate IO for debugged program." |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
2957 :button (:toggle . gdb-use-separate-io-buffer))) |
54538 | 2958 (define-key menu [gdb-many-windows] |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2959 '(menu-item "Display Other Windows" gdb-many-windows |
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2960 :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
|
2961 :button (:toggle . gdb-many-windows))) |
63443
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2962 (define-key menu [gdb-restore-windows] |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2963 '(menu-item "Restore Window Layout" gdb-restore-windows |
24c727190495
(gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents:
63358
diff
changeset
|
2964 :help "Restore standard layout for debug session."))) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
2965 |
54538 | 2966 (defun gdb-frame-gdb-buffer () |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2967 "Display GUD buffer in a new frame." |
54538 | 2968 (interactive) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
2969 (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
|
2970 (special-display-frame-alist |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
2971 (remove '(menu-bar-lines) (remove '(tool-bar-lines) |
10a6583c5ff7
(gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
71277
diff
changeset
|
2972 gdb-frame-parameters))) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2973 (same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2974 (display-buffer gud-comint-buffer))) |
54538 | 2975 |
2976 (defun gdb-display-gdb-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
2977 "Display GUD buffer." |
54538 | 2978 (interactive) |
66681
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2979 (let ((same-window-regexps nil)) |
8c0e5dfc2c31
(gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents:
66676
diff
changeset
|
2980 (pop-to-buffer gud-comint-buffer))) |
54538 | 2981 |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2982 (defun gdb-set-window-buffer (name) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2983 (set-window-buffer (selected-window) (get-buffer name)) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2984 (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
|
2985 |
54538 | 2986 (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
|
2987 "Layout the window pattern for `gdb-many-windows'." |
54538 | 2988 (gdb-display-locals-buffer) |
2989 (gdb-display-stack-buffer) | |
2990 (delete-other-windows) | |
2991 (gdb-display-breakpoints-buffer) | |
2992 (delete-other-windows) | |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2993 ; Don't dedicate. |
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
2994 (pop-to-buffer gud-comint-buffer) |
54538 | 2995 (split-window nil ( / ( * (window-height) 3) 4)) |
2996 (split-window nil ( / (window-height) 3)) | |
2997 (split-window-horizontally) | |
2998 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
2999 (gdb-set-window-buffer (gdb-locals-buffer-name)) |
54538 | 3000 (other-window 1) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3001 (switch-to-buffer |
54538 | 3002 (if gud-last-last-frame |
3003 (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
|
3004 (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
|
3005 (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
|
3006 ;; 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
|
3007 ;; 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
|
3008 (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
|
3009 (setq gdb-source-window (selected-window)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3010 (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
|
3011 (split-window-horizontally) |
7bfccd78beed
(gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
54668
diff
changeset
|
3012 (other-window 1) |
61459
c1538e237b52
(gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
60946
diff
changeset
|
3013 (gdb-set-window-buffer |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3014 (gdb-get-buffer-create 'gdb-inferior-io))) |
54538 | 3015 (other-window 1) |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3016 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
54538 | 3017 (split-window-horizontally) |
3018 (other-window 1) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3019 (gdb-set-window-buffer (gdb-breakpoints-buffer-name)) |
54538 | 3020 (other-window 1)) |
3021 | |
3022 (defun gdb-restore-windows () | |
3023 "Restore the basic arrangement of windows used by gdba. | |
3024 This arrangement depends on the value of `gdb-many-windows'." | |
3025 (interactive) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3026 (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
|
3027 (delete-other-windows) |
54538 | 3028 (if gdb-many-windows |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3029 (gdb-setup-windows) |
66676
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3030 (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
|
3031 (split-window) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3032 (other-window 1) |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3033 (switch-to-buffer |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3034 (if gud-last-last-frame |
ecdb869b880e
(gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents:
66637
diff
changeset
|
3035 (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
|
3036 (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
|
3037 (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
|
3038 (other-window 1)))) |
54538 | 3039 |
3040 (defun gdb-reset () | |
57791
d1b93fc4ce47
Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57664
diff
changeset
|
3041 "Exit a debugging session cleanly. |
69214
092d8fdb26e2
(gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
69180
diff
changeset
|
3042 Kills the gdb buffers, and resets variables and the source buffers." |
54538 | 3043 (dolist (buffer (buffer-list)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3044 (unless (eq buffer gud-comint-buffer) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3045 (with-current-buffer buffer |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3046 (if (memq gud-minor-mode '(gdbmi gdba)) |
74924
83f9cf569b3f
(gud-watch): Allow duplicate names for watch
Nick Roberts <nickrob@snap.net.nz>
parents:
74765
diff
changeset
|
3047 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name)) |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3048 (kill-buffer nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3049 (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
|
3050 (setq gud-minor-mode nil) |
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3051 (kill-local-variable 'tool-bar-map) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3052 (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
|
3053 (setq gdb-overlay-arrow-position nil) |
54538 | 3054 (setq overlay-arrow-variable-list |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3055 (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
|
3056 (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
|
3057 (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
|
3058 (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
|
3059 (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
|
3060 (if (boundp 'speedbar-frame) (speedbar-timer-fn)) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3061 (setq gud-running nil) |
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3062 (setq gdb-active-process nil) |
67072
430a3ff7880b
(gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents:
66977
diff
changeset
|
3063 (setq gdb-var-list nil) |
62050
9658387c7d01
(gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents:
61896
diff
changeset
|
3064 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) |
54538 | 3065 |
3066 (defun gdb-source-info () | |
3067 "Find the source file where the program starts and displays it with related | |
3068 buffers." | |
3069 (goto-char (point-min)) | |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3070 (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
|
3071 (looking-at "\\S-+")) |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3072 (setq gdb-main-file (match-string 0))) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3073 (goto-char (point-min)) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3074 (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
|
3075 (setq gdb-macro-info t)) |
58534
c655bc81dfc0
(gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents:
58521
diff
changeset
|
3076 (if gdb-many-windows |
54538 | 3077 (gdb-setup-windows) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3078 (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
|
3079 (if gdb-show-main |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3080 (let ((pop-up-windows t)) |
78794
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
3081 (display-buffer (gud-find-file gdb-main-file))))) |
5f7e08d29d9f
(gdba, gdb-send, gdb-source-info):
Nick Roberts <nickrob@snap.net.nz>
parents:
78541
diff
changeset
|
3082 (setq gdb-ready t)) |
54538 | 3083 |
59988
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3084 (defun gdb-get-location (bptno line flag) |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3085 "Find the directory containing the relevant source file. |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3086 Put in buffer and place breakpoint icon." |
fb52ec059049
(gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59922
diff
changeset
|
3087 (goto-char (point-min)) |
60326
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3088 (catch 'file-not-found |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3089 (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
|
3090 (when (looking-at "\\S-+") |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3091 (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
|
3092 (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
|
3093 (gdb-resync) |
62202
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3094 (unless (assoc bptno gdb-location-alist) |
327af4f748d5
(gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
62136
diff
changeset
|
3095 (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
|
3096 (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
|
3097 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
|
3098 (throw 'file-not-found nil)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3099 (with-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3100 (find-file-noselect (match-string 0)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3101 (save-current-buffer |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3102 (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
|
3103 (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
|
3104 ;; 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
|
3105 (save-excursion |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3106 (goto-line (string-to-number line)) |
47c96976e43d
(gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents:
60153
diff
changeset
|
3107 (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
|
3108 |
60073
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3109 (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
|
3110 |
6fba1da8f37e
(gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
59998
diff
changeset
|
3111 (defun gdb-find-file-hook () |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3112 "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
|
3113 of the current session." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3114 (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
|
3115 ;; 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
|
3116 gud-comint-buffer |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3117 (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
|
3118 '(gdba gdbmi))) |
71113
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3119 ;;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
|
3120 (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
|
3121 (file-name-nondirectory buffer-file-name) |
446eebbf5f35
(gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
71090
diff
changeset
|
3122 buffer-file-name) |
75354
6e5bbaf920de
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
3123 gdb-source-file-list) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3124 (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
|
3125 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3126 (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
|
3127 (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
|
3128 |
54538 | 3129 ;;from put-image |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3130 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) |
54538 | 3131 "Put string PUTSTRING in front of POS in the current buffer. |
3132 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
|
3133 `before-string' string that has a `display' property whose value is |
54538 | 3134 PUTSTRING." |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3135 (let ((string (make-string 1 ?x)) |
54538 | 3136 (buffer (current-buffer))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3137 (setq putstring (copy-sequence putstring)) |
54538 | 3138 (let ((overlay (make-overlay pos pos buffer)) |
3139 (prop (or dprop | |
3140 (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
|
3141 (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
|
3142 (if sprops |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3143 (add-text-properties 0 1 sprops string)) |
54538 | 3144 (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
|
3145 (overlay-put overlay 'before-string string)))) |
54538 | 3146 |
3147 ;;from remove-images | |
3148 (defun gdb-remove-strings (start end &optional buffer) | |
3149 "Remove strings between START and END in BUFFER. | |
3150 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. | |
3151 BUFFER nil or omitted means use the current buffer." | |
3152 (unless buffer | |
3153 (setq buffer (current-buffer))) | |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3154 (dolist (overlay (overlays-in start end)) |
61870
584906b2e6d5
(gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents:
61494
diff
changeset
|
3155 (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
|
3156 (delete-overlay overlay)))) |
54538 | 3157 |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3158 (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
|
3159 (let ((start (- (line-beginning-position) 1)) |
dd9b63b29d80
(gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents:
62202
diff
changeset
|
3160 (end (+ (line-end-position) 1)) |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3161 (putstring (if enabled "B" "b")) |
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3162 (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
|
3163 (add-text-properties |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3164 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
|
3165 putstring) |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3166 (if enabled |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3167 (add-text-properties |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3168 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
|
3169 (add-text-properties |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3170 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) |
54538 | 3171 (gdb-remove-breakpoint-icons start end) |
3172 (if (display-images-p) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3173 (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
|
3174 (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
|
3175 gdb-buffer-fringe-width) 8) |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3176 (gdb-put-string |
54538 | 3177 nil (1+ start) |
57262
df4b0ff293d8
(breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents:
56330
diff
changeset
|
3178 `(left-fringe breakpoint |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3179 ,(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
|
3180 'breakpoint-enabled |
66412
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3181 'breakpoint-disabled)) |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3182 'gdb-bptno bptno |
8438430a751a
(gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents:
66382
diff
changeset
|
3183 'gdb-enabled enabled) |
54538 | 3184 (when (< left-margin-width 2) |
3185 (save-current-buffer | |
3186 (setq left-margin-width 2) | |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3187 (if source-window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
3188 (set-window-margins |
65859
398b39fb5c3f
(gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
65855
diff
changeset
|
3189 source-window |
55328
4440fe0e7dc6
(gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
55217
diff
changeset
|
3190 left-margin-width right-margin-width)))) |
54538 | 3191 (put-image |
3192 (if enabled | |
3193 (or breakpoint-enabled-icon | |
3194 (setq breakpoint-enabled-icon | |
54668
69a699e79a0d
(gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents:
54617
diff
changeset
|
3195 (find-image `((:type xpm :data |
54538 | 3196 ,breakpoint-xpm-data |
3197 :ascent 100 :pointer hand) | |
3198 (:type pbm :data | |
3199 ,breakpoint-enabled-pbm-data | |
3200 :ascent 100 :pointer hand))))) | |
3201 (or breakpoint-disabled-icon | |
3202 (setq breakpoint-disabled-icon | |
3203 (find-image `((:type xpm :data | |
3204 ,breakpoint-xpm-data | |
3205 :conversion disabled | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3206 :ascent 100 :pointer hand) |
54538 | 3207 (:type pbm :data |
3208 ,breakpoint-disabled-pbm-data | |
66417
bec18a123c03
(gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents:
66412
diff
changeset
|
3209 :ascent 100 :pointer hand)))))) |
59617
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3210 (+ start 1) |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3211 putstring |
4988bdf5db77
(gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents:
58534
diff
changeset
|
3212 'left-margin)) |
54538 | 3213 (when (< left-margin-width 2) |
3214 (save-current-buffer | |
3215 (setq left-margin-width 2) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3216 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3217 (if window |
56285
313e3a9f34ca
(breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents:
56258
diff
changeset
|
3218 (set-window-margins |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3219 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
|
3220 (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
|
3221 (propertize putstring |
a706fe4203bc
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents:
60541
diff
changeset
|
3222 '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
|
3223 (1+ start))))) |
54538 | 3224 |
3225 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin) | |
3226 (gdb-remove-strings start end) | |
3227 (if (display-images-p) | |
3228 (remove-images start end)) | |
3229 (when remove-margin | |
3230 (setq left-margin-width 0) | |
65973
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3231 (let ((window (get-buffer-window (current-buffer) 0))) |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3232 (if window |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3233 (set-window-margins |
ae4953c24452
(gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents:
65884
diff
changeset
|
3234 window left-margin-width right-margin-width))))) |
54538 | 3235 |
3236 | |
3237 ;; | |
3238 ;; Assembler buffer. | |
3239 ;; | |
3240 (gdb-set-buffer-rules 'gdb-assembler-buffer | |
3241 'gdb-assembler-buffer-name | |
3242 'gdb-assembler-mode) | |
3243 | |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3244 ;; 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
|
3245 ;; 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
|
3246 (defun gdb-assembler-handler () |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3247 (setq gdb-pending-triggers |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3248 (delq 'gdb-invalidate-assembler |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3249 gdb-pending-triggers)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3250 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3251 (and buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3252 (with-current-buffer buf |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3253 (let* ((window (get-buffer-window buf 0)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3254 (p (window-point window)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3255 (buffer-read-only nil)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3256 (erase-buffer) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3257 (insert-buffer-substring (gdb-get-buffer-create |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3258 'gdb-partial-output-buffer)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3259 (set-window-point window p))))) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3260 ;; put customisation here |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3261 (gdb-assembler-custom)) |
54538 | 3262 |
3263 (defun gdb-assembler-custom () | |
3264 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) | |
59766
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3265 (pos 1) (address) (flag) (bptno)) |
54538 | 3266 (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
|
3267 (save-excursion |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3268 (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
|
3269 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3270 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3271 (if (and gdb-pc-address |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3272 (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
|
3273 (progn |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3274 (setq pos (point)) |
28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents:
62826
diff
changeset
|
3275 (beginning-of-line) |
69650
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3276 (setq fringe-indicator-alist |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3277 (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
|
3278 nil |
de8b61c18c11
(gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents:
69618
diff
changeset
|
3279 '((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
|
3280 (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
|
3281 (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
|
3282 (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
|
3283 ;; 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
|
3284 (gdb-remove-breakpoint-icons (point-min) (point-max)))) |
54538 | 3285 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) |
3286 (goto-char (point-min)) | |
3287 (while (< (point) (- (point-max) 1)) | |
3288 (forward-line 1) | |
62936
d5d3c468d5c0
(gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
62884
diff
changeset
|
3289 (if (looking-at "[^\t].*?breakpoint") |
54538 | 3290 (progn |
3291 (looking-at | |
62716 | 3292 "\\([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
|
3293 (setq bptno (match-string 1)) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3294 (setq flag (char-after (match-beginning 2))) |
8d2464efeb2e
(gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents:
59763
diff
changeset
|
3295 (setq address (match-string 3)) |
54538 | 3296 (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
|
3297 (save-excursion |
54538 | 3298 (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
|
3299 (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
|
3300 (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
|
3301 (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
|
3302 (with-current-buffer buffer |
10f616ac16f1
Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents:
66845
diff
changeset
|
3303 (set-window-point (get-buffer-window buffer 0) pos))))) |
54538 | 3304 |
3305 (defvar gdb-assembler-mode-map | |
3306 (let ((map (make-sparse-keymap))) | |
3307 (suppress-keymap map) | |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3308 (define-key map "q" 'kill-this-buffer) |
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3309 map)) |
54538 | 3310 |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3311 (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
|
3312 '(;; <__function.name+n> |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3313 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
4d6eec4c1ef8
* progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents:
57661
diff
changeset
|
3314 (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
|
3315 ;; 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
|
3316 ("^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
|
3317 (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
|
3318 ;; %register(at least i386) |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3319 ("%\\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
|
3320 ("^\\(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
|
3321 (1 font-lock-comment-face) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3322 (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
|
3323 ("^\\(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
|
3324 "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
|
3325 |
54538 | 3326 (defun gdb-assembler-mode () |
3327 "Major mode for viewing code assembler. | |
3328 | |
3329 \\{gdb-assembler-mode-map}" | |
57661
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3330 (kill-all-local-variables) |
54538 | 3331 (setq major-mode 'gdb-assembler-mode) |
62716 | 3332 (setq mode-name (concat "Machine:" gdb-selected-frame)) |
54538 | 3333 (setq gdb-overlay-arrow-position nil) |
3334 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position) | |
3335 (setq fringes-outside-margins t) | |
3336 (setq buffer-read-only t) | |
3337 (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
|
3338 (gdb-invalidate-assembler) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3339 (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
|
3340 '(gdb-assembler-font-lock-keywords)) |
b59713cd72a2
(gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents:
57350
diff
changeset
|
3341 (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
|
3342 'gdb-invalidate-assembler) |
54538 | 3343 |
3344 (defun gdb-assembler-buffer-name () | |
3345 (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
|
3346 (concat "*disassembly of " (gdb-get-target-string) "*"))) |
54538 | 3347 |
3348 (defun gdb-display-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3349 "Display disassembly view." |
54538 | 3350 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3351 (setq gdb-previous-frame nil) |
54538 | 3352 (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
|
3353 (gdb-get-buffer-create 'gdb-assembler-buffer) t)) |
54538 | 3354 |
3355 (defun gdb-frame-assembler-buffer () | |
55400
1aaa031e318c
Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
55330
diff
changeset
|
3356 "Display disassembly view in a new frame." |
54538 | 3357 (interactive) |
62884
ab597e7c8a07
(gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents:
62867
diff
changeset
|
3358 (setq gdb-previous-frame nil) |
58521
54bb21951d18
(gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents:
58485
diff
changeset
|
3359 (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
|
3360 (special-display-frame-alist gdb-frame-parameters)) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3361 (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer)))) |
54538 | 3362 |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3363 ;; modified because if gdb-pc-address has changed value a new command |
54538 | 3364 ;; must be enqueued to update the buffer with the new output |
3365 (defun gdb-invalidate-assembler (&optional ignored) | |
3366 (if (gdb-get-buffer 'gdb-assembler-buffer) | |
3367 (progn | |
62716 | 3368 (unless (and gdb-selected-frame |
3369 (string-equal gdb-selected-frame gdb-previous-frame)) | |
54538 | 3370 (if (or (not (member 'gdb-invalidate-assembler |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3371 gdb-pending-triggers)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3372 (not (string-equal gdb-pc-address |
62716 | 3373 gdb-previous-frame-address))) |
54538 | 3374 (progn |
62716 | 3375 ;; take previous disassemble command, if any, off the queue |
54538 | 3376 (with-current-buffer gud-comint-buffer |
58485
31d7630f91d4
(gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents:
58470
diff
changeset
|
3377 (let ((queue gdb-input-queue)) |
54538 | 3378 (dolist (item queue) |
3379 (if (equal (cdr item) '(gdb-assembler-handler)) | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3380 (setq gdb-input-queue |
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3381 (delete item gdb-input-queue)))))) |
54538 | 3382 (gdb-enqueue-input |
62716 | 3383 (list |
3384 (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
|
3385 (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
|
3386 gdb-pc-address "\n") |
54538 | 3387 'gdb-assembler-handler)) |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3388 (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
|
3389 (setq gdb-previous-frame-address gdb-pc-address) |
62716 | 3390 (setq gdb-previous-frame gdb-selected-frame))))))) |
54538 | 3391 |
62716 | 3392 (defun gdb-get-selected-frame () |
3393 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers)) | |
54538 | 3394 (progn |
3395 (gdb-enqueue-input | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3396 (list (concat gdb-server-prefix "info frame\n") 'gdb-frame-handler)) |
62716 | 3397 (push 'gdb-get-selected-frame |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3398 gdb-pending-triggers)))) |
54538 | 3399 |
3400 (defun gdb-frame-handler () | |
55749
230865f1c59d
(gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
55696
diff
changeset
|
3401 (setq gdb-pending-triggers |
62716 | 3402 (delq 'gdb-get-selected-frame gdb-pending-triggers)) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3403 (goto-char (point-min)) |
70053
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3404 (when (re-search-forward |
9099e9f6d57a
(gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents:
69988
diff
changeset
|
3405 "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
|
3406 (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
|
3407 (setq gdb-frame-address (match-string 2))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3408 (goto-char (point-min)) |
71409
f723aa5cf2de
(gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents:
71348
diff
changeset
|
3409 (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
|
3410 \\(?: (\\(\\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
|
3411 nil t) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3412 (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
|
3413 (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
|
3414 (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
|
3415 (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
|
3416 (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
|
3417 (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
|
3418 (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
|
3419 (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
|
3420 (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
|
3421 (let ((buffer (marker-buffer gud-overlay-arrow-position)) |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3422 (position (marker-position gud-overlay-arrow-position))) |
70372
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3423 (when (and buffer |
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3424 (string-equal (buffer-name buffer) |
39c42b92436d
(gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents:
70351
diff
changeset
|
3425 (file-name-nondirectory (match-string 3)))) |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3426 (with-current-buffer buffer |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3427 (setq fringe-indicator-alist |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3428 (if (string-equal gdb-frame-number "0") |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3429 nil |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3430 '((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
|
3431 (set-marker gud-overlay-arrow-position position)))))) |
67332
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3432 (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
|
3433 (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
|
3434 (setq gdb-current-language (match-string 1))) |
dc9f95e91f3b
(gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
67309
diff
changeset
|
3435 (gdb-invalidate-assembler)) |
68902
5de231ae5dc9
(gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents:
68864
diff
changeset
|
3436 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3437 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3438 ;; Code specific to GDB 6.4 |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3439 (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
|
3440 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3441 (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
|
3442 "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
|
3443 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
|
3444 is set in them." |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3445 (goto-char (point-min)) |
67364
7736e7015779
(gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
67356
diff
changeset
|
3446 (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
|
3447 (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
|
3448 (dolist (buffer (buffer-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3449 (with-current-buffer buffer |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3450 (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
|
3451 (set (make-local-variable 'gud-minor-mode) |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3452 (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
|
3453 (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
|
3454 (when gud-tooltip-mode |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3455 (make-local-variable 'gdb-define-alist) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3456 (gdb-create-define-alist) |
71277
99ed754e8f50
(gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
71113
diff
changeset
|
3457 (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
|
3458 (gdb-force-mode-line-update |
3d39ae4ce1b6
(gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents:
71877
diff
changeset
|
3459 (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
|
3460 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3461 ; 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
|
3462 (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
|
3463 (gdb-enqueue-input |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3464 (list |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3465 (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
|
3466 (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
|
3467 varnum "\"\n") |
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3468 (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
|
3469 `(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
|
3470 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3471 (defconst gdb-var-list-children-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3472 "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\ |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3473 numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\ |
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3474 \\(}\\|,.*?\\(type=\"\\(.+?\\)\"\\)?.*?}\\)") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3475 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3476 (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
|
3477 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3478 (let ((var-list nil)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3479 (catch 'child-already-watched |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3480 (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
|
3481 (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
|
3482 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3483 (push var var-list) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3484 (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
|
3485 (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
|
3486 (match-string 2) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3487 (match-string 3) |
72668
5a0fb2945b46
(gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
72651
diff
changeset
|
3488 (match-string 7) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3489 (read (match-string 4)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3490 nil))) |
69475
3f8495af82a4
(gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents:
69438
diff
changeset
|
3491 (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
|
3492 (throw 'child-already-watched nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3493 (push varchild var-list)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3494 (push var var-list))) |
70503
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3495 (setq gdb-var-list (nreverse var-list)))) |
f403849ca1a6
(gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
70428
diff
changeset
|
3496 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3497 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3498 ; 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
|
3499 (defun gdb-var-update-1 () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3500 (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
|
3501 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3502 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3503 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3504 (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
|
3505 "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
|
3506 "-var-update --all-values *\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3507 'gdb-var-update-handler-1)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3508 (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
|
3509 |
68941
b41d1af1839d
(gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents:
68938
diff
changeset
|
3510 (defconst gdb-var-update-regexp-1 |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3511 "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\ |
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3512 in_scope=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3513 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3514 (defun gdb-var-update-handler-1 () |
68993
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3515 (dolist (var gdb-var-list) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3516 (setcar (nthcdr 5 var) nil)) |
3d9e09ba3ace
(gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents:
68967
diff
changeset
|
3517 (goto-char (point-min)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3518 (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
|
3519 (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
|
3520 (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
|
3521 (when var |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3522 (let ((match (match-string 3))) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3523 (cond ((string-equal match "false") |
79261
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3524 (if gdb-delete-out-of-scope |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3525 (gdb-var-delete-1 varnum) |
9963a1e6e29f
(gdb-delete-out-of-scope): New option.
Nick Roberts <nickrob@snap.net.nz>
parents:
79036
diff
changeset
|
3526 (setcar (nthcdr 5 var) 'out-of-scope))) |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3527 ((string-equal match "true") |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3528 (setcar (nthcdr 5 var) 'changed) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3529 (setcar (nthcdr 4 var) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3530 (read (match-string 2)))) |
75554
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
3531 ((string-equal match "invalid") |
26b46f8828ba
(gdb-var-delete-1): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
75480
diff
changeset
|
3532 (gdb-var-delete-1 varnum))))))) |
75480
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3533 (setq gdb-pending-triggers |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3534 (delq 'gdb-var-update gdb-pending-triggers)) |
72227336f162
(gdb-breakpoint-regexp): Declare earlier to
Nick Roberts <nickrob@snap.net.nz>
parents:
75367
diff
changeset
|
3535 (gdb-speedbar-update)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3536 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3537 ;; Registers buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3538 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3539 (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
|
3540 'gdb-registers-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3541 'gdb-registers-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3542 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3543 (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
|
3544 (gdb-get-buffer 'gdb-registers-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3545 (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
|
3546 "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
|
3547 "-data-list-register-values x\n") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3548 gdb-data-list-register-values-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3549 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3550 (defconst gdb-data-list-register-values-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3551 "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3552 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3553 (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
|
3554 (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
|
3555 gdb-pending-triggers)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3556 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3557 (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
|
3558 (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
|
3559 (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
|
3560 (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
|
3561 (erase-buffer) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3562 (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
|
3563 (insert err) |
e6d430f1cde3
(gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents:
69839
diff
changeset
|
3564 (goto-char (point-min))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3565 (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
|
3566 (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
|
3567 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3568 (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
|
3569 (setq register (pop register-list)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3570 (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
|
3571 (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
|
3572 (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
|
3573 'face 'font-lock-warning-face |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3574 register-string)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3575 (setq register-values |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3576 (concat register-values register-string))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3577 (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
|
3578 (with-current-buffer buf |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3579 (let* ((window (get-buffer-window buf 0)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3580 (start (window-start window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3581 (p (window-point window)) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3582 (buffer-read-only nil)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3583 (erase-buffer) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3584 (insert register-values) |
69180
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3585 (set-window-start window start) |
9c5c44399069
(gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents:
69108
diff
changeset
|
3586 (set-window-point window p)))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3587 (gdb-data-list-register-values-custom)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3588 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3589 (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
|
3590 (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
|
3591 (save-excursion |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3592 (let ((buffer-read-only nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3593 start end) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3594 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3595 (while (< (point) (point-max)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3596 (setq start (line-beginning-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3597 (setq end (line-end-position)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3598 (when (looking-at "^[^\t]+") |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3599 (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
|
3600 (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
|
3601 '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
|
3602 (add-text-properties start end |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3603 '(help-echo "mouse-2: edit value" |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3604 mouse-face highlight)))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3605 (forward-line 1)))))) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3606 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3607 ;; 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
|
3608 (defun gdb-get-changed-registers () |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3609 (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
|
3610 (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
|
3611 (progn |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3612 (gdb-enqueue-input |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3613 (list |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3614 (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
|
3615 "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
|
3616 "-data-list-changed-registers\n") |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3617 'gdb-get-changed-registers-handler)) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3618 (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
|
3619 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3620 (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
|
3621 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3622 (defun gdb-get-changed-registers-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3623 (setq gdb-pending-triggers |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3624 (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
|
3625 (setq gdb-changed-registers nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3626 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3627 (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
|
3628 (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
|
3629 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3630 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3631 ;; Locals buffer. |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3632 ;; |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3633 ;; 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
|
3634 (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
|
3635 'gdb-locals-buffer-name |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3636 'gdb-locals-mode) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3637 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3638 (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
|
3639 (gdb-get-buffer 'gdb-locals-buffer) |
68864
47f77ab239fc
(gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents:
68773
diff
changeset
|
3640 (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
|
3641 "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
|
3642 "-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
|
3643 gdb-stack-list-locals-handler) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3644 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3645 (defconst gdb-stack-list-locals-regexp |
69654
7d2621d0d5e4
(gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents:
69650
diff
changeset
|
3646 "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"") |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3647 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3648 (defvar gdb-locals-watch-map-1 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3649 (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
|
3650 (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
|
3651 (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
|
3652 (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
|
3653 map) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3654 "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
|
3655 |
72429
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3656 (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
|
3657 (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
|
3658 (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
|
3659 (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
|
3660 (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
|
3661 map) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3662 "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
|
3663 |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3664 (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
|
3665 "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
|
3666 (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
|
3667 (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
|
3668 (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
|
3669 (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
|
3670 (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
|
3671 (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
|
3672 (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
|
3673 (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
|
3674 '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
|
3675 |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3676 ;; 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
|
3677 ;; 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
|
3678 (defun gdb-stack-list-locals-handler () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3679 (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
|
3680 gdb-pending-triggers)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3681 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3682 (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
|
3683 (let ((err (match-string 1))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3684 (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
|
3685 (let ((buffer-read-only nil)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3686 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3687 (insert err) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3688 (goto-char (point-min))))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3689 (let (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3690 (goto-char (point-min)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3691 (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
|
3692 (let ((local (list (match-string 1) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3693 (match-string 2) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3694 nil))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3695 (if (looking-at ",value=\\(\".*\"\\).*?}") |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3696 (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
|
3697 (push local locals-list))) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3698 (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
|
3699 (and buf (with-current-buffer buf |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3700 (let* ((window (get-buffer-window buf 0)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3701 (start (window-start window)) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3702 (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
|
3703 (buffer-read-only nil) (name) (value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3704 (erase-buffer) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3705 (dolist (local locals-list) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3706 (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
|
3707 (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
|
3708 (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
|
3709 (string-match "^\\0x" value)) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3710 (add-text-properties 0 (length name) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3711 `(mouse-face highlight |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3712 help-echo "mouse-2: create watch expression" |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3713 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
|
3714 name) |
ae19dce6b114
(gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents:
72392
diff
changeset
|
3715 (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
|
3716 `(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
|
3717 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
|
3718 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
|
3719 value)) |
69618
a6d6cceff8ba
(gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents:
69609
diff
changeset
|
3720 (insert |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3721 (concat name "\t" (nth 1 local) |
72481
d7b676d23dd8
(gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents:
72435
diff
changeset
|
3722 "\t" value "\n"))) |
70141
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3723 (set-window-start window start) |
21438c8b3a3f
(gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents:
70053
diff
changeset
|
3724 (set-window-point window p)))))))) |
67356
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3725 |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3726 (defun gdb-get-register-names () |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3727 "Create a list of register names." |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3728 (goto-char (point-min)) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3729 (setq gdb-register-names nil) |
568e3be4fb8c
(gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents:
67332
diff
changeset
|
3730 (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
|
3731 (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
|
3732 |
54538 | 3733 (provide 'gdb-ui) |
3734 | |
55696
ed6e91c53c82
(gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55507
diff
changeset
|
3735 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352 |
54538 | 3736 ;;; gdb-ui.el ends here |