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