annotate lisp/progmodes/gdb-ui.el @ 73036:384cb0bcd86b

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Thu, 21 Sep 2006 01:34:03 +0000
parents 5a0fb2945b46
children f11ea9f277ca 84dd84b43e1b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1 ;;; gdb-ui.el --- User Interface for running GDB
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
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
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4 ;; Maintainer: FSF
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
5 ;; Keywords: unix, tools
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
6
69618
a6d6cceff8ba (gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents: 69609
diff changeset
7 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006
68773
dc49655f57ae Update copyright for 2006.
Nick Roberts <nickrob@snap.net.nz>
parents: 68664
diff changeset
8 ;; Free Software Foundation, Inc.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
9
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
11
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
15 ;; any later version.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
16
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
20 ;; GNU General Public License for more details.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
21
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63732
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63732
diff changeset
25 ;; Boston, MA 02110-1301, USA.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
26
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
27 ;;; Commentary:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
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
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
30 ;; GDB through the GUD buffer in the usual way, but there are also further
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
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
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
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
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
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,
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
43 ;; but if you are interested developing the mode itself, then see the
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
44 ;; Annotations 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
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
54 ;; This mode SHOULD WORK WITH GDB 5.0 onwards but you will NEED GDB 6.0
67591
e81d8f1aa8fe (gdb-many-windows): Echo new state in minibuffer.
Nick Roberts <nickrob@snap.net.nz>
parents: 67364
diff changeset
55 ;; onwards to use watch expressions. It works best with GDB 6.4 where
e81d8f1aa8fe (gdb-many-windows): Echo new state in minibuffer.
Nick Roberts <nickrob@snap.net.nz>
parents: 67364
diff changeset
56 ;; 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.
69234
67e921172c0d (gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents: 69214
diff changeset
82
67e921172c0d (gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents: 69214
diff changeset
83 ;;; Problems with watch expressions, GDB/MI:
68941
b41d1af1839d (gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 68938
diff changeset
84 ;; 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
85 ;; 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
86 ;; 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
87 ;; (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
88
67233
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
89 ;;; TODO:
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
90 ;; 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
91 ;; 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
92 ;; 3) Mark breakpoint locations on scroll-bar of source buffer?
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
93
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
94 ;;; Code:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
95
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
96 (require 'gud)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
97
65231
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
98 (defvar tool-bar-map)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
99 (defvar speedbar-initial-expansion-list-name)
65231
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
100
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
101 (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
102 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
103 (defvar gdb-frame-address nil "Identity of frame for watch expression.")
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
104 (defvar gdb-previous-frame-address nil)
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
105 (defvar gdb-memory-address "main")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
106 (defvar gdb-previous-frame nil)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
107 (defvar gdb-selected-frame nil)
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
108 (defvar gdb-frame-number nil)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
109 (defvar gdb-current-language nil)
68941
b41d1af1839d (gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 68938
diff changeset
110 (defvar gdb-var-list nil
b41d1af1839d (gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 68938
diff changeset
111 "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
112 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP)
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
113 where STATUS is nil (unchanged), `changed' or `out-of-scope', FP the frame
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
114 address for root variables.")
62723
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
115 (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
116 (defvar gud-old-arrow nil)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
117 (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
118 (defvar gdb-stack-position nil)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
119 (defvar gdb-server-prefix nil)
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
120 (defvar gdb-flush-pending-output nil)
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
121 (defvar gdb-location-alist nil
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
122 "Alist of breakpoint numbers and full filenames.")
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
123 (defvar gdb-active-process nil "GUD tooltips display variable values when t, \
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
124 and #define directives otherwise.")
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
125 (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
126 (defvar gdb-macro-info nil
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
127 "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
128 (defvar gdb-buffer-fringe-width nil)
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
129 (defvar gdb-signalled nil)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
130 (defvar gdb-source-window nil)
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
131 (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
132 (defvar gdb-continuation nil)
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
133 (defvar gdb-look-up-stack nil)
71348
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
134 (defvar gdb-frame-begin nil
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
135 "Non-nil when GDB generates frame-begin annotation.")
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
136 (defvar gdb-printing t)
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
137
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
138 (defvar gdb-buffer-type nil
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
139 "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
140 (make-variable-buffer-local 'gdb-buffer-type)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
141
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
142 (defvar gdb-input-queue ()
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
143 "A list of gdb command objects.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
144
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
145 (defvar gdb-prompting nil
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
146 "True when gdb is idle with no pending input.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
147
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
148 (defvar gdb-output-sink 'user
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
149 "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
150 Possible values are these symbols:
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
151
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
152 `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
153 for the user to see.
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
154
64702
56f44995f925 (gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents: 64697
diff changeset
155 `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
156
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
157 `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
158 annotation is received. Then the output-sink
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
159 becomes:...
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
160 `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
161 for subsequent processing by a command. This is the
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
162 disposition of output generated by commands that
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
163 gdb mode sends to gdb on its own behalf.
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
164 `post-emacs' -- ignore output until the prompt annotation is
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
165 received, then go to USER disposition.
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
166
64702
56f44995f925 (gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents: 64697
diff changeset
167 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
168 \(`user' and `emacs').")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
169
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
170 (defvar gdb-current-item nil
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
171 "The most recent command item sent to gdb.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
172
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
173 (defvar gdb-pending-triggers '()
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
174 "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
175 handlers.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
176
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
177 (defvar gdb-first-post-prompt nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
178 (defvar gdb-version nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
179 (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
180 (defvar gdb-source-file-list nil
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
181 "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
182 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
183
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-1
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
185 '(
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
186 ;; var = (struct struct_tag) value
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
187 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
188 (1 font-lock-variable-name-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
189 (3 font-lock-keyword-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
190 (4 font-lock-type-face))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
191 ;; var = (type) value
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
192 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\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-type-face))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
195 ;; var = val
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
196 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
197 (1 font-lock-variable-name-face))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
198 )
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
199 "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
200
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
201 (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
202 '(
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
203 ;; var = type value
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
204 ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
205 (1 font-lock-variable-name-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
206 (3 font-lock-type-face))
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 "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
209
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
210 ;; Variables for GDB 6.4+
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
211 (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
212 (defvar gdb-changed-registers nil
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
213 "List of changed register numbers (strings).")
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
214
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
215 ;;;###autoload
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
216 (defun gdba (command-line)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
217 "Run gdb on program FILE in buffer *gud-FILE*.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
218 The directory containing FILE becomes the initial working directory
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
219 and source-file directory for your debugger.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
220
54668
69a699e79a0d (gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents: 54617
diff changeset
221 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
222 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
223 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
224 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
225
54901
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
226 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
227 `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
228 `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
229 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
230 some of the buffers.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
231
54901
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
232 Watch expressions appear in the speedbar/slowbar.
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
233
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
234 The following commands help control operation :
54901
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
235
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
236 `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
237 `gdb-restore-windows' - To restore the window layout.
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
238
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
239 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
240 detailed description of this mode.
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
241
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
242
68938
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
243 +----------------------------------------------------------------------+
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
244 | GDB Toolbar |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
245 +-----------------------------------+----------------------------------+
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
246 | GUD buffer (I/O of GDB) | Locals buffer |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
247 | | |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
248 | | |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
249 | | |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
250 +-----------------------------------+----------------------------------+
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
251 | Source buffer | I/O buffer (of debugged program) |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
252 | | (comint-mode) |
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 | | |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
257 | | |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
258 | | |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
259 +-----------------------------------+----------------------------------+
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
260 | Stack buffer | Breakpoints buffer |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
261 | RET gdb-frames-select | SPC gdb-toggle-breakpoint |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
262 | | RET gdb-goto-breakpoint |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
263 | | D gdb-delete-breakpoint |
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
264 +-----------------------------------+----------------------------------+"
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
265 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
266 (interactive (list (gud-query-cmdline 'gdba)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
267 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
268 ;; 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
269 (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
270 (gdb-init-1))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
271
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
272 (defcustom gdb-debug-ring-max 128
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
273 "Maximum size of `gdb-debug-ring'."
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
274 :group 'gud
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
275 :type 'integer
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
276 :version "22.1")
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
277
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
278 (defvar gdb-debug-ring nil
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
279 "List of commands, most recent first, sent to and replies received from GDB.
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
280 This variable is used to debug GDB-UI.")
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
281
64697
7767f4fb012a * progmodes/gdb-ui.el (gdb-enable-debug-log): Add autoload cookie.
Nick Roberts <nickrob@snap.net.nz>
parents: 64654
diff changeset
282 ;;;###autoload
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
283 (defcustom gdb-enable-debug nil
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
284 "Non-nil means record the process input and output in `gdb-debug-ring'."
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
285 :type 'boolean
57851
67b88e92a24d (gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents: 57791
diff changeset
286 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
287 :version "22.1")
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
288
62115
515e18600ed2 (gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 62065
diff changeset
289 (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
290 "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
291 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
292 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
293 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
294
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
295 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
296 predefined macros."
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
297 :type 'string
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
298 :group 'gud
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
299 :version "22.1")
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
300
62065
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
301 (defcustom gdb-cpp-define-alist-flags ""
62723
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
302 "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
303 :type 'string
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
304 :group 'gud
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
305 :version "22.1")
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
306
62723
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
307 (defcustom gdb-show-main nil
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
308 "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
309 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
310 :type 'boolean
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
311 :group 'gud
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
312 :version "22.1")
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
313
69438
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
314 (defcustom gdb-many-windows nil
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
315 "Nil means just pop up the GUD buffer unless `gdb-show-main' is t.
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
316 In this case it starts with two windows: one displaying the GUD
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
317 buffer and the other with the source file with the main routine
72481
d7b676d23dd8 (gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents: 72435
diff changeset
318 of the debugged program. Non-nil means display the layout shown for
69438
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
319 `gdba'."
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
320 :type 'boolean
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
321 :group 'gud
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
322 :version "22.1")
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
323
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
324 (defcustom gdb-use-separate-io-buffer nil
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
325 "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
326 :type 'boolean
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
327 :group 'gud
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
328 :version "22.1")
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
329
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
330 (defun gdb-force-mode-line-update (status)
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
331 (let ((buffer gud-comint-buffer))
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
332 (if (and buffer (buffer-name buffer))
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
333 (with-current-buffer buffer
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
334 (setq mode-line-process
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
335 (format ":%s [%s]"
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
336 (process-status (get-buffer-process buffer)) status))
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
337 ;; Force mode line redisplay soon.
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
338 (force-mode-line-update)))))
69618
a6d6cceff8ba (gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents: 69609
diff changeset
339
69438
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
340 (defun gdb-many-windows (arg)
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
341 "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
342 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
343 (interactive "P")
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
344 (setq gdb-many-windows
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
345 (if (null arg)
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
346 (not gdb-many-windows)
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
347 (> (prefix-numeric-value arg) 0)))
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
348 (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
349 (if gdb-many-windows "en" "dis")))
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
350 (if (and gud-comint-buffer
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
351 (buffer-name gud-comint-buffer))
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
352 (condition-case nil
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
353 (gdb-restore-windows)
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
354 (error nil))))
d7680d58bec3 (gdb-stack-list-locals-handler): Add local
Nick Roberts <nickrob@snap.net.nz>
parents: 69359
diff changeset
355
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
356 (defun gdb-use-separate-io-buffer (arg)
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
357 "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
358 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
359 (interactive "P")
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
360 (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
361 (if (null arg)
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
362 (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
363 (> (prefix-numeric-value arg) 0)))
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
364 (message (format "Separate IO %sabled"
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
365 (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
366 (if (and gud-comint-buffer
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
367 (buffer-name gud-comint-buffer))
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
368 (condition-case nil
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
369 (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
370 (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
371 (kill-buffer (gdb-inferior-io-name)))
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
372 (error nil))))
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
373
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
374 (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
375
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
376 (defun gdb-create-define-alist ()
62065
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
377 "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
378 (let* ((file (buffer-file-name))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
379 (output
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
380 (with-output-to-string
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
381 (with-current-buffer standard-output
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
382 (call-process shell-file-name
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
383 (if (file-exists-p file) file nil)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
384 (list t nil) nil "-c"
62065
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
385 (concat gdb-cpp-define-alist-program " "
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
386 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
387 (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
388 (setq gdb-define-alist nil)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
389 (dolist (define define-list)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
390 (setq name (nth 1 (split-string define "[( ]")))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
391 (push (cons name define) gdb-define-alist))))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
392
67891
c6d86f53dcf3 (gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents: 67591
diff changeset
393 (defun gdb-tooltip-print (expr)
62136
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
394 (tooltip-show
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
395 (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
396 (goto-char (point-min))
c6d86f53dcf3 (gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents: 67591
diff changeset
397 (let ((string
c6d86f53dcf3 (gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents: 67591
diff changeset
398 (if (search-forward "=" nil t)
c6d86f53dcf3 (gdb-tooltip-print, gdb-tooltip-print-1):
Nick Roberts <nickrob@snap.net.nz>
parents: 67591
diff changeset
399 (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
400 (buffer-string))))
62136
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
401 ;; 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
402 (substring string 0 (- (length string) 1))))
63443
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
403 (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
404
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
405 ;; 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
406 ;; 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
407 ;; unexpected starting annotation (phase error).
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
408 (defun gdb-tooltip-print-1 (expr)
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
409 (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
410 (goto-char (point-min))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
411 (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
412 (unless (looking-at "\\S-+.*(.*).*")
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
413 (gdb-enqueue-input
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
414 (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
415 `(lambda () (gdb-tooltip-print ,expr))))))))
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
416
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
417 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)")
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
418
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
419 (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
420 "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
421 (goto-char (point-min))
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
422 (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
423 (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
424 (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
425 gdb-source-file-list))
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
426 (dolist (buffer (buffer-list))
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
427 (with-current-buffer buffer
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
428 (when (and buffer-file-name
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
429 (member (file-name-nondirectory buffer-file-name)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
430 gdb-source-file-list))
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
431 (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
432 (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
433 (when gud-tooltip-mode
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
434 (make-local-variable 'gdb-define-alist)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
435 (gdb-create-define-alist)
71277
99ed754e8f50 (gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 71113
diff changeset
436 (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
437 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
438 (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
439
66977
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
440 (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
441 (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
442 (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
443 (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
444 (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
445 (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
446 (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
447 (setq varnumlet (car var1))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
448 (dolist (component component-list)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
449 (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
450 (setq expr (concat expr
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
451 (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
452 (concat "[" component "]")
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
453 (concat "." component))))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
454 (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
455 expr)))
66977
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
456
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
457 (defun gdb-init-1 ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
458 (set (make-local-variable 'gud-minor-mode) 'gdba)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
459 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
460 ;;
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
461 (gud-def gud-break (if (not (string-match "Machine" mode-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
462 (gud-call "break %f:%l" arg)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
463 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
464 (beginning-of-line)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
465 (forward-char 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
466 (gud-call "break *%a" arg)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
467 "\C-b" "Set breakpoint at current line or address.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
468 ;;
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
469 (gud-def gud-remove (if (not (string-match "Machine" mode-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
470 (gud-call "clear %f:%l" arg)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
471 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
472 (beginning-of-line)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
473 (forward-char 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
474 (gud-call "clear *%a" arg)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
475 "\C-d" "Remove breakpoint at current line or address.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
476 ;;
66886
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
477 (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
478 (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
479 (save-excursion
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
480 (beginning-of-line)
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
481 (forward-char 2)
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
482 (gud-call "until *%a" arg)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
483 "\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
484 ;;
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
485 (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
486 nil "Start or continue execution.")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
487
66977
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
488 ;; For debugging Emacs only.
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
489 (gud-def gud-pp
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
490 (gud-call
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
491 (concat
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
492 "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
493 '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
494 (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
495 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
496
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
497 (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
498 'gdb-mouse-set-clear-breakpoint)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
499 (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
500 'gdb-mouse-set-clear-breakpoint)
71090
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
501 (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
502 'gdb-mouse-toggle-breakpoint-margin)
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
503 (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
504 'gdb-mouse-toggle-breakpoint-fringe)
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
505
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
506 (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
507 'gdb-mouse-until)
66419
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
508 (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
509 'gdb-mouse-until)
71090
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
510 (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
511 'gdb-mouse-until)
71090
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
512 (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
513 'gdb-mouse-until)
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
514
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
515 (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
516 'gdb-mouse-jump)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
517 (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
518 'gdb-mouse-jump)
71090
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
519 (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
520 'gdb-mouse-jump)
71090
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
521 (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
522 'gdb-mouse-jump)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
523
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
524 (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
525
57664
4d6eec4c1ef8 * progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents: 57661
diff changeset
526 ;; (re-)initialize
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
527 (setq gdb-pc-address (if gdb-show-main "main" nil))
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
528 (setq gdb-previous-frame-address nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
529 gdb-memory-address "main"
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
530 gdb-previous-frame nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
531 gdb-selected-frame nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
532 gdb-current-language nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
533 gdb-frame-number nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
534 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
535 gdb-main-file nil
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
536 gdb-first-post-prompt t
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
537 gdb-prompting nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
538 gdb-input-queue nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
539 gdb-current-item nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
540 gdb-pending-triggers nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
541 gdb-output-sink 'user
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
542 gdb-server-prefix "server "
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
543 gdb-flush-pending-output nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
544 gdb-location-alist nil
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
545 gdb-source-file-list nil
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
546 gdb-error nil
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
547 gdb-macro-info nil
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
548 gdb-buffer-fringe-width (car (window-fringes))
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
549 gdb-debug-ring nil
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
550 gdb-signalled nil
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
551 gdb-source-window nil
69526
c32efda6ab27 (gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents: 69510
diff changeset
552 gdb-inferior-status nil
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
553 gdb-continuation nil
71348
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
554 gdb-look-up-stack nil
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
555 gdb-frame-begin nil
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
556 gdb-printing t
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
557 gud-old-arrow nil)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
558
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
559 (setq gdb-buffer-type 'gdba)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
560
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
561 (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
562
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
563 ;; 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
564 (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
565 'gdb-get-version)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
566
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
567 (defun gdb-init-2 ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
568 (if (eq window-system 'w32)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
569 (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
570 (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
571 (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
572
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
573 (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
574 (progn
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
575 (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
576 '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
577 (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
578 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
579 (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
580 'gdb-get-register-names))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
581 ; Needs GDB 6.2 onwards.
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
582 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
583 (list "server interpreter mi \"-file-list-exec-source-files\"\n"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
584 '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
585 (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
586
69839
f91451ffdab7 (gdb-init-2): Set current filename using
Nick Roberts <nickrob@snap.net.nz>
parents: 69666
diff changeset
587 ;; 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
588 ;; 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
589 (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
590 (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
591
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
592 (run-hooks 'gdba-mode-hook))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
593
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
594 (defun gdb-get-version ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
595 (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
596 (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
597 (setq gdb-version "pre-6.4")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
598 (setq gdb-version "6.4+"))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
599 (gdb-init-2))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
600
66419
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
601 (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
602 "Continue running until a source line past the current line.
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
603 The destination source line can be selected either by clicking with mouse-2
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
604 on the fringe/margin or dragging the arrow with mouse-1 (default bindings)."
66419
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
605 (interactive "e")
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
606 (if gud-overlay-arrow-position
66637
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
607 (let ((start (event-start event))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
608 (end (event-end event))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
609 (buffer (marker-buffer gud-overlay-arrow-position)) (line))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
610 (if (not (string-match "Machine" mode-name))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
611 (if (equal buffer (window-buffer (posn-window end)))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
612 (with-current-buffer buffer
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
613 (when (or (equal start end)
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
614 (equal (posn-point start)
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
615 (marker-position
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
616 gud-overlay-arrow-position)))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
617 (setq line (line-number-at-pos (posn-point end)))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
618 (gud-call (concat "until " (number-to-string line))))))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
619 (if (equal (marker-buffer gdb-overlay-arrow-position)
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
620 (window-buffer (posn-window end)))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
621 (when (or (equal start end)
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
622 (equal (posn-point start)
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
623 (marker-position
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
624 gdb-overlay-arrow-position)))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
625 (save-excursion
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
626 (goto-line (line-number-at-pos (posn-point end)))
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
627 (forward-char 2)
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
628 (gud-call (concat "until *%a")))))))))
66419
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
629
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
630 (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
631 "Set execution address/line.
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
632 The destination source line can be selected either by clicking with mouse-2
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
633 on the fringe/margin or dragging the arrow with mouse-1 (default bindings).
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
634 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
635 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
636 (interactive "e")
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
637 (if gud-overlay-arrow-position
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
638 (let ((start (event-start event))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
639 (end (event-end event))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
640 (buffer (marker-buffer gud-overlay-arrow-position)) (line))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
641 (if (not (string-match "Machine" mode-name))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
642 (if (equal buffer (window-buffer (posn-window end)))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
643 (with-current-buffer buffer
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
644 (when (or (equal start end)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
645 (equal (posn-point start)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
646 (marker-position
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
647 gud-overlay-arrow-position)))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
648 (setq line (line-number-at-pos (posn-point end)))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
649 (progn (gud-call (concat "tbreak " (number-to-string line)))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
650 (gud-call (concat "jump " (number-to-string line)))))))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
651 (if (equal (marker-buffer gdb-overlay-arrow-position)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
652 (window-buffer (posn-window end)))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
653 (when (or (equal start end)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
654 (equal (posn-point start)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
655 (marker-position
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
656 gdb-overlay-arrow-position)))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
657 (save-excursion
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
658 (goto-line (line-number-at-pos (posn-point end)))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
659 (forward-char 2)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
660 (progn
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
661 (gud-call (concat "tbreak *%a"))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
662 (gud-call (concat "jump *%a"))))))))))
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
663
69042
01ec984a6ce6 (gdb-speedbar-auto-raise): Don't enable by default.
Nick Roberts <nickrob@snap.net.nz>
parents: 69023
diff changeset
664 (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
665 "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
666 updated."
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
667 :type 'boolean
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
668 :group 'gud
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
669 :version "22.1")
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
670
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
671 (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
672 "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
673 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
674 (interactive "P")
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
675 (setq gdb-speedbar-auto-raise
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
676 (if (null arg)
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
677 (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
678 (> (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
679 (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
680 (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
681
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
682 (defcustom gdb-use-colon-colon-notation nil
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
683 "If non-nil use FUN::VAR format to display variables in the speedbar."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
684 :type 'boolean
57851
67b88e92a24d (gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents: 57791
diff changeset
685 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
686 :version "22.1")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
687
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
688 (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
689 (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
690
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
691 (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
692 "Watch expression at point.
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
693 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
694 (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
695 (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
696 (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
697 (progn
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
698 (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
699 (require 'tooltip)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
700 (save-selected-window
70351
8e55901472d6 (gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents: 70141
diff changeset
701 (let ((expr
8e55901472d6 (gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents: 70141
diff changeset
702 (if arg
8e55901472d6 (gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents: 70141
diff changeset
703 (completing-read "Name of variable: "
8e55901472d6 (gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents: 70141
diff changeset
704 'gud-gdb-complete-command)
8e55901472d6 (gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents: 70141
diff changeset
705 (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
706 (buffer-substring (region-beginning) (region-end))
8e55901472d6 (gud-watch): Let user select an expression.
Nick Roberts <nickrob@snap.net.nz>
parents: 70141
diff changeset
707 (tooltip-identifier-from-point (point))))))
70503
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
708 (speedbar 1)
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
709 (catch 'already-watched
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
710 (dolist (var gdb-var-list)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
711 (unless (string-match "\\." (car var))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
712 (if (string-equal expr (nth 1 var))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
713 (throw 'already-watched nil))))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
714 (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
715 (gdb-enqueue-input
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
716 (list
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
717 (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
718 (concat
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
719 "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
720 (concat"-var-create - * " expr "\n"))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
721 `(lambda () (gdb-var-create-handler ,expr))))))))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
722 (message "gud-watch is a no-op in this mode."))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
723
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
724 (defconst gdb-var-create-regexp
69666
164fb98f5a8e (gdba): Revert 2006-03-10 change for case of "run" in .gdbinit.
Nick Roberts <nickrob@snap.net.nz>
parents: 69654
diff changeset
725 "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",.*type=\"\\(.*?\\)\"")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
726
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
727 (defun gdb-var-create-handler (expr)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
728 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
729 (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
730 (let ((var (list
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
731 (match-string 1)
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
732 (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
733 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
734 (setq expr (concat gdb-selected-frame "::" expr))
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
735 expr)
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
736 (match-string 2)
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
737 (match-string 3)
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
738 nil nil gdb-frame-address)))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
739 (push var gdb-var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
740 (unless (string-equal
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
741 speedbar-initial-expansion-list-name "GUD")
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
742 (speedbar-change-initial-expansion-list "GUD"))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
743 (gdb-enqueue-input
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
744 (list
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
745 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
70587
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
746 (concat "server interpreter mi \"0-var-evaluate-expression "
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
747 (car var) "\"\n")
70587
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
748 (concat "0-var-evaluate-expression " (car var) "\n"))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
749 `(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
750 ,(car var) nil)))))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
751 (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
752 (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
753 (message-box "No symbol \"%s\" in current context." expr))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
754
70503
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
755 (defun gdb-speedbar-update ()
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
756 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
757 ;; 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
758 (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
759 ;; 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
760 (push 'gdb-speedbar-timer gdb-pending-triggers)))
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
761
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
762 (defun gdb-speedbar-timer-fn ()
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
763 (setq gdb-pending-triggers
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
764 (delq 'gdb-speedbar-timer gdb-pending-triggers))
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
765 (speedbar-timer-fn))
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
766
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
767 (defun gdb-var-evaluate-expression-handler (varnum changed)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
768 (goto-char (point-min))
70587
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
769 (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t)
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
770 (setq gdb-pending-triggers
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
771 (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
772 (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
773 (when var
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
774 (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
775 (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
776 (gdb-speedbar-update))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
777
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
778 (defun gdb-var-list-children (varnum)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
779 (gdb-enqueue-input
60477
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
780 (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
781 `(lambda () (gdb-var-list-children-handler ,varnum)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
782
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
783 (defconst gdb-var-list-children-regexp
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
784 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\
72668
5a0fb2945b46 (gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 72651
diff changeset
785 numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
786
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
787 (defun gdb-var-list-children-handler (varnum)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
788 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
789 (let ((var-list nil))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
790 (catch 'child-already-watched
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
791 (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
792 (if (string-equal varnum (car var))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
793 (progn
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
794 (push var var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
795 (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
796 (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
797 (match-string 2)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
798 (match-string 3)
72668
5a0fb2945b46 (gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 72651
diff changeset
799 (match-string 6)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
800 nil nil)))
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
801 (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
802 (throw 'child-already-watched nil))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
803 (push varchild var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
804 (gdb-enqueue-input
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
805 (list
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
806 (concat
70587
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
807 "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
808 (car varchild) "\"\n")
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
809 `(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
810 ,(car varchild) nil)))))))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
811 (push var var-list)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
812 (setq gdb-var-list (nreverse var-list)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
813
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
814 (defun gdb-var-update ()
64346
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
815 (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
816 (gdb-enqueue-input
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
817 (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
818 'gdb-var-update-handler))
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
819 (push 'gdb-var-update gdb-pending-triggers)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
820
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
821 (defconst gdb-var-update-regexp
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
822 "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
823 type_changed=\".*?\".*?}")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
824
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
825 (defun gdb-var-update-handler ()
68993
3d9e09ba3ace (gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 68967
diff changeset
826 (dolist (var gdb-var-list)
3d9e09ba3ace (gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 68967
diff changeset
827 (setcar (nthcdr 5 var) nil))
3d9e09ba3ace (gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 68967
diff changeset
828 (goto-char (point-min))
70587
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
829 (let ((n 0))
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
830 (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
831 (let ((varnum (match-string 1)))
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
832 (if (string-equal (match-string 2) "false")
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
833 (let ((var (assoc varnum gdb-var-list)))
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
834 (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
835 (setq n (1+ n))
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
836 (push n gdb-pending-triggers)
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
837 (gdb-enqueue-input
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
838 (list
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
839 (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
840 "-var-evaluate-expression " varnum "\"\n")
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
841 `(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
842 (setq gdb-pending-triggers
70503
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
843 (delq 'gdb-var-update gdb-pending-triggers)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
844
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
845 (defun gdb-var-delete ()
64346
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
846 "Delete watch expression at point from the speedbar."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
847 (interactive)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
848 (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
849 '(gdbmi gdba))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
850 (let ((text (speedbar-line-text)))
70587
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
851 ;; Can't use \\S-+ for whitespace because
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
852 ;; speedbar has a whacky syntax table.
5bf70421e7ea (gdb-reset): Update speedbar if necessary.
Nick Roberts <nickrob@snap.net.nz>
parents: 70503
diff changeset
853 (string-match "\\([^ \t]+\\)" text)
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
854 (let ((expr (match-string 1 text)) var varnum)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
855 (catch 'expr-found
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
856 (dolist (var1 gdb-var-list)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
857 (when (string-equal expr (nth 1 var1))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
858 (setq var var1)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
859 (setq varnum (car var1))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
860 (throw 'expr-found nil))))
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
861 (unless (string-match "\\." (car var))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
862 (gdb-enqueue-input
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
863 (list
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
864 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
865 'gdba)
55764
25f133a490aa (gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 55762
diff changeset
866 (concat "server interpreter mi \"-var-delete " varnum "\"\n")
25f133a490aa (gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 55762
diff changeset
867 (concat "-var-delete " varnum "\n"))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
868 'ignore))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
869 (setq gdb-var-list (delq var gdb-var-list))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
870 (dolist (varchild gdb-var-list)
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
871 (if (string-match (concat (car var) "\\.") (car varchild))
69000
0dcc5b9decbf (gdb-force-update): Rename from gdb-var-changed.
Nick Roberts <nickrob@snap.net.nz>
parents: 68993
diff changeset
872 (setq gdb-var-list (delq varchild gdb-var-list)))))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
873
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
874 (defun gdb-edit-value (text token indent)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
875 "Assign a value to a variable displayed in the speedbar."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
876 (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
877 (varnum (car var)) (value))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
878 (setq value (read-string "New value: "))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
879 (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
880 (list
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
881 (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
882 (concat "server interpreter mi \"-var-assign "
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
883 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
884 (concat "-var-assign " varnum " " value "\n"))
69325
806b0c0e3bd1 (gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69234
diff changeset
885 `(lambda () (gdb-edit-value-handler ,value))))))
806b0c0e3bd1 (gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69234
diff changeset
886
806b0c0e3bd1 (gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69234
diff changeset
887 (defun gdb-edit-value-handler (value)
806b0c0e3bd1 (gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69234
diff changeset
888 (goto-char (point-min))
806b0c0e3bd1 (gdb-edit-value-handler): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69234
diff changeset
889 (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
890 (message-box "Invalid number or expression (%s)" value)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
891
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
892 (defcustom gdb-show-changed-values t
68967
87bf1f965a0f (gdb-var-list): Update doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68941
diff changeset
893 "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
894 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
895 Changed values are highlighted with the face `font-lock-warning-face'."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
896 :type 'boolean
58049
fd0093bd412a (gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 57982
diff changeset
897 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
898 :version "22.1")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
899
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
900 (defun gdb-speedbar-expand-node (text token indent)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
901 "Expand the node the user clicked on.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
902 TEXT is the text of the button we clicked on, a + or - item.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
903 TOKEN is data related to this node.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
904 INDENT is the current indentation depth."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
905 (cond ((string-match "+" text) ;expand this node
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
906 (if (and
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
907 (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
908 (string-equal gdb-version "pre-6.4"))
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
909 (gdb-var-list-children token)
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
910 (gdb-var-list-children-1 token)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
911 ((string-match "-" text) ;contract this node
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
912 (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
913 (if (string-match (concat token "\\.") (car var))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
914 (setq gdb-var-list (delq var gdb-var-list))))
69214
092d8fdb26e2 (gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69180
diff changeset
915 (speedbar-change-expand-button-char ?+)
092d8fdb26e2 (gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69180
diff changeset
916 (speedbar-delete-subblock indent))
092d8fdb26e2 (gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69180
diff changeset
917 (t (error "Ooops... not sure what to do")))
092d8fdb26e2 (gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69180
diff changeset
918 (speedbar-center-buffer-smartly))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
919
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
920 (defun gdb-get-target-string ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
921 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
922 gud-target-name))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
923
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
924
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
925 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
926 ;; gdb buffers.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
927 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
928 ;; Each buffer has a TYPE -- a symbol that identifies the function
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
929 ;; of that particular buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
930 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
931 ;; The usual gdb interaction buffer is given the type `gdba' and
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
932 ;; is constructed specially.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
933 ;;
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
934 ;; Others are constructed by gdb-get-buffer-create and
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
935 ;; named according to the rules set forth in the gdb-buffer-rules-assoc
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
936
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
937 (defvar gdb-buffer-rules-assoc '())
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
938
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
939 (defun gdb-get-buffer (key)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
940 "Return the gdb buffer tagged with type KEY.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
941 The key should be one of the cars in `gdb-buffer-rules-assoc'."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
942 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
943 (gdb-look-for-tagged-buffer key (buffer-list))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
944
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
945 (defun gdb-get-buffer-create (key)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
946 "Create a new gdb buffer of the type specified by KEY.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
947 The key should be one of the cars in `gdb-buffer-rules-assoc'."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
948 (or (gdb-get-buffer key)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
949 (let* ((rules (assoc key gdb-buffer-rules-assoc))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
950 (name (funcall (gdb-rules-name-maker rules)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
951 (new (get-buffer-create name)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
952 (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
953 (let ((trigger))
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
954 (if (cdr (cdr rules))
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
955 (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
956 (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
957 (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
958 (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
959 (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
960 (if trigger (funcall trigger)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
961 new))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
962
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
963 (defun gdb-rules-name-maker (rules) (car (cdr rules)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
964
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
965 (defun gdb-look-for-tagged-buffer (key bufs)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
966 (let ((retval nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
967 (while (and (not retval) bufs)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
968 (set-buffer (car bufs))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
969 (if (eq gdb-buffer-type key)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
970 (setq retval (car bufs)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
971 (setq bufs (cdr bufs)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
972 retval))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
973
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
974 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
975 ;; This assoc maps buffer type symbols to rules. Each rule is a list of
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
976 ;; at least one and possible more functions. The functions have these
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
977 ;; roles in defining a buffer type:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
978 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
979 ;; NAME - Return a name for this buffer type.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
980 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
981 ;; The remaining function(s) are optional:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
982 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
983 ;; MODE - called in a new buffer with no arguments, should establish
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
984 ;; the proper mode for the buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
985 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
986
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
987 (defun gdb-set-buffer-rules (buffer-type &rest rules)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
988 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
989 (if binding
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
990 (setcdr binding rules)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
991 (push (cons buffer-type rules)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
992 gdb-buffer-rules-assoc))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
993
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
994 ;; GUD buffers are an exception to the rules
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
995 (gdb-set-buffer-rules 'gdba 'error)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
996
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
997 ;; Partial-output buffer : This accumulates output from a command executed on
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
998 ;; behalf of emacs (rather than the user).
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
999 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1000 (gdb-set-buffer-rules 'gdb-partial-output-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1001 'gdb-partial-output-name)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1002
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1003 (defun gdb-partial-output-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1004 (concat "*partial-output-"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1005 (gdb-get-target-string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1006 "*"))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1007
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1008
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1009 (gdb-set-buffer-rules 'gdb-inferior-io
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1010 'gdb-inferior-io-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1011 'gdb-inferior-io-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1012
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1013 (defun gdb-inferior-io-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1014 (concat "*input/output of "
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1015 (gdb-get-target-string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1016 "*"))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1017
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1018 (defun gdb-display-separate-io-buffer ()
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
1019 "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
1020 (interactive)
68903
57fa3643220b (gdb-display-separate-io-buffer): Change use of
Nick Roberts <nickrob@snap.net.nz>
parents: 68902
diff changeset
1021 (if gdb-use-separate-io-buffer
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
1022 (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
1023 (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
1024
65231
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
1025 (defconst gdb-frame-parameters
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
1026 '((height . 14) (width . 80)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
1027 (unsplittable . t)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
1028 (tool-bar-lines . nil)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
1029 (menu-bar-lines . nil)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
1030 (minibuffer . nil)))
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
1031
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1032 (defun gdb-frame-separate-io-buffer ()
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1033 "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
1034 (interactive)
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1035 (if gdb-use-separate-io-buffer
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
1036 (let ((special-display-regexps (append special-display-regexps '(".*")))
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
1037 (special-display-frame-alist gdb-frame-parameters))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1038 (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
1039
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1040 (defvar gdb-inferior-io-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1041 (let ((map (make-sparse-keymap)))
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1042 (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
1043 (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
1044 (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
1045 (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
1046 (define-key map "\C-d" 'gdb-separate-io-eof)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1047 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1048
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1049 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1050 "Major mode for gdb inferior-io."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1051 :syntax-table nil :abbrev-table nil
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1052 ;; We want to use comint because it has various nifty and familiar
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1053 ;; features. We don't need a process, but comint wants one, so create
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1054 ;; a dummy one.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1055 (make-comint-in-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1056 (substring (buffer-name) 1 (- (length (buffer-name)) 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1057 (current-buffer) "hexl")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1058 (setq comint-input-sender 'gdb-inferior-io-sender))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1059
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1060 (defun gdb-inferior-io-sender (proc string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1061 ;; PROC is the pseudo-process created to satisfy comint.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1062 (with-current-buffer (process-buffer proc)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1063 (setq proc (get-buffer-process gud-comint-buffer))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1064 (process-send-string proc string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1065 (process-send-string proc "\n")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1066
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1067 (defun gdb-separate-io-interrupt ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1068 "Interrupt the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1069 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1070 (interrupt-process
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1071 (get-buffer-process gud-comint-buffer) comint-ptyp))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1072
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1073 (defun gdb-separate-io-quit ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1074 "Send quit signal to the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1075 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1076 (quit-process
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1077 (get-buffer-process gud-comint-buffer) comint-ptyp))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1078
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1079 (defun gdb-separate-io-stop ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1080 "Stop the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1081 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1082 (stop-process
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1083 (get-buffer-process gud-comint-buffer) comint-ptyp))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1084
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1085 (defun gdb-separate-io-eof ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1086 "Send end-of-file to the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1087 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1088 (process-send-eof
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1089 (get-buffer-process gud-comint-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1090
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1091
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1092 ;; gdb communications
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1093 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1094
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1095 ;; INPUT: things sent to gdb
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1096 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1097 ;; The queues are lists. Each element is either a string (indicating user or
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1098 ;; user-like input) or a list of the form:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1099 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1100 ;; (INPUT-STRING HANDLER-FN)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1101 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1102 ;; The handler function will be called from the partial-output buffer when the
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1103 ;; command completes. This is the way to write commands which invoke gdb
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1104 ;; commands autonomously.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1105 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1106 ;; These lists are consumed tail first.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1107 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1108
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1109 (defun gdb-send (proc string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1110 "A comint send filter for gdb.
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1111 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
1112 (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
1113 (let ((inhibit-read-only t))
9e9e3aac0fda (gdb-send): Bind inhibit-read-only to t
Nick Roberts <nickrob@snap.net.nz>
parents: 66162
diff changeset
1114 (remove-text-properties (point-min) (point-max) '(face))))
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
1115 (if gud-running
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
1116 (progn
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
1117 (let ((item (concat string "\n")))
69526
c32efda6ab27 (gud-watch): Provide completion.
Nick Roberts <nickrob@snap.net.nz>
parents: 69510
diff changeset
1118 (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring))
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
1119 (process-send-string proc item)))
71090
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
1120 (if (and (string-match "\\\\$" string)
d135a47c9bbe Move gdb-mouse-toggle-breakpoint-* to
Nick Roberts <nickrob@snap.net.nz>
parents: 70587
diff changeset
1121 (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
1122 (setq gdb-continuation (concat gdb-continuation string "\n"))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
1123 (let ((item (concat gdb-continuation string "\n")))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
1124 (gdb-enqueue-input item)
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
1125 (setq gdb-continuation nil)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1126
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1127 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1128 ;; is a query, or other non-top-level prompt.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1129
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1130 (defun gdb-enqueue-input (item)
69359
e184d816a2b1 (gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69350
diff changeset
1131 (if (not gud-running)
e184d816a2b1 (gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69350
diff changeset
1132 (if gdb-prompting
e184d816a2b1 (gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69350
diff changeset
1133 (progn
e184d816a2b1 (gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69350
diff changeset
1134 (gdb-send-item item)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1135 (setq gdb-prompting nil))
69359
e184d816a2b1 (gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69350
diff changeset
1136 (push item gdb-input-queue))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1137
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1138 (defun gdb-dequeue-input ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1139 (let ((queue gdb-input-queue))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1140 (and queue
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1141 (let ((last (car (last queue))))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1142 (unless (nbutlast queue) (setq gdb-input-queue '()))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1143 last))))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1144
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1145 (defun gdb-send-item (item)
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1146 (setq gdb-flush-pending-output nil)
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
1147 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-ring))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1148 (setq gdb-current-item item)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
1149 (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
1150 (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
1151 (if (stringp item)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1152 (progn
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1153 (setq gdb-output-sink 'user)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
1154 (process-send-string process item))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1155 (progn
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1156 (gdb-clear-partial-output)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1157 (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
1158 (process-send-string process
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1159 (car item))))
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1160 ;; case: eq gud-minor-mode 'gdbmi
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1161 (gdb-clear-partial-output)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1162 (setq gdb-output-sink 'emacs)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
1163 (process-send-string process (car item)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1164
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1165 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1166 ;; output -- things gdb prints to emacs
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1167 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1168 ;; GDB output is a stream interrupted by annotations.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1169 ;; Annotations can be recognized by their beginning
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1170 ;; with \C-j\C-z\C-z<tag><opt>\C-j
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1171 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1172 ;; The tag is a string obeying symbol syntax.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1173 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1174 ;; The optional part `<opt>' can be either the empty string
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1175 ;; or a space followed by more data relating to the annotation.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1176 ;; For example, the SOURCE annotation is followed by a filename,
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1177 ;; line number and various useless goo. This data must not include
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1178 ;; any newlines.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1179 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1180
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1181 (defcustom gud-gdba-command-name "gdb -annotate=3"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1182 "Default command to execute an executable under the GDB-UI debugger."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1183 :type 'string
57851
67b88e92a24d (gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents: 57791
diff changeset
1184 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
1185 :version "22.1")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1186
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1187 (defvar gdb-annotation-rules
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1188 '(("pre-prompt" gdb-pre-prompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1189 ("prompt" gdb-prompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1190 ("commands" gdb-subprompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1191 ("overload-choice" gdb-subprompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1192 ("query" gdb-subprompt)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1193 ;; 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
1194 ("nquery" gdb-subprompt)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1195 ("prompt-for-continue" gdb-subprompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1196 ("post-prompt" gdb-post-prompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1197 ("source" gdb-source)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1198 ("starting" gdb-starting)
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1199 ("exited" gdb-exited)
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
1200 ("signalled" gdb-signalled)
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1201 ("signal" gdb-signal)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1202 ("breakpoint" gdb-stopping)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1203 ("watchpoint" gdb-stopping)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1204 ("frame-begin" gdb-frame-begin)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1205 ("stopped" gdb-stopped)
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1206 ("error-begin" gdb-error)
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1207 ("error" gdb-error)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1208 ) "An assoc mapping annotation tags to functions which process them.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1209
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1210 (defun gdb-resync()
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1211 (setq gdb-flush-pending-output t)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1212 (setq gud-running nil)
72113
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1213 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1214 (propertize "stopped"'face font-lock-warning-face))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1215 (setq gdb-output-sink 'user)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1216 (setq gdb-input-queue nil)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1217 (setq gdb-pending-triggers nil)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1218 (setq gdb-prompting t))
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1219
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1220 (defconst gdb-source-spec-regexp
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
1221 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1222
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1223 ;; Do not use this except as an annotation handler.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1224 (defun gdb-source (args)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1225 (string-match gdb-source-spec-regexp args)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1226 ;; Extract the frame position from the marker.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1227 (setq gud-last-frame
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1228 (cons
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1229 (match-string 1 args)
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
1230 (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
1231 (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
1232 ;; cover for auto-display output which comes *before*
c3272c09f927 (gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents: 54901
diff changeset
1233 ;; stopped annotation
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1234 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1235
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1236 (defun gdb-pre-prompt (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1237 "An annotation handler for `pre-prompt'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1238 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
1239 happens to be in effect."
67164
c3990f178905 (gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents: 67147
diff changeset
1240 (setq gdb-error nil)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1241 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1242 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1243 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1244 ((eq sink 'emacs)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1245 (setq gdb-output-sink 'post-emacs))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1246 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1247 (gdb-resync)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1248 (error "Phase error in gdb-pre-prompt (got %s)" sink)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1249
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1250 (defun gdb-prompt (ignored)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1251 "An annotation handler for `prompt'.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1252 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
1253 (when gdb-first-prompt
72113
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1254 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1255 (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
1256 (gdb-init-1)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1257 (setq gdb-first-prompt nil))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1258 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1259 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1260 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1261 ((eq sink 'post-emacs)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1262 (setq gdb-output-sink 'user)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1263 (let ((handler
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1264 (car (cdr gdb-current-item))))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1265 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1266 (funcall handler))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1267 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1268 (gdb-resync)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1269 (error "Phase error in gdb-prompt (got %s)" sink))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1270 (let ((input (gdb-dequeue-input)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1271 (if input
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1272 (gdb-send-item input)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1273 (progn
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1274 (setq gdb-prompting t)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1275 (gud-display-frame)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1276
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1277 (defun gdb-subprompt (ignored)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1278 "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
1279 (setq gdb-prompting t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1280
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1281 (defun gdb-starting (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1282 "An annotation handler for `starting'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1283 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
1284 not GDB."
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1285 (setq gdb-active-process t)
71348
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1286 (setq gdb-printing t)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1287 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1288 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1289 ((eq sink 'user)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1290 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1291 (setq gud-running t)
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1292 (setq gdb-inferior-status "running")
72492
2bf69eaa157d (gdb-starting): Reset gdb-signalled to nil.
Nick Roberts <nickrob@snap.net.nz>
parents: 72481
diff changeset
1293 (setq gdb-signalled nil)
72113
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1294 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1295 (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
1296 (gdb-remove-text-properties)
71348
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1297 (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
1298 (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
1299 (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
1300 (setq gdb-stack-position nil)
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1301 (if gdb-use-separate-io-buffer
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1302 (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
1303 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1304 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1305 (error "Unexpected `starting' annotation")))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1306
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1307 (defun gdb-signal (ignored)
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1308 (setq gdb-inferior-status "signal")
72113
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1309 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1310 (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
1311 (gdb-stopping ignored))
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1312
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1313 (defun gdb-stopping (ignored)
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1314 "An annotation handler for `breakpoint' and other annotations.
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1315 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
1316 being debugged."
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
1317 (if gdb-use-separate-io-buffer
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1318 (let ((sink gdb-output-sink))
54729
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
1319 (cond
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
1320 ((eq sink 'inferior)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1321 (setq gdb-output-sink 'user))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1322 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1323 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1324 (error "Unexpected stopping annotation"))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1325
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1326 (defun gdb-exited (ignored)
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1327 "An annotation handler for `exited' and `signalled'.
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1328 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
1329 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
1330 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
1331 directives."
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1332 (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
1333 (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
1334 (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
1335 (setq gdb-stack-position nil)
71409
f723aa5cf2de (gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents: 71348
diff changeset
1336 (setq gud-old-arrow nil)
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1337 (setq gdb-inferior-status "exited")
72113
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1338 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1339 (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
1340 (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
1341
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
1342 (defun gdb-signalled (ignored)
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
1343 (setq gdb-signalled t))
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
1344
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1345 (defun gdb-frame-begin (ignored)
71348
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1346 (setq gdb-frame-begin t)
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1347 (setq gdb-printing nil)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1348 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1349 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1350 ((eq sink 'inferior)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1351 (setq gdb-output-sink 'user))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1352 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1353 ((eq sink 'emacs) t)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1354 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1355 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1356 (error "Unexpected frame-begin annotation (%S)" sink)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1357
71348
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1358 (defcustom gdb-same-frame focus-follows-mouse
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1359 "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
1360 :group 'gud
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1361 :type 'boolean
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1362 :version "22.1")
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1363
72235
589dd2ca13b2 (gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents: 72224
diff changeset
1364 (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
1365 "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
1366 :group 'gud
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1367 :type 'boolean
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1368 :version "22.1")
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1369
72235
589dd2ca13b2 (gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents: 72224
diff changeset
1370 (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
1371 "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
1372 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
1373 (interactive "P")
589dd2ca13b2 (gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents: 72224
diff changeset
1374 (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
1375 (if (null arg)
589dd2ca13b2 (gdb-find-source-frame): Make nil the default value.
Nick Roberts <nickrob@snap.net.nz>
parents: 72224
diff changeset
1376 (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
1377 (> (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
1378 (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
1379 (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
1380
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1381 (defun gdb-stopped (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1382 "An annotation handler for `stopped'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1383 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
1384 sink to `user' in `gdb-stopping', that is fine."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1385 (setq gud-running nil)
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
1386 (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
1387 (if (and gdb-frame-begin gdb-printing)
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1388 (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
1389 ;;Pop up GUD buffer to display current frame when it doesn't have source
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
1390 ;;information i.e id 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
1391 (if gdb-same-frame
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1392 (gdb-display-gdb-buffer)
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
1393 (gdb-frame-gdb-buffer))
72200
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1394 (if gdb-find-source-frame
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
1395 ;;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
1396 (setq gdb-look-up-stack
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1397 (if (gdb-get-buffer 'gdb-stack-buffer)
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1398 'keep
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1399 (progn
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1400 (gdb-get-buffer-create 'gdb-stack-buffer)
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1401 (gdb-invalidate-frames)
46549662dfe0 (gdb-find-source-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 72158
diff changeset
1402 'delete))))))
69510
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1403 (unless (member gdb-inferior-status '("exited" "signal"))
43a2ed622bbd (gdb-inferior-status): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69475
diff changeset
1404 (setq gdb-inferior-status "stopped")
72113
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1405 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
1406 (propertize gdb-inferior-status 'face font-lock-warning-face)))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1407 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1408 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1409 ((eq sink 'inferior)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1410 (setq gdb-output-sink 'user))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1411 ((eq sink 'user) t)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1412 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1413 (gdb-resync)
69106
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
1414 (error "Unexpected stopped annotation"))))
3f5044e40e3e (gdb-signalled): New variable and function.
Nick Roberts <nickrob@snap.net.nz>
parents: 69042
diff changeset
1415 (if gdb-signalled (gdb-exited ignored)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1416
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1417 (defun gdb-error (ignored)
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1418 (setq gdb-error (not gdb-error)))
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1419
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1420 (defun gdb-post-prompt (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1421 "An annotation handler for `post-prompt'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1422 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
1423 happens to be appropriate."
69234
67e921172c0d (gdb-speedbar-refresh): Quieten speedbar-refresh.
Nick Roberts <nickrob@snap.net.nz>
parents: 69214
diff changeset
1424 ;; 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
1425 ;; yet.
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1426 (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
1427 (gdb-get-selected-frame)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1428 (gdb-invalidate-frames)
68664
e444fe32e1b4 (gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents: 67891
diff changeset
1429 ;; 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
1430 (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
1431 (gdb-invalidate-breakpoints)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1432 ;; 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
1433 ;; so gdb-pc-address is updated.
63358
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1434 ;; (gdb-invalidate-assembler)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1435
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1436 (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
1437 (gdb-invalidate-registers)
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1438 (gdb-get-changed-registers)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1439 (gdb-invalidate-registers-1))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1440
63358
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1441 (gdb-invalidate-memory)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1442 (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
1443 (gdb-invalidate-locals)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1444 (gdb-invalidate-locals-1))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1445
63358
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1446 (gdb-invalidate-threads)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1447 (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
1448 ;; FIXME: with GDB-6 on Darwin, this might very well work.
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1449 ;; 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
1450 (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
1451 (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
1452 (gdb-var-update)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1453 (gdb-var-update-1)))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1454 (setq gdb-first-post-prompt nil)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1455 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1456 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1457 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1458 ((eq sink 'pre-emacs)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1459 (setq gdb-output-sink 'emacs))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1460 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1461 (gdb-resync)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1462 (error "Phase error in gdb-post-prompt (got %s)" sink)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1463
69350
d3742811a570 (gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents: 69325
diff changeset
1464 (defconst gdb-buffer-list
d3742811a570 (gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents: 69325
diff changeset
1465 '(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
1466
69359
e184d816a2b1 (gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69350
diff changeset
1467 (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
1468 (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
1469 (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
1470 (if buffer
d3742811a570 (gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents: 69325
diff changeset
1471 (with-current-buffer buffer
d3742811a570 (gdba): Don't call gdb-init-1 explicitly as
Nick Roberts <nickrob@snap.net.nz>
parents: 69325
diff changeset
1472 (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
1473 (remove-text-properties
69359
e184d816a2b1 (gdb-remove-text-properties): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69350
diff changeset
1474 (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
1475
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1476 ;; 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
1477 ;; 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
1478 ;; visited breakpoint is, use that window.
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1479 (defun gdb-display-source-buffer (buffer)
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1480 (let* ((last-window (if gud-last-last-frame
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1481 (get-buffer-window
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1482 (gud-find-file (car gud-last-last-frame)))))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1483 (source-window (or last-window
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1484 (if (and gdb-source-window
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1485 (window-live-p gdb-source-window))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1486 gdb-source-window))))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1487 (when source-window
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1488 (setq gdb-source-window source-window)
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1489 (set-window-buffer source-window buffer))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1490 source-window))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1491
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1492 (defun gud-gdba-marker-filter (string)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1493 "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
1494 (if gdb-flush-pending-output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1495 nil
69108
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
1496 (when gdb-enable-debug
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
1497 (push (cons 'recv string) gdb-debug-ring)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
1498 (if (> (length gdb-debug-ring) gdb-debug-ring-max)
8ff0077b3342 (gdb-debug-ring-max): Rename from gdb-debug-log-length.
Nick Roberts <nickrob@snap.net.nz>
parents: 69106
diff changeset
1499 (setcdr (nthcdr (1- gdb-debug-ring-max) gdb-debug-ring) nil)))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1500 ;; 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
1501 (setq gud-marker-acc (concat gud-marker-acc string))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1502 ;; 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
1503 (let ((output ""))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1504 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1505 ;; 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
1506 (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
1507 (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
1508 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1509 ;; 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
1510 ;; 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
1511 ;; elsewhere.
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1512 (setq output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1513 (gdb-concat-output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1514 output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1515 (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
1516 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1517 ;; 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
1518 (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
1519 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1520 ;; 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
1521 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1522 (let* ((annotation-type (match-string 1 annotation))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1523 (annotation-arguments (match-string 2 annotation))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1524 (annotation-rule (assoc annotation-type
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1525 gdb-annotation-rules)))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1526 ;; Call the handler for this annotation.
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1527 (if annotation-rule
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1528 (funcall (car (cdr annotation-rule))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1529 annotation-arguments)
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1530 ;; 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
1531 ;; 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
1532 ;; us to blow up.
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 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1535 ;; 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
1536 ;; 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
1537 (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
1538 gud-marker-acc)
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1539 (progn
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1540 ;; 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
1541 (setq output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1542 (gdb-concat-output output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1543 (substring gud-marker-acc 0
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1544 (match-beginning 0))))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1545 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1546 ;; 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
1547 (setq gud-marker-acc (substring gud-marker-acc
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1548 (match-beginning 0))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1549 ;;
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1550 ;; In case we know the gud-marker-acc contains no partial annotations:
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1551 (progn
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1552 (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
1553 (setq gud-marker-acc "")))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1554 output)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1555
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1556 (defun gdb-concat-output (so-far new)
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1557 (if gdb-error
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1558 (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
1559 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1560 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1561 ((eq sink 'user) (concat so-far new))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1562 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1563 ((eq sink 'emacs)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1564 (gdb-append-to-partial-output new)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1565 so-far)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1566 ((eq sink 'inferior)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1567 (gdb-append-to-inferior-io new)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1568 so-far)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1569 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1570 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1571 (error "Bogon output sink %S" sink)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1572
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1573 (defun gdb-append-to-partial-output (string)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1574 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1575 (goto-char (point-max))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1576 (insert string)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1577
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1578 (defun gdb-clear-partial-output ()
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1579 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1580 (erase-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1581
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1582 (defun gdb-append-to-inferior-io (string)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1583 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1584 (goto-char (point-max))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1585 (insert-before-markers string))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1586 (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
1587 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1588
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1589 (defun gdb-clear-inferior-io ()
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1590 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1591 (erase-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1592
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1593
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1594 ;; One trick is to have a command who's output is always available in a buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1595 ;; of it's own, and is always up to date. We build several buffers of this
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1596 ;; type.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1597 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1598 ;; There are two aspects to this: gdb has to tell us when the output for that
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1599 ;; command might have changed, and we have to be able to run the command
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1600 ;; behind the user's back.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1601 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1602 ;; The output phasing associated with the variable gdb-output-sink
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1603 ;; help us to run commands behind the user's back.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1604 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1605 ;; Below is the code for specificly managing buffers of output from one
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1606 ;; command.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1607 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1608
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1609 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1610 ;; It adds an input for the command we are tracking. It should be the
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1611 ;; annotation rule binding of whatever gdb sends to tell us this command
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1612 ;; might have changed it's output.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1613 ;;
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1614 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1615 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1616 ;; input in the input queue (see comment about ``gdb communications'' above).
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1617
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1618 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1619 output-handler)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1620 `(defun ,name (&optional ignored)
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
1621 (if (and ,demand-predicate
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1622 (not (member ',name
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1623 gdb-pending-triggers)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1624 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1625 (gdb-enqueue-input
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1626 (list ,gdb-command ',output-handler))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1627 (push ',name gdb-pending-triggers)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1628
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1629 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1630 `(defun ,name ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1631 (setq gdb-pending-triggers
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1632 (delq ',trigger
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1633 gdb-pending-triggers))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1634 (let ((buf (gdb-get-buffer ',buf-key)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1635 (and buf
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1636 (with-current-buffer buf
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
1637 (let* ((window (get-buffer-window buf 0))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1638 (start (window-start window))
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
1639 (p (window-point window))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1640 (buffer-read-only nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1641 (erase-buffer)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1642 (insert-buffer-substring (gdb-get-buffer-create
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1643 'gdb-partial-output-buffer))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1644 (set-window-start window start)
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
1645 (set-window-point window p)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1646 ;; put customisation here
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1647 (,custom-defun)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1648
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1649 (defmacro def-gdb-auto-updated-buffer (buffer-key
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1650 trigger-name gdb-command
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1651 output-handler-name custom-defun)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1652 `(progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1653 (def-gdb-auto-update-trigger ,trigger-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1654 ;; The demand predicate:
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
1655 (gdb-get-buffer ',buffer-key)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1656 ,gdb-command
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1657 ,output-handler-name)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1658 (def-gdb-auto-update-handler ,output-handler-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1659 ,trigger-name ,buffer-key ,custom-defun)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1660
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1661
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1662 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1663 ;; Breakpoint buffer : This displays the output of `info breakpoints'.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1664 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1665 (gdb-set-buffer-rules 'gdb-breakpoints-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1666 'gdb-breakpoints-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1667 'gdb-breakpoints-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1668
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1669 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1670 ;; This defines the auto update rule for buffers of type
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1671 ;; `gdb-breakpoints-buffer'.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1672 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1673 ;; It defines a function to serve as the annotation handler that
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1674 ;; handles the `foo-invalidated' message. That function is called:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1675 gdb-invalidate-breakpoints
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1676 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1677 ;; To update the buffer, this command is sent to gdb.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1678 "server info breakpoints\n"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1679 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1680 ;; This also defines a function to be the handler for the output
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1681 ;; from the command above. That function will copy the output into
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1682 ;; the appropriately typed buffer. That function will be called:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1683 gdb-info-breakpoints-handler
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1684 ;; buffer specific functions
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1685 gdb-info-breakpoints-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1686
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1687 (defconst breakpoint-xpm-data
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1688 "/* XPM */
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1689 static char *magick[] = {
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1690 /* columns rows colors chars-per-pixel */
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1691 \"10 10 2 1\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1692 \" c red\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1693 \"+ c None\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1694 /* pixels */
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1695 \"+++ +++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1696 \"++ ++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1697 \"+ +\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1698 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1699 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1700 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1701 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1702 \"+ +\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1703 \"++ ++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1704 \"+++ +++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1705 };"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1706 "XPM data used for breakpoint icon.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1707
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1708 (defconst breakpoint-enabled-pbm-data
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1709 "P1
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1710 10 10\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1711 0 0 0 0 1 1 1 1 0 0 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1712 0 0 0 1 1 1 1 1 1 0 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1713 0 0 1 1 1 1 1 1 1 1 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1714 0 1 1 1 1 1 1 1 1 1 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1715 0 1 1 1 1 1 1 1 1 1 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1716 0 1 1 1 1 1 1 1 1 1 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1717 0 1 1 1 1 1 1 1 1 1 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1718 0 0 1 1 1 1 1 1 1 1 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1719 0 0 0 1 1 1 1 1 1 0 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1720 0 0 0 0 1 1 1 1 0 0 0 0"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1721 "PBM data used for enabled breakpoint icon.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1722
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1723 (defconst breakpoint-disabled-pbm-data
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1724 "P1
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1725 10 10\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1726 0 0 1 0 1 0 1 0 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1727 0 1 0 1 0 1 0 1 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1728 1 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1729 0 1 0 1 0 1 0 1 0 1
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1730 1 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1731 0 1 0 1 0 1 0 1 0 1
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1732 1 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1733 0 1 0 1 0 1 0 1 0 1
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1734 0 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1735 0 0 0 1 0 1 0 1 0 0"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1736 "PBM data used for disabled breakpoint icon.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1737
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1738 (defvar breakpoint-enabled-icon nil
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1739 "Icon for enabled breakpoint in display margin.")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1740
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1741 (defvar breakpoint-disabled-icon nil
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1742 "Icon for disabled breakpoint in display margin.")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1743
57982
641cb7192482 Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents: 57851
diff changeset
1744 (and (display-images-p)
69609
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
1745 ;; 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
1746 (define-fringe-bitmap 'breakpoint
69609
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
1747 "\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
1748 ;; 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
1749 (define-fringe-bitmap 'hollow-right-triangle
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
1750 "\xe0\x90\x88\x84\x84\x88\x90\xe0"))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1751
60760
a706fe4203bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents: 60541
diff changeset
1752 (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
1753 '((t
88ef15014617 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents: 60839
diff changeset
1754 :foreground "red"
88ef15014617 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents: 60839
diff changeset
1755 :weight bold))
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1756 "Face for enabled breakpoint icon in fringe."
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1757 :group 'gud)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1758
60760
a706fe4203bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents: 60541
diff changeset
1759 (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
1760 ;; 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
1761 ;; 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
1762 ;; 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
1763 '((t :foreground "grey70"))
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1764 "Face for disabled breakpoint icon in fringe."
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1765 :group 'gud)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1766
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1767 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer).
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1768 (defun gdb-info-breakpoints-custom ()
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1769 (let ((flag) (bptno))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1770 ;; Remove all breakpoint-icons in source buffers but not assembler buffer.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1771 (dolist (buffer (buffer-list))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1772 (with-current-buffer buffer
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1773 (if (and (memq gud-minor-mode '(gdba gdbmi))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1774 (not (string-match "\\`\\*.+\\*\\'" (buffer-name))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1775 (gdb-remove-breakpoint-icons (point-min) (point-max)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1776 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1777 (save-excursion
72158
89c27eb47328 (gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents: 72113
diff changeset
1778 (let ((buffer-read-only nil))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1779 (goto-char (point-min))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1780 (while (< (point) (- (point-max) 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1781 (forward-line 1)
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1782 (if (looking-at gdb-breakpoint-regexp)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1783 (progn
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1784 (setq bptno (match-string 1))
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1785 (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
1786 (add-text-properties
89c27eb47328 (gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents: 72113
diff changeset
1787 (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
1788 (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
1789 '(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
1790 '(face font-lock-type-face)))
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1791 (let ((bl (point))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1792 (el (line-end-position)))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1793 (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
1794 (progn
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1795 (add-text-properties
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1796 (match-beginning 1) (match-end 1)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1797 '(face font-lock-function-name-face))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1798 (looking-at "\\(\\S-+\\):\\([0-9]+\\)")
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1799 (let ((line (match-string 2))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1800 (file (match-string 1)))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1801 (add-text-properties bl el
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1802 '(mouse-face highlight
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1803 help-echo "mouse-2, RET: visit breakpoint"))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1804 (unless (file-exists-p file)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1805 (setq file (cdr (assoc bptno gdb-location-alist))))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1806 (if (and file
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1807 (not (string-equal file "File not found")))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1808 (with-current-buffer
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1809 (find-file-noselect file 'nowarn)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1810 (set (make-local-variable 'gud-minor-mode)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1811 'gdba)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1812 (set (make-local-variable 'tool-bar-map)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1813 gud-tool-bar-map)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1814 ;; Only want one breakpoint icon at each
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1815 ;; location.
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1816 (save-excursion
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1817 (goto-line (string-to-number line))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1818 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1819 (gdb-enqueue-input
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1820 (list
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1821 (concat gdb-server-prefix "list "
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1822 (match-string-no-properties 1) ":1\n")
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1823 'ignore))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1824 (gdb-enqueue-input
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1825 (list (concat gdb-server-prefix "info source\n")
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1826 `(lambda () (gdb-get-location
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1827 ,bptno ,line ,flag)))))))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1828 (if (re-search-forward
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1829 "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1830 el t)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1831 (add-text-properties
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1832 (match-beginning 1) (match-end 1)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1833 '(face font-lock-function-name-face))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1834 (end-of-line)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1835 (re-search-backward "\\s-\\(\\S-*\\)"
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1836 bl t)
72158
89c27eb47328 (gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents: 72113
diff changeset
1837 (add-text-properties
89c27eb47328 (gdb-info-breakpoints-custom): Use different faces for enable character.
Nick Roberts <nickrob@snap.net.nz>
parents: 72113
diff changeset
1838 (match-beginning 1) (match-end 1)
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
1839 '(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
1840 (end-of-line))))))
54962
c3272c09f927 (gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents: 54901
diff changeset
1841 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1842
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1843 (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
1844 "Set/clear breakpoint in left fringe/margin with mouse click."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1845 (interactive "e")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1846 (mouse-minibuffer-check event)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1847 (let ((posn (event-end event)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1848 (if (numberp (posn-point posn))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1849 (with-selected-window (posn-window posn)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1850 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1851 (goto-char (posn-point posn))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1852 (if (or (posn-object posn)
57262
df4b0ff293d8 (breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents: 56330
diff changeset
1853 (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
1854 'breakpoint))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1855 (gud-remove nil)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1856 (gud-break nil)))))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1857
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1858 (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
1859 "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
1860 (interactive "e")
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1861 (mouse-minibuffer-check event)
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1862 (let ((posn (event-end event)))
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1863 (if (numberp (posn-point posn))
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1864 (with-selected-window (posn-window posn)
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1865 (save-excursion
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1866 (goto-char (posn-point posn))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1867 (if (posn-object posn)
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1868 (gdb-enqueue-input
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1869 (list
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1870 (let ((bptno (get-text-property
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1871 0 'gdb-bptno (car (posn-string posn)))))
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1872 (concat gdb-server-prefix
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1873 (if (get-text-property
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1874 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
1875 "disable "
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1876 "enable ")
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1877 bptno "\n"))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1878 'ignore))))))))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1879
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1880 (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
1881 "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
1882 (interactive "e")
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1883 (mouse-minibuffer-check event)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1884 (let* ((posn (event-end event))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1885 (pos (posn-point posn))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1886 obj)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1887 (when (numberp pos)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1888 (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
1889 (save-excursion
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1890 (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
1891 (goto-char pos)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1892 (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
1893 (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
1894 (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
1895 (when (stringp obj)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1896 (gdb-enqueue-input
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1897 (list
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1898 (concat gdb-server-prefix
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1899 (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
1900 "disable "
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1901 "enable ")
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1902 (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
1903 'ignore))))))))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1904
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1905 (defun gdb-breakpoints-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1906 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1907 (concat "*breakpoints of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1908
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1909 (defun gdb-display-breakpoints-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1910 "Display status of user-settable breakpoints."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1911 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1912 (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
1913 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1914
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1915 (defun gdb-frame-breakpoints-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1916 "Display status of user-settable breakpoints in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1917 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
1918 (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
1919 (special-display-frame-alist gdb-frame-parameters))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1920 (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1921
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1922 (defvar gdb-breakpoints-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1923 (let ((map (make-sparse-keymap))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1924 (menu (make-sparse-keymap "Breakpoints")))
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1925 (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
1926 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1927 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint))
60946
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
1928 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1929 (suppress-keymap map)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1930 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1931 (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
1932 (define-key map "D" 'gdb-delete-breakpoint)
68664
e444fe32e1b4 (gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents: 67891
diff changeset
1933 ;; 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
1934 (define-key map "q" 'gdb-delete-frame-or-window)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1935 (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
1936 (define-key map [mouse-2] 'gdb-goto-breakpoint)
60946
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
1937 (define-key map [follow-link] 'mouse-face)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1938 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1939
68664
e444fe32e1b4 (gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents: 67891
diff changeset
1940 (defun gdb-delete-frame-or-window ()
e444fe32e1b4 (gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents: 67891
diff changeset
1941 "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
1942 (interactive)
e444fe32e1b4 (gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents: 67891
diff changeset
1943 (if (one-window-p) (delete-frame)
e444fe32e1b4 (gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents: 67891
diff changeset
1944 (delete-window)))
e444fe32e1b4 (gdb-post-prompt): Regenerate breakpoints
Nick Roberts <nickrob@snap.net.nz>
parents: 67891
diff changeset
1945
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1946 (defun gdb-breakpoints-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1947 "Major mode for gdb breakpoints.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1948
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1949 \\{gdb-breakpoints-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1950 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1951 (setq major-mode 'gdb-breakpoints-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1952 (setq mode-name "Breakpoints")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1953 (use-local-map gdb-breakpoints-mode-map)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1954 (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
1955 (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
1956 (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
1957 'gdb-invalidate-breakpoints
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1958 'gdbmi-invalidate-breakpoints))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1959
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1960 (defconst gdb-breakpoint-regexp
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1961 "\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\s-+\\(.\\)\\s-+")
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1962
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1963 (defun gdb-toggle-breakpoint ()
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1964 "Enable/disable breakpoint at current line."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1965 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1966 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1967 (beginning-of-line 1)
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1968 (if (looking-at gdb-breakpoint-regexp)
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1969 (gdb-enqueue-input
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1970 (list
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1971 (concat gdb-server-prefix
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1972 (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
1973 "disable "
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1974 "enable ")
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1975 (match-string 1) "\n") 'ignore))
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1976 (error "Not recognized as break/watchpoint line"))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1977
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1978 (defun gdb-delete-breakpoint ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1979 "Delete the breakpoint at current line."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1980 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
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 "delete " (match-string 1) "\n") 'ignore))
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1986 (error "Not recognized as break/watchpoint line")))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1987
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
1988 (defun gdb-goto-breakpoint (&optional event)
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1989 "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
1990 (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
1991 (if event (posn-set-point (event-end event)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1992 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1993 (beginning-of-line 1)
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
1994 (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
1995 (let ((bptno (match-string 1))
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
1996 (file (match-string 2))
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
1997 (line (match-string 3)))
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1998 (save-selected-window
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
1999 (let* ((buffer (find-file-noselect
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2000 (if (file-exists-p file) file
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
2001 (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
2002 (window (or (gdb-display-source-buffer buffer)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2003 (display-buffer buffer))))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2004 (setq gdb-source-window window)
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2005 (with-current-buffer buffer
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
2006 (goto-line (string-to-number line))
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
2007 (set-window-point window (point))))))
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
2008 (error "No location specified."))))
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
2009
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2010
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2011 ;; Frames buffer. This displays a perpetually correct bactracktrace
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2012 ;; (from the command `where').
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2013 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2014 ;; Alas, if your stack is deep, it is costly.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2015 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2016 (gdb-set-buffer-rules 'gdb-stack-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2017 'gdb-stack-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2018 'gdb-frames-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2019
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2020 (def-gdb-auto-updated-buffer gdb-stack-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2021 gdb-invalidate-frames
69609
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
2022 "server info stack\n"
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
2023 gdb-info-stack-handler
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
2024 gdb-info-stack-custom)
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
2025
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
2026 (defun gdb-info-stack-custom ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2027 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2028 (save-excursion
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2029 (unless (eq gdb-look-up-stack 'delete)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2030 (let ((buffer-read-only nil)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2031 bl el)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2032 (goto-char (point-min))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2033 (while (< (point) (point-max))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2034 (setq bl (line-beginning-position)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2035 el (line-end-position))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2036 (when (looking-at "#")
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2037 (add-text-properties bl el
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2038 '(mouse-face highlight
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2039 help-echo "mouse-2, RET: Select frame")))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2040 (goto-char bl)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2041 (when (looking-at "^#\\([0-9]+\\)")
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2042 (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
2043 (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
2044 (progn
17d65e848c72 (gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents: 72380
diff changeset
2045 (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
2046 (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
2047 (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
2048 (set-marker 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
2049 (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
2050 'face '(:inverse-video t))))
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2051 (when (re-search-forward
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2052 (concat
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2053 (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
2054 "\\([^ ]+\\) (") el t)
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2055 (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
2056 'face font-lock-function-name-face)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2057 (setq bl (match-end 0))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2058 (while (re-search-forward "<\\([^>]+\\)>" el t)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2059 (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
2060 'face font-lock-function-name-face))
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2061 (goto-char bl)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2062 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2063 (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
2064 'face font-lock-variable-name-face))))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2065 (forward-line 1))))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2066 (when gdb-look-up-stack
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2067 (goto-char (point-min))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2068 (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
2069 (let ((start (line-beginning-position))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2070 (file (match-string 1))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2071 (line (match-string 2)))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2072 (re-search-backward "^#*\\([0-9]+\\)" start t)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2073 (gdb-enqueue-input
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2074 (list (concat gdb-server-prefix "frame "
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2075 (match-string 1) "\n") 'gdb-set-hollow))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2076 (gdb-enqueue-input
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2077 (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
2078 (if (eq gdb-look-up-stack 'delete)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2079 (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
2080 (setq gdb-look-up-stack nil))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2081
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2082 (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
2083 (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
2084 (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
2085 (setq fringe-indicator-alist
6564e84a8e09 (gdb-set-hollow): Check for gud-last-last-frame.
Nick Roberts <nickrob@snap.net.nz>
parents: 72200
diff changeset
2086 '((overlay-arrow . hollow-right-triangle))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2087
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2088 (defun gdb-stack-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2089 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2090 (concat "*stack frames of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2091
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2092 (defun gdb-display-stack-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2093 "Display backtrace of current stack."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2094 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2095 (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
2096 (gdb-get-buffer-create 'gdb-stack-buffer) t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2097
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2098 (defun gdb-frame-stack-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2099 "Display backtrace of current stack in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2100 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2101 (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
2102 (special-display-frame-alist gdb-frame-parameters))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2103 (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2104
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2105 (defvar gdb-frames-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2106 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2107 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2108 (define-key map "q" 'kill-this-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2109 (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
2110 (define-key map [mouse-2] 'gdb-frames-select)
60946
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
2111 (define-key map [follow-link] 'mouse-face)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2112 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2113
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2114 (defun gdb-frames-mode ()
69609
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
2115 "Major mode for gdb call stack.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2116
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2117 \\{gdb-frames-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2118 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2119 (setq major-mode 'gdb-frames-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2120 (setq mode-name "Frames")
72392
17d65e848c72 (gdb-info-stack-custom): Indicate selected frame with fringe arrow.
Nick Roberts <nickrob@snap.net.nz>
parents: 72380
diff changeset
2121 (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
2122 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2123 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2124 (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
2125 (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
2126 (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
2127 'gdb-invalidate-frames
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2128 'gdbmi-invalidate-frames))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2129
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2130 (defun gdb-get-frame-number ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2131 (save-excursion
65861
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
2132 (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
2133 (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
2134 (pos (re-search-backward "^#*\\([0-9]+\\)" start t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2135 (n (or (and pos (match-string-no-properties 1)) "0")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2136 n)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2137
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
2138 (defun gdb-frames-select (&optional event)
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2139 "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
2140 (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
2141 (if event (posn-set-point (event-end event)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2142 (gdb-enqueue-input
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
2143 (list (concat gdb-server-prefix "frame "
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2144 (gdb-get-frame-number) "\n") 'ignore)))
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
2145
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2146
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2147 ;; Threads buffer. This displays a selectable thread list.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2148 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2149 (gdb-set-buffer-rules 'gdb-threads-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2150 'gdb-threads-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2151 'gdb-threads-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2152
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2153 (def-gdb-auto-updated-buffer gdb-threads-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2154 gdb-invalidate-threads
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2155 (concat gdb-server-prefix "info threads\n")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2156 gdb-info-threads-handler
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2157 gdb-info-threads-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2158
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2159 (defun gdb-info-threads-custom ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2160 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2161 (let ((buffer-read-only nil))
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2162 (save-excursion
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2163 (goto-char (point-min))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2164 (while (< (point) (point-max))
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2165 (unless (looking-at "No ")
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2166 (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
2167 '(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
2168 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
2169 (forward-line 1))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2170
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2171 (defun gdb-threads-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2172 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2173 (concat "*threads of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2174
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2175 (defun gdb-display-threads-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2176 "Display IDs of currently known threads."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2177 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2178 (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
2179 (gdb-get-buffer-create 'gdb-threads-buffer) t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2180
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2181 (defun gdb-frame-threads-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2182 "Display IDs of currently known threads in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2183 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2184 (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
2185 (special-display-frame-alist gdb-frame-parameters))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2186 (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2187
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2188 (defvar gdb-threads-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2189 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2190 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2191 (define-key map "q" 'kill-this-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2192 (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
2193 (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
2194 (define-key map [follow-link] 'mouse-face)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2195 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2196
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2197 (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
2198 '((") +\\([^ ]+\\) (" (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
2199 ("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
2200 ("\\(\\(\\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
2201 "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
2202
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2203 (defun gdb-threads-mode ()
69609
eba3995e301f (hollow-right-triangle): Define as fringe bitmap.
Nick Roberts <nickrob@snap.net.nz>
parents: 69585
diff changeset
2204 "Major mode for gdb threads.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2205
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2206 \\{gdb-threads-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2207 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2208 (setq major-mode 'gdb-threads-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2209 (setq mode-name "Threads")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2210 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2211 (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
2212 (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
2213 '(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
2214 (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
2215 'gdb-invalidate-threads)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2216
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2217 (defun gdb-get-thread-number ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2218 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2219 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2220 (match-string-no-properties 1)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2221
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
2222 (defun gdb-threads-select (&optional event)
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2223 "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
2224 (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
2225 (if event (posn-set-point (event-end event)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2226 (gdb-enqueue-input
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2227 (list (concat gdb-server-prefix "thread "
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2228 (gdb-get-thread-number) "\n") 'ignore))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2229 (gud-display-frame))
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
2230
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2231
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2232 ;; Registers buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2233 ;;
62826
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2234 (defcustom gdb-all-registers nil
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2235 "Non-nil means include floating-point registers."
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2236 :type 'boolean
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2237 :group 'gud
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2238 :version "22.1")
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2239
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2240 (gdb-set-buffer-rules 'gdb-registers-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2241 'gdb-registers-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2242 'gdb-registers-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2243
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2244 (def-gdb-auto-updated-buffer gdb-registers-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2245 gdb-invalidate-registers
62826
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2246 (concat
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2247 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2248 gdb-info-registers-handler
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2249 gdb-info-registers-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2250
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
2251 (defun gdb-info-registers-custom ()
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
2252 (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
2253 (save-excursion
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
2254 (let ((buffer-read-only nil)
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2255 start end)
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
2256 (goto-char (point-min))
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
2257 (while (< (point) (point-max))
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2258 (setq start (line-beginning-position))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2259 (setq end (line-end-position))
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
2260 (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
2261 (unless (string-equal (match-string 0) "The")
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2262 (put-text-property start (match-end 0)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2263 '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
2264 (add-text-properties start end
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2265 '(help-echo "mouse-2: edit value"
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2266 mouse-face highlight))))
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
2267 (forward-line 1))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2268
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2269 (defun gdb-edit-register-value (&optional event)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2270 (interactive (list last-input-event))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2271 (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
2272 (if event (posn-set-point (event-end event)))
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2273 (beginning-of-line)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2274 (let* ((register (current-word))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2275 (value (read-string (format "New value (%s): " register))))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2276 (gdb-enqueue-input
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2277 (list (concat gdb-server-prefix "set $" register "=" value "\n")
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2278 'ignore)))))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2279
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2280 (defvar gdb-registers-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2281 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2282 (suppress-keymap map)
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2283 (define-key map "\r" 'gdb-edit-register-value)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2284 (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
2285 (define-key map " " 'gdb-all-registers)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2286 (define-key map "q" 'kill-this-buffer)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2287 map))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2288
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2289 (defun gdb-registers-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2290 "Major mode for gdb registers.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2291
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2292 \\{gdb-registers-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2293 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2294 (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
2295 (setq mode-name "Registers")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2296 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2297 (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
2298 (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
2299 (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
2300 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2301 (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
2302 'gdb-invalidate-registers)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2303 'gdb-invalidate-registers-1))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2304
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2305 (defun gdb-registers-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2306 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2307 (concat "*registers of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2308
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2309 (defun gdb-display-registers-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2310 "Display integer register contents."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2311 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2312 (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
2313 (gdb-get-buffer-create 'gdb-registers-buffer) t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2314
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2315 (defun gdb-frame-registers-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2316 "Display integer register contents in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2317 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2318 (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
2319 (special-display-frame-alist gdb-frame-parameters))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2320 (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer))))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2321
67309
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
2322 (defun gdb-all-registers ()
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2323 "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
2324 (interactive)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2325 (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
2326 (if gdb-all-registers
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2327 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2328 (setq gdb-all-registers nil)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2329 (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
2330 (setq mode-name "Registers")))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2331 (setq gdb-all-registers t)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2332 (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
2333 (setq mode-name "Registers:All")))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2334 (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
2335 (if gdb-all-registers "en" "dis")))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2336 (gdb-invalidate-registers)))
62826
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2337
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2338
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2339 ;; Memory buffer.
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2340 ;;
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2341 (defcustom gdb-memory-repeat-count 32
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2342 "Number of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2343 :type 'integer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2344 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2345 :version "22.1")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2346
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2347 (defcustom gdb-memory-format "x"
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2348 "Display format of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2349 :type '(choice (const :tag "Hexadecimal" "x")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2350 (const :tag "Signed decimal" "d")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2351 (const :tag "Unsigned decimal" "u")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2352 (const :tag "Octal" "o")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2353 (const :tag "Binary" "t"))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2354 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2355 :version "22.1")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2356
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2357 (defcustom gdb-memory-unit "w"
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2358 "Unit size of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2359 :type '(choice (const :tag "Byte" "b")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2360 (const :tag "Halfword" "h")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2361 (const :tag "Word" "w")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2362 (const :tag "Giant word" "g"))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2363 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2364 :version "22.1")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2365
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2366 (gdb-set-buffer-rules 'gdb-memory-buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2367 'gdb-memory-buffer-name
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2368 'gdb-memory-mode)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2369
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2370 (def-gdb-auto-updated-buffer gdb-memory-buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2371 gdb-invalidate-memory
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2372 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2373 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2374 gdb-read-memory-handler
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2375 gdb-read-memory-custom)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2376
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2377 (defun gdb-read-memory-custom ()
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2378 (save-excursion
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2379 (goto-char (point-min))
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2380 (if (looking-at "0x[[:xdigit:]]+")
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2381 (setq gdb-memory-address (match-string 0)))))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2382
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2383 (defvar gdb-memory-mode-map
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2384 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2385 (suppress-keymap map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2386 (define-key map "q" 'kill-this-buffer)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2387 map))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2388
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2389 (defun gdb-memory-set-address (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2390 "Set the start memory address."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2391 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2392 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2393 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2394 (let ((arg (read-from-minibuffer "Memory address: ")))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2395 (setq gdb-memory-address arg))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2396 (gdb-invalidate-memory)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2397
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2398 (defun gdb-memory-set-repeat-count (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2399 "Set the number of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2400 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2401 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2402 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2403 (let* ((arg (read-from-minibuffer "Repeat count: "))
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2404 (count (string-to-number arg)))
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2405 (if (<= count 0)
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2406 (error "Positive numbers only")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2407 (customize-set-variable 'gdb-memory-repeat-count count)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2408 (gdb-invalidate-memory)))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2409
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2410 (defun gdb-memory-format-binary ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2411 "Set the display format to binary."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2412 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2413 (customize-set-variable 'gdb-memory-format "t")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2414 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2415
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2416 (defun gdb-memory-format-octal ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2417 "Set the display format to octal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2418 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2419 (customize-set-variable 'gdb-memory-format "o")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2420 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2421
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2422 (defun gdb-memory-format-unsigned ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2423 "Set the display format to unsigned decimal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2424 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2425 (customize-set-variable 'gdb-memory-format "u")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2426 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2427
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2428 (defun gdb-memory-format-signed ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2429 "Set the display format to decimal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2430 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2431 (customize-set-variable 'gdb-memory-format "d")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2432 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2433
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2434 (defun gdb-memory-format-hexadecimal ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2435 "Set the display format to hexadecimal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2436 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2437 (customize-set-variable 'gdb-memory-format "x")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2438 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2439
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2440 (defvar gdb-memory-format-map
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2441 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2442 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2443 map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2444 "Keymap to select format in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2445
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2446 (defvar gdb-memory-format-menu (make-sparse-keymap "Format")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2447 "Menu of display formats in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2448
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2449 (define-key gdb-memory-format-menu [binary]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2450 '(menu-item "Binary" gdb-memory-format-binary
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2451 :button (:radio . (equal gdb-memory-format "t"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2452 (define-key gdb-memory-format-menu [octal]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2453 '(menu-item "Octal" gdb-memory-format-octal
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2454 :button (:radio . (equal gdb-memory-format "o"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2455 (define-key gdb-memory-format-menu [unsigned]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2456 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2457 :button (:radio . (equal gdb-memory-format "u"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2458 (define-key gdb-memory-format-menu [signed]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2459 '(menu-item "Signed Decimal" gdb-memory-format-signed
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2460 :button (:radio . (equal gdb-memory-format "d"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2461 (define-key gdb-memory-format-menu [hexadecimal]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2462 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2463 :button (:radio . (equal gdb-memory-format "x"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2464
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2465 (defun gdb-memory-format-menu (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2466 (interactive "@e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2467 (x-popup-menu event gdb-memory-format-menu))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2468
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2469 (defun gdb-memory-format-menu-1 (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2470 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2471 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2472 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2473 (let* ((selection (gdb-memory-format-menu event))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2474 (binding (and selection (lookup-key gdb-memory-format-menu
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2475 (vector (car selection))))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2476 (if binding (call-interactively binding)))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2477
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2478 (defun gdb-memory-unit-giant ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2479 "Set the unit size to giant words (eight bytes)."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2480 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2481 (customize-set-variable 'gdb-memory-unit "g")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2482 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2483
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2484 (defun gdb-memory-unit-word ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2485 "Set the unit size to words (four bytes)."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2486 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2487 (customize-set-variable 'gdb-memory-unit "w")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2488 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2489
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2490 (defun gdb-memory-unit-halfword ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2491 "Set the unit size to halfwords (two bytes)."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2492 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2493 (customize-set-variable 'gdb-memory-unit "h")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2494 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2495
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2496 (defun gdb-memory-unit-byte ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2497 "Set the unit size to bytes."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2498 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2499 (customize-set-variable 'gdb-memory-unit "b")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2500 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2501
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2502 (defvar gdb-memory-unit-map
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2503 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2504 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2505 map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2506 "Keymap to select units in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2507
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2508 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2509 "Menu of units in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2510
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2511 (define-key gdb-memory-unit-menu [giantwords]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2512 '(menu-item "Giant words" gdb-memory-unit-giant
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2513 :button (:radio . (equal gdb-memory-unit "g"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2514 (define-key gdb-memory-unit-menu [words]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2515 '(menu-item "Words" gdb-memory-unit-word
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2516 :button (:radio . (equal gdb-memory-unit "w"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2517 (define-key gdb-memory-unit-menu [halfwords]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2518 '(menu-item "Halfwords" gdb-memory-unit-halfword
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2519 :button (:radio . (equal gdb-memory-unit "h"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2520 (define-key gdb-memory-unit-menu [bytes]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2521 '(menu-item "Bytes" gdb-memory-unit-byte
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2522 :button (:radio . (equal gdb-memory-unit "b"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2523
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2524 (defun gdb-memory-unit-menu (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2525 (interactive "@e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2526 (x-popup-menu event gdb-memory-unit-menu))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2527
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2528 (defun gdb-memory-unit-menu-1 (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2529 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2530 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2531 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2532 (let* ((selection (gdb-memory-unit-menu event))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2533 (binding (and selection (lookup-key gdb-memory-unit-menu
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2534 (vector (car selection))))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2535 (if binding (call-interactively binding)))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2536
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2537 ;;from make-mode-line-mouse-map
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2538 (defun gdb-make-header-line-mouse-map (mouse function) "\
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2539 Return a keymap with single entry for mouse key MOUSE on the header line.
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2540 MOUSE is defined to run function FUNCTION with no args in the buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2541 corresponding to the mode line clicked."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2542 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2543 (define-key map (vector 'header-line mouse) function)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2544 (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2545 map))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2546
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2547 (defvar gdb-memory-font-lock-keywords
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2548 '(;; <__function.name+n>
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2549 ("<\\(\\(\\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
2550 )
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2551 "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
2552
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2553 (defun gdb-memory-mode ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2554 "Major mode for examining memory.
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2555
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2556 \\{gdb-memory-mode-map}"
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2557 (kill-all-local-variables)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2558 (setq major-mode 'gdb-memory-mode)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2559 (setq mode-name "Memory")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2560 (setq buffer-read-only t)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2561 (use-local-map gdb-memory-mode-map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2562 (setq header-line-format
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2563 '(:eval
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2564 (concat
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2565 "Read address["
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2566 (propertize
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2567 "-"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2568 'face font-lock-warning-face
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2569 'help-echo "mouse-1: Decrement address"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2570 'mouse-face 'mode-line-highlight
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2571 'local-map
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2572 (gdb-make-header-line-mouse-map
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2573 'mouse-1
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2574 (lambda () (interactive)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2575 (let ((gdb-memory-address
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2576 ;; Let GDB do the arithmetic.
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2577 (concat
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2578 gdb-memory-address " - "
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2579 (number-to-string
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2580 (* gdb-memory-repeat-count
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2581 (cond ((string= gdb-memory-unit "b") 1)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2582 ((string= gdb-memory-unit "h") 2)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2583 ((string= gdb-memory-unit "w") 4)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2584 ((string= gdb-memory-unit "g") 8)))))))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2585 (gdb-invalidate-memory)))))
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2586 "|"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2587 (propertize "+"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2588 'face font-lock-warning-face
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2589 'help-echo "mouse-1: Increment address"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2590 'mouse-face 'mode-line-highlight
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2591 'local-map (gdb-make-header-line-mouse-map
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2592 'mouse-1
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2593 (lambda () (interactive)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2594 (let ((gdb-memory-address nil))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2595 (gdb-invalidate-memory)))))
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2596 "]: "
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2597 (propertize gdb-memory-address
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2598 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2599 'help-echo "mouse-1: Set memory address"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2600 'mouse-face 'mode-line-highlight
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2601 'local-map (gdb-make-header-line-mouse-map
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2602 'mouse-1
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2603 #'gdb-memory-set-address))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2604 " Repeat Count: "
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2605 (propertize (number-to-string gdb-memory-repeat-count)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2606 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2607 'help-echo "mouse-1: Set repeat count"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2608 'mouse-face 'mode-line-highlight
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2609 'local-map (gdb-make-header-line-mouse-map
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2610 'mouse-1
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2611 #'gdb-memory-set-repeat-count))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2612 " Display Format: "
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2613 (propertize gdb-memory-format
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2614 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2615 'help-echo "mouse-3: Select display format"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2616 'mouse-face 'mode-line-highlight
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2617 'local-map gdb-memory-format-map)
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2618 " Unit Size: "
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2619 (propertize gdb-memory-unit
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2620 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2621 'help-echo "mouse-3: Select unit size"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2622 'mouse-face 'mode-line-highlight
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2623 '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
2624 (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
2625 '(gdb-memory-font-lock-keywords))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2626 (run-mode-hooks 'gdb-memory-mode-hook)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2627 'gdb-invalidate-memory)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2628
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2629 (defun gdb-memory-buffer-name ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2630 (with-current-buffer gud-comint-buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2631 (concat "*memory of " (gdb-get-target-string) "*")))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2632
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2633 (defun gdb-display-memory-buffer ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2634 "Display memory contents."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2635 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2636 (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
2637 (gdb-get-buffer-create 'gdb-memory-buffer) t))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2638
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2639 (defun gdb-frame-memory-buffer ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2640 "Display memory contents in a new frame."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2641 (interactive)
72481
d7b676d23dd8 (gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents: 72435
diff changeset
2642 (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
2643 (special-display-frame-alist
d7b676d23dd8 (gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents: 72435
diff changeset
2644 (cons '(left-fringe . 0)
d7b676d23dd8 (gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents: 72435
diff changeset
2645 (cons '(right-fringe . 0)
d7b676d23dd8 (gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents: 72435
diff changeset
2646 (cons '(width . 83) gdb-frame-parameters)))))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2647 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2648
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2649
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2650 ;; Locals buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2651 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2652 (gdb-set-buffer-rules 'gdb-locals-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2653 'gdb-locals-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2654 'gdb-locals-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2655
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2656 (def-gdb-auto-update-trigger gdb-invalidate-locals
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2657 (gdb-get-buffer 'gdb-locals-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2658 "server info locals\n"
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2659 gdb-info-locals-handler)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2660
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2661 (defvar gdb-locals-watch-map
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2662 (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
2663 (suppress-keymap map)
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2664 (define-key map "\r" (lambda () (interactive)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2665 (beginning-of-line)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2666 (gud-watch)))
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2667 (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
2668 (mouse-set-point event)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2669 (beginning-of-line)
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2670 (gud-watch)))
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2671 map)
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2672 "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
2673
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2674 (defconst gdb-struct-string
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2675 (concat (propertize "[struct/union]"
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2676 'mouse-face 'highlight
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2677 '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
2678 '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
2679
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2680 (defconst gdb-array-string
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2681 (concat " " (propertize "[array]"
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2682 'mouse-face 'highlight
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2683 '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
2684 '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
2685
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2686 ;; Abbreviate for arrays and structures.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2687 ;; 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
2688 (defun gdb-info-locals-handler ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2689 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2690 gdb-pending-triggers))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2691 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2692 (with-current-buffer buf
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2693 (goto-char (point-min))
62614
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
2694 (while (re-search-forward "^[ }].*\n" nil t)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2695 (replace-match "" nil nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2696 (goto-char (point-min))
62614
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
2697 (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
2698 (replace-match gdb-struct-string nil nil))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2699 (goto-char (point-min))
62614
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
2700 (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
2701 (replace-match gdb-array-string nil nil))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2702 (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2703 (and buf
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2704 (with-current-buffer buf
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2705 (let* ((window (get-buffer-window buf 0))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2706 (start (window-start window))
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2707 (p (window-point window))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2708 (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
2709 (erase-buffer)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2710 (insert-buffer-substring (gdb-get-buffer-create
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2711 'gdb-partial-output-buffer))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2712 (set-window-start window start)
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2713 (set-window-point window p))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2714 )))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2715 (run-hooks 'gdb-info-locals-hook))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2716
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2717 (defvar gdb-locals-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2718 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2719 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2720 (define-key map "q" 'kill-this-buffer)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2721 map))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2722
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2723 (defun gdb-locals-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2724 "Major mode for gdb locals.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2725
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2726 \\{gdb-locals-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2727 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2728 (setq major-mode 'gdb-locals-mode)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2729 (setq mode-name (concat "Locals:" gdb-selected-frame))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2730 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2731 (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
2732 (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
2733 '(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
2734 (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
2735 (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
2736 (string-equal gdb-version "pre-6.4"))
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
2737 'gdb-invalidate-locals
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
2738 'gdb-invalidate-locals-1))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2739
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2740 (defun gdb-locals-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2741 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2742 (concat "*locals of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2743
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2744 (defun gdb-display-locals-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2745 "Display local variables of current stack and their values."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2746 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2747 (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
2748 (gdb-get-buffer-create 'gdb-locals-buffer) t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2749
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2750 (defun gdb-frame-locals-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2751 "Display local variables of current stack and their values in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2752 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2753 (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
2754 (special-display-frame-alist gdb-frame-parameters))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2755 (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2756
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2757
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2758 ;;;; 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
2759 (defun gdb-display-buffer (buf dedicated &optional size)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2760 (let ((answer (get-buffer-window buf 0))
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2761 (must-split nil))
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2762 (if answer
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2763 (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
2764 ;; The buffer is not yet displayed.
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2765 (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
2766 (let ((window (get-lru-window)))
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2767 (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
2768 (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
2769 ,gdb-source-window))))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2770 (progn
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2771 (set-window-buffer window buf)
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2772 (setq answer window))
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2773 (setq must-split t)))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2774 (if must-split
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2775 (let* ((largest (get-largest-window))
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2776 (cur-size (window-height largest))
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2777 (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
2778 (setq answer (split-window largest new-size))
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2779 (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
2780 (set-window-dedicated-p answer dedicated)))
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2781 answer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2782
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2783
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2784 ;;; Shared keymap initialization:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2785
59922
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2786 (let ((menu (make-sparse-keymap "GDB-Windows")))
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2787 (define-key gud-menu-map [displays]
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2788 `(menu-item "GDB-Windows" ,menu
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2789 :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
2790 (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
2791 (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
2792 (define-key menu [inferior]
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2793 '(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
2794 :enable gdb-use-separate-io-buffer))
68938
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2795 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2796 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2797 (define-key menu [disassembly]
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2798 '("Disassembly" . gdb-display-assembler-buffer))
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2799 (define-key menu [breakpoints]
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2800 '("Breakpoints" . gdb-display-breakpoints-buffer))
59922
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2801 (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
2802 (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
2803
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2804 (let ((menu (make-sparse-keymap "GDB-Frames")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2805 (define-key gud-menu-map [frames]
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2806 `(menu-item "GDB-Frames" ,menu
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2807 :visible (memq gud-minor-mode '(gdbmi gdba))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2808 (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
2809 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2810 (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
2811 (define-key menu [inferior]
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2812 '(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
2813 :enable gdb-use-separate-io-buffer))
68938
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2814 (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
2815 (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
2816 (define-key menu [breakpoints]
32eebeb631d6 (gdba): Improve doc string.
Nick Roberts <nickrob@snap.net.nz>
parents: 68903
diff changeset
2817 '("Breakpoints" . gdb-frame-breakpoints-buffer))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2818 (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
2819 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2820
66886
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
2821 (let ((menu (make-sparse-keymap "GDB-UI/MI")))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2822 (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
2823 `(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
2824 ,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
2825 (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
2826 '(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
2827 :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
2828 :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
2829 :button (:toggle . gdb-find-source-frame)))
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
2830 (define-key menu [gdb-use-separate-io]
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2831 '(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
2832 :visible (eq gud-minor-mode 'gdba)
72380
37cc9e9df5a4 (gdb-frame-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 72235
diff changeset
2833 :help "Toggle separate IO for debugged program."
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
2834 :button (:toggle . gdb-use-separate-io-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2835 (define-key menu [gdb-many-windows]
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2836 '(menu-item "Display Other Windows" gdb-many-windows
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2837 :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
2838 :button (:toggle . gdb-many-windows)))
63443
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
2839 (define-key menu [gdb-restore-windows]
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
2840 '(menu-item "Restore Window Layout" gdb-restore-windows
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
2841 :help "Restore standard layout for debug session.")))
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2842
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2843 (defun gdb-frame-gdb-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2844 "Display GUD buffer in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2845 (interactive)
66676
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2846 (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
2847 (special-display-frame-alist
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
2848 (remove '(menu-bar-lines) (remove '(tool-bar-lines)
10a6583c5ff7 (gdb-same-frame): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 71277
diff changeset
2849 gdb-frame-parameters)))
66681
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2850 (same-window-regexps nil))
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2851 (display-buffer gud-comint-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2852
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2853 (defun gdb-display-gdb-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2854 "Display GUD buffer."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2855 (interactive)
66681
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2856 (let ((same-window-regexps nil))
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2857 (pop-to-buffer gud-comint-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2858
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2859 (defun gdb-set-window-buffer (name)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2860 (set-window-buffer (selected-window) (get-buffer name))
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2861 (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
2862
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2863 (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
2864 "Layout the window pattern for `gdb-many-windows'."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2865 (gdb-display-locals-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2866 (gdb-display-stack-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2867 (delete-other-windows)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2868 (gdb-display-breakpoints-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2869 (delete-other-windows)
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2870 ; Don't dedicate.
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2871 (pop-to-buffer gud-comint-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2872 (split-window nil ( / ( * (window-height) 3) 4))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2873 (split-window nil ( / (window-height) 3))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2874 (split-window-horizontally)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2875 (other-window 1)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2876 (gdb-set-window-buffer (gdb-locals-buffer-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2877 (other-window 1)
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2878 (switch-to-buffer
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2879 (if gud-last-last-frame
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2880 (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
2881 (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
2882 (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
2883 ;; 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
2884 ;; 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
2885 (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
2886 (setq gdb-source-window (selected-window))
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
2887 (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
2888 (split-window-horizontally)
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
2889 (other-window 1)
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2890 (gdb-set-window-buffer
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2891 (gdb-get-buffer-create 'gdb-inferior-io)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2892 (other-window 1)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2893 (gdb-set-window-buffer (gdb-stack-buffer-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2894 (split-window-horizontally)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2895 (other-window 1)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2896 (gdb-set-window-buffer (gdb-breakpoints-buffer-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2897 (other-window 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2898
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2899 (defun gdb-restore-windows ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2900 "Restore the basic arrangement of windows used by gdba.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2901 This arrangement depends on the value of `gdb-many-windows'."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2902 (interactive)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2903 (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
2904 (delete-other-windows)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2905 (if gdb-many-windows
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2906 (gdb-setup-windows)
66676
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2907 (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
2908 (split-window)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2909 (other-window 1)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2910 (switch-to-buffer
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2911 (if gud-last-last-frame
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2912 (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
2913 (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
2914 (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
2915 (other-window 1))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2916
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2917 (defun gdb-reset ()
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2918 "Exit a debugging session cleanly.
69214
092d8fdb26e2 (gdb-speedbar-refresh): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 69180
diff changeset
2919 Kills the gdb buffers, and resets variables and the source buffers."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2920 (dolist (buffer (buffer-list))
55696
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2921 (unless (eq buffer gud-comint-buffer)
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2922 (with-current-buffer buffer
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2923 (if (memq gud-minor-mode '(gdbmi gdba))
55696
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2924 (if (string-match "\\`\\*.+\\*\\'" (buffer-name))
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2925 (kill-buffer nil)
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2926 (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
2927 (setq gud-minor-mode nil)
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2928 (kill-local-variable 'tool-bar-map)
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2929 (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
2930 (setq gdb-overlay-arrow-position nil)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2931 (setq overlay-arrow-variable-list
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2932 (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
2933 (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
2934 (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
2935 (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
2936 (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
2937 (if (boundp 'speedbar-frame) (speedbar-timer-fn))
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2938 (setq gud-running nil)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2939 (setq gdb-active-process nil)
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2940 (setq gdb-var-list nil)
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2941 (remove-hook 'after-save-hook 'gdb-create-define-alist t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2942
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2943 (defun gdb-source-info ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2944 "Find the source file where the program starts and displays it with related
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2945 buffers."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2946 (goto-char (point-min))
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2947 (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
2948 (looking-at "\\S-+"))
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2949 (setq gdb-main-file (match-string 0)))
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2950 (goto-char (point-min))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2951 (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
2952 (setq gdb-macro-info t))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2953 (if gdb-many-windows
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2954 (gdb-setup-windows)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
2955 (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
2956 (if gdb-show-main
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2957 (let ((pop-up-windows t))
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2958 (display-buffer (gud-find-file gdb-main-file))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2959
59988
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2960 (defun gdb-get-location (bptno line flag)
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2961 "Find the directory containing the relevant source file.
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2962 Put in buffer and place breakpoint icon."
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2963 (goto-char (point-min))
60326
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2964 (catch 'file-not-found
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2965 (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
2966 (when (looking-at "\\S-+")
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2967 (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
2968 (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
2969 (gdb-resync)
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2970 (unless (assoc bptno gdb-location-alist)
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2971 (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
2972 (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
2973 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
2974 (throw 'file-not-found nil))
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2975 (with-current-buffer
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2976 (find-file-noselect (match-string 0))
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2977 (save-current-buffer
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2978 (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
2979 (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
2980 ;; 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
2981 (save-excursion
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2982 (goto-line (string-to-number line))
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2983 (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
2984
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2985 (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
2986
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2987 (defun gdb-find-file-hook ()
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2988 "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
2989 of the current session."
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2990 (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
2991 ;; 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
2992 gud-comint-buffer
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
2993 (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
2994 '(gdba gdbmi)))
71113
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2995 ;;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
2996 (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
2997 (file-name-nondirectory buffer-file-name)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2998 buffer-file-name)
446eebbf5f35 (gdb-look-up-stack): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 71090
diff changeset
2999 gdb-source-file-list)
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
3000 (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
3001 (set (make-local-variable 'gud-minor-mode)
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3002 (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
3003 (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
3004
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3005 ;;from put-image
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3006 (defun gdb-put-string (putstring pos &optional dprop &rest sprops)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3007 "Put string PUTSTRING in front of POS in the current buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3008 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
3009 `before-string' string that has a `display' property whose value is
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3010 PUTSTRING."
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3011 (let ((string (make-string 1 ?x))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3012 (buffer (current-buffer)))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3013 (setq putstring (copy-sequence putstring))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3014 (let ((overlay (make-overlay pos pos buffer))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3015 (prop (or dprop
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3016 (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
3017 (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
3018 (if sprops
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3019 (add-text-properties 0 1 sprops string))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3020 (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
3021 (overlay-put overlay 'before-string string))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3022
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3023 ;;from remove-images
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3024 (defun gdb-remove-strings (start end &optional buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3025 "Remove strings between START and END in BUFFER.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3026 Remove only strings that were put in BUFFER with calls to `gdb-put-string'.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3027 BUFFER nil or omitted means use the current buffer."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3028 (unless buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3029 (setq buffer (current-buffer)))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3030 (dolist (overlay (overlays-in start end))
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
3031 (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
3032 (delete-overlay overlay))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3033
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3034 (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
3035 (let ((start (- (line-beginning-position) 1))
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
3036 (end (+ (line-end-position) 1))
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
3037 (putstring (if enabled "B" "b"))
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
3038 (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
3039 (add-text-properties
66417
bec18a123c03 (gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents: 66412
diff changeset
3040 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
3041 putstring)
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3042 (if enabled
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3043 (add-text-properties
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3044 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
3045 (add-text-properties
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3046 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3047 (gdb-remove-breakpoint-icons start end)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3048 (if (display-images-p)
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
3049 (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
3050 (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
3051 gdb-buffer-fringe-width) 8)
54668
69a699e79a0d (gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents: 54617
diff changeset
3052 (gdb-put-string
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3053 nil (1+ start)
57262
df4b0ff293d8 (breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents: 56330
diff changeset
3054 `(left-fringe breakpoint
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3055 ,(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
3056 'breakpoint-enabled
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3057 'breakpoint-disabled))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3058 'gdb-bptno bptno
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
3059 'gdb-enabled enabled)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3060 (when (< left-margin-width 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3061 (save-current-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3062 (setq left-margin-width 2)
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
3063 (if source-window
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
3064 (set-window-margins
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
3065 source-window
55328
4440fe0e7dc6 (gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 55217
diff changeset
3066 left-margin-width right-margin-width))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3067 (put-image
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3068 (if enabled
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3069 (or breakpoint-enabled-icon
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3070 (setq breakpoint-enabled-icon
54668
69a699e79a0d (gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents: 54617
diff changeset
3071 (find-image `((:type xpm :data
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3072 ,breakpoint-xpm-data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3073 :ascent 100 :pointer hand)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3074 (:type pbm :data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3075 ,breakpoint-enabled-pbm-data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3076 :ascent 100 :pointer hand)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3077 (or breakpoint-disabled-icon
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3078 (setq breakpoint-disabled-icon
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3079 (find-image `((:type xpm :data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3080 ,breakpoint-xpm-data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3081 :conversion disabled
66417
bec18a123c03 (gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents: 66412
diff changeset
3082 :ascent 100 :pointer hand)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3083 (:type pbm :data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3084 ,breakpoint-disabled-pbm-data
66417
bec18a123c03 (gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents: 66412
diff changeset
3085 :ascent 100 :pointer hand))))))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3086 (+ start 1)
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3087 putstring
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
3088 'left-margin))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3089 (when (< left-margin-width 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3090 (save-current-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3091 (setq left-margin-width 2)
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
3092 (let ((window (get-buffer-window (current-buffer) 0)))
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
3093 (if window
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
3094 (set-window-margins
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
3095 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
3096 (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
3097 (propertize putstring
a706fe4203bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents: 60541
diff changeset
3098 '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
3099 (1+ start)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3100
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3101 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3102 (gdb-remove-strings start end)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3103 (if (display-images-p)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3104 (remove-images start end))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3105 (when remove-margin
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3106 (setq left-margin-width 0)
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
3107 (let ((window (get-buffer-window (current-buffer) 0)))
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
3108 (if window
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
3109 (set-window-margins
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
3110 window left-margin-width right-margin-width)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3111
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3112
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3113 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3114 ;; Assembler buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3115 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3116 (gdb-set-buffer-rules 'gdb-assembler-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3117 'gdb-assembler-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3118 'gdb-assembler-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3119
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3120 ;; 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
3121 ;; 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
3122 (defun gdb-assembler-handler ()
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3123 (setq gdb-pending-triggers
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3124 (delq 'gdb-invalidate-assembler
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3125 gdb-pending-triggers))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3126 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer)))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3127 (and buf
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3128 (with-current-buffer buf
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3129 (let* ((window (get-buffer-window buf 0))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3130 (p (window-point window))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3131 (buffer-read-only nil))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3132 (erase-buffer)
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3133 (insert-buffer-substring (gdb-get-buffer-create
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3134 'gdb-partial-output-buffer))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3135 (set-window-point window p)))))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3136 ;; put customisation here
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3137 (gdb-assembler-custom))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3138
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3139 (defun gdb-assembler-custom ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3140 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
59766
8d2464efeb2e (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 59763
diff changeset
3141 (pos 1) (address) (flag) (bptno))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3142 (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
3143 (save-excursion
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
3144 (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
3145 (progn
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
3146 (goto-char (point-min))
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
3147 (if (and gdb-pc-address
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
3148 (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
3149 (progn
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
3150 (setq pos (point))
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
3151 (beginning-of-line)
69650
de8b61c18c11 (gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents: 69618
diff changeset
3152 (setq fringe-indicator-alist
de8b61c18c11 (gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents: 69618
diff changeset
3153 (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
3154 nil
de8b61c18c11 (gdb-continuation): Declare earlier to prevent compiler warnings.
Nick Roberts <nickrob@snap.net.nz>
parents: 69618
diff changeset
3155 '((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
3156 (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
3157 (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
3158 (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
3159 ;; 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
3160 (gdb-remove-breakpoint-icons (point-min) (point-max))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3161 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3162 (goto-char (point-min))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3163 (while (< (point) (- (point-max) 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3164 (forward-line 1)
62936
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
3165 (if (looking-at "[^\t].*?breakpoint")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3166 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3167 (looking-at
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3168 "\\([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
3169 (setq bptno (match-string 1))
8d2464efeb2e (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 59763
diff changeset
3170 (setq flag (char-after (match-beginning 2)))
8d2464efeb2e (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 59763
diff changeset
3171 (setq address (match-string 3))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3172 (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
3173 (save-excursion
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3174 (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
3175 (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
3176 (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
3177 (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
3178 (with-current-buffer buffer
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
3179 (set-window-point (get-buffer-window buffer 0) pos)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3180
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3181 (defvar gdb-assembler-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3182 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3183 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
3184 (define-key map "q" 'kill-this-buffer)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
3185 map))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3186
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
3187 (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
3188 '(;; <__function.name+n>
4d6eec4c1ef8 * progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents: 57661
diff changeset
3189 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
4d6eec4c1ef8 * progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents: 57661
diff changeset
3190 (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
3191 ;; 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
3192 ("^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
3193 (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
3194 ;; %register(at least i386)
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
3195 ("%\\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
3196 ("^\\(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
3197 (1 font-lock-comment-face)
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
3198 (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
3199 ("^\\(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
3200 "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
3201
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3202 (defun gdb-assembler-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3203 "Major mode for viewing code assembler.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3204
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3205 \\{gdb-assembler-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
3206 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3207 (setq major-mode 'gdb-assembler-mode)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3208 (setq mode-name (concat "Machine:" gdb-selected-frame))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3209 (setq gdb-overlay-arrow-position nil)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3210 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3211 (setq fringes-outside-margins t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3212 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3213 (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
3214 (gdb-invalidate-assembler)
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
3215 (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
3216 '(gdb-assembler-font-lock-keywords))
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
3217 (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
3218 'gdb-invalidate-assembler)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3219
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3220 (defun gdb-assembler-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3221 (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
3222 (concat "*disassembly of " (gdb-get-target-string) "*")))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3223
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3224 (defun gdb-display-assembler-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
3225 "Display disassembly view."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3226 (interactive)
62884
ab597e7c8a07 (gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents: 62867
diff changeset
3227 (setq gdb-previous-frame nil)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3228 (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
3229 (gdb-get-buffer-create 'gdb-assembler-buffer) t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3230
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3231 (defun gdb-frame-assembler-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
3232 "Display disassembly view in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3233 (interactive)
62884
ab597e7c8a07 (gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents: 62867
diff changeset
3234 (setq gdb-previous-frame nil)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
3235 (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
3236 (special-display-frame-alist gdb-frame-parameters))
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
3237 (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3238
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
3239 ;; modified because if gdb-pc-address has changed value a new command
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3240 ;; must be enqueued to update the buffer with the new output
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3241 (defun gdb-invalidate-assembler (&optional ignored)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3242 (if (gdb-get-buffer 'gdb-assembler-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3243 (progn
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3244 (unless (and gdb-selected-frame
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3245 (string-equal gdb-selected-frame gdb-previous-frame))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3246 (if (or (not (member 'gdb-invalidate-assembler
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
3247 gdb-pending-triggers))
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
3248 (not (string-equal gdb-pc-address
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3249 gdb-previous-frame-address)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3250 (progn
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3251 ;; take previous disassemble command, if any, off the queue
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3252 (with-current-buffer gud-comint-buffer
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
3253 (let ((queue gdb-input-queue))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3254 (dolist (item queue)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3255 (if (equal (cdr item) '(gdb-assembler-handler))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
3256 (setq gdb-input-queue
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
3257 (delete item gdb-input-queue))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3258 (gdb-enqueue-input
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3259 (list
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3260 (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
3261 (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
3262 gdb-pc-address "\n")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3263 'gdb-assembler-handler))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
3264 (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
3265 (setq gdb-previous-frame-address gdb-pc-address)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3266 (setq gdb-previous-frame gdb-selected-frame)))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3267
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3268 (defun gdb-get-selected-frame ()
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3269 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3270 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3271 (gdb-enqueue-input
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
3272 (list (concat gdb-server-prefix "info frame\n") 'gdb-frame-handler))
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3273 (push 'gdb-get-selected-frame
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
3274 gdb-pending-triggers))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3275
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3276 (defun gdb-frame-handler ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
3277 (setq gdb-pending-triggers
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
3278 (delq 'gdb-get-selected-frame gdb-pending-triggers))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
3279 (goto-char (point-min))
70053
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
3280 (when (re-search-forward
9099e9f6d57a (gdb-pc-address): Rename from gdb-frame-address.
Nick Roberts <nickrob@snap.net.nz>
parents: 69988
diff changeset
3281 "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
3282 (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
3283 (setq gdb-frame-address (match-string 2)))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
3284 (goto-char (point-min))
71409
f723aa5cf2de (gdb-exited): Ensure overlay arrow gets killed.
Nick Roberts <nickrob@snap.net.nz>
parents: 71348
diff changeset
3285 (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
3286 \\(?: (\\(\\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
3287 nil t)
e6d430f1cde3 (gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents: 69839
diff changeset
3288 (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
3289 (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
3290 (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
3291 (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
3292 (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
3293 (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
3294 (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
3295 (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
3296 (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
3297 (let ((buffer (marker-buffer gud-overlay-arrow-position))
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3298 (position (marker-position gud-overlay-arrow-position)))
70372
39c42b92436d (gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents: 70351
diff changeset
3299 (when (and buffer
39c42b92436d (gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents: 70351
diff changeset
3300 (string-equal (buffer-name buffer)
39c42b92436d (gdb-force-update): Delete variable...
Nick Roberts <nickrob@snap.net.nz>
parents: 70351
diff changeset
3301 (file-name-nondirectory (match-string 3))))
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3302 (with-current-buffer buffer
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3303 (setq fringe-indicator-alist
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3304 (if (string-equal gdb-frame-number "0")
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3305 nil
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3306 '((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
3307 (set-marker gud-overlay-arrow-position position))))))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
3308 (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
3309 (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
3310 (setq gdb-current-language (match-string 1)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
3311 (gdb-invalidate-assembler))
68902
5de231ae5dc9 (gdb-use-separate-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 68864
diff changeset
3312
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
3313
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3314 ;; Code specific to GDB 6.4
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
3315 (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
3316
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3317 (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
3318 "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
3319 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
3320 is set in them."
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3321 (goto-char (point-min))
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
3322 (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
3323 (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
3324 (dolist (buffer (buffer-list))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3325 (with-current-buffer buffer
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3326 (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
3327 (set (make-local-variable 'gud-minor-mode)
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3328 (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
3329 (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
3330 (when gud-tooltip-mode
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3331 (make-local-variable 'gdb-define-alist)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3332 (gdb-create-define-alist)
71277
99ed754e8f50 (gdb-set-gud-minor-mode-existing-buffers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 71113
diff changeset
3333 (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
3334 (gdb-force-mode-line-update
3d39ae4ce1b6 (gdb-set-gud-minor-mode-existing-buffers)
Nick Roberts <nickrob@snap.net.nz>
parents: 71877
diff changeset
3335 (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
3336
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3337 ; 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
3338 (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
3339 (gdb-enqueue-input
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3340 (list
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3341 (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
3342 (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
3343 varnum "\"\n")
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3344 (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
3345 `(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
3346
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3347 (defconst gdb-var-list-children-regexp-1
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3348 "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\
72668
5a0fb2945b46 (gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 72651
diff changeset
3349 numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\
5a0fb2945b46 (gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 72651
diff changeset
3350 \\(}\\|,.*?\\(type=\"\\(.+?\\)\"\\)?.*?}\\)")
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3351
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3352 (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
3353 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3354 (let ((var-list nil))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3355 (catch 'child-already-watched
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3356 (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
3357 (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
3358 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3359 (push var var-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3360 (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
3361 (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
3362 (match-string 2)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3363 (match-string 3)
72668
5a0fb2945b46 (gdb-var-list-children-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 72651
diff changeset
3364 (match-string 7)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3365 (read (match-string 4))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3366 nil)))
69475
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
3367 (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
3368 (throw 'child-already-watched nil))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3369 (push varchild var-list))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3370 (push var var-list)))
70503
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
3371 (setq gdb-var-list (nreverse var-list))))
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
3372 (gdb-speedbar-update))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3373
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3374 ; 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
3375 (defun gdb-var-update-1 ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3376 (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
3377 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3378 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3379 (list
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3380 (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
3381 "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
3382 "-var-update --all-values *\n")
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3383 'gdb-var-update-handler-1))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3384 (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
3385
68941
b41d1af1839d (gdba, gdb-var-list): Improve doc strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 68938
diff changeset
3386 (defconst gdb-var-update-regexp-1
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3387 "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3388 in_scope=\"\\(.*?\\)\".*?}")
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3389
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3390 (defun gdb-var-update-handler-1 ()
68993
3d9e09ba3ace (gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 68967
diff changeset
3391 (dolist (var gdb-var-list)
3d9e09ba3ace (gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 68967
diff changeset
3392 (setcar (nthcdr 5 var) nil))
3d9e09ba3ace (gdb-var-evaluate-expression-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 68967
diff changeset
3393 (goto-char (point-min))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3394 (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
3395 (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
3396 (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
3397 (when var
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
3398 (if (string-equal (match-string 3) "false")
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
3399 (setcar (nthcdr 5 var) 'out-of-scope)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
3400 (setcar (nthcdr 5 var) 'changed)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
3401 (setcar (nthcdr 4 var)
3f8495af82a4 (gdb-var-list): Change order of first two elements.
Nick Roberts <nickrob@snap.net.nz>
parents: 69438
diff changeset
3402 (read (match-string 2)))))))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3403 (setq gdb-pending-triggers
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3404 (delq 'gdb-var-update gdb-pending-triggers))
70503
f403849ca1a6 (gdb-var-create-handler): Move speedbar
Nick Roberts <nickrob@snap.net.nz>
parents: 70428
diff changeset
3405 (gdb-speedbar-update))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3406
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3407 ;; Registers buffer.
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3408 ;;
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3409 (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
3410 'gdb-registers-buffer-name
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3411 'gdb-registers-mode)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3412
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3413 (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
3414 (gdb-get-buffer 'gdb-registers-buffer)
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3415 (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
3416 "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
3417 "-data-list-register-values x\n")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3418 gdb-data-list-register-values-handler)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3419
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3420 (defconst gdb-data-list-register-values-regexp
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3421 "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}")
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3422
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3423 (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
3424 (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
3425 gdb-pending-triggers))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3426 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3427 (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
3428 (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
3429 (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
3430 (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
3431 (erase-buffer)
70141
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3432 (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
3433 (insert err)
e6d430f1cde3 (gdb-init-1): Re-initialise gdb-main-file to nil.
Nick Roberts <nickrob@snap.net.nz>
parents: 69839
diff changeset
3434 (goto-char (point-min)))))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3435 (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
3436 (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
3437 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3438 (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
3439 (setq register (pop register-list))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3440 (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
3441 (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
3442 (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
3443 'face 'font-lock-warning-face
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3444 register-string))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3445 (setq register-values
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3446 (concat register-values register-string)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3447 (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
3448 (with-current-buffer buf
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
3449 (let* ((window (get-buffer-window buf 0))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
3450 (start (window-start window))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
3451 (p (window-point window))
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
3452 (buffer-read-only nil))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3453 (erase-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3454 (insert register-values)
69180
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
3455 (set-window-start window start)
9c5c44399069 (gdb-source-window): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 69108
diff changeset
3456 (set-window-point window p))))))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3457 (gdb-data-list-register-values-custom))
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-custom ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3460 (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
3461 (save-excursion
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3462 (let ((buffer-read-only nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3463 start end)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3464 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3465 (while (< (point) (point-max))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3466 (setq start (line-beginning-position))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3467 (setq end (line-end-position))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3468 (when (looking-at "^[^\t]+")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3469 (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
3470 (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
3471 '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
3472 (add-text-properties start end
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3473 '(help-echo "mouse-2: edit value"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3474 mouse-face highlight))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3475 (forward-line 1))))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3476
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3477 ;; 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
3478 (defun gdb-get-changed-registers ()
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3479 (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
3480 (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
3481 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3482 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3483 (list
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3484 (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
3485 "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
3486 "-data-list-changed-registers\n")
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3487 'gdb-get-changed-registers-handler))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3488 (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
3489
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3490 (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
3491
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3492 (defun gdb-get-changed-registers-handler ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3493 (setq gdb-pending-triggers
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3494 (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
3495 (setq gdb-changed-registers nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3496 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3497 (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
3498 (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
3499
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3500
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3501 ;; Locals buffer.
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3502 ;;
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3503 ;; 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
3504 (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
3505 'gdb-locals-buffer-name
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3506 'gdb-locals-mode)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3507
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3508 (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
3509 (gdb-get-buffer 'gdb-locals-buffer)
68864
47f77ab239fc (gud-watch, gdb-invalidate-registers-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 68773
diff changeset
3510 (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
3511 "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
3512 "-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
3513 gdb-stack-list-locals-handler)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3514
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3515 (defconst gdb-stack-list-locals-regexp
69654
7d2621d0d5e4 (gdb-var-create-regexp)
Nick Roberts <nickrob@snap.net.nz>
parents: 69650
diff changeset
3516 "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"")
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3517
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3518 (defvar gdb-locals-watch-map-1
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3519 (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
3520 (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
3521 (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
3522 (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
3523 map)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3524 "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
3525
72429
ae19dce6b114 (gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents: 72392
diff changeset
3526 (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
3527 (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
3528 (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
3529 (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
3530 (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
3531 map)
ae19dce6b114 (gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents: 72392
diff changeset
3532 "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
3533
ae19dce6b114 (gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents: 72392
diff changeset
3534 (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
3535 "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
3536 (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
3537 (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
3538 (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
3539 (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
3540 (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
3541 (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
3542 (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
3543 (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
3544 '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
3545
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3546 ;; 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
3547 ;; 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
3548 (defun gdb-stack-list-locals-handler ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3549 (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
3550 gdb-pending-triggers))
70141
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3551 (goto-char (point-min))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3552 (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
3553 (let ((err (match-string 1)))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3554 (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
3555 (let ((buffer-read-only nil))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3556 (erase-buffer)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3557 (insert err)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3558 (goto-char (point-min)))))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3559 (let (local locals-list)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3560 (goto-char (point-min))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3561 (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
3562 (let ((local (list (match-string 1)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3563 (match-string 2)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3564 nil)))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3565 (if (looking-at ",value=\\(\".*\"\\).*?}")
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3566 (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
3567 (push local locals-list)))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3568 (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
3569 (and buf (with-current-buffer buf
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3570 (let* ((window (get-buffer-window buf 0))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3571 (start (window-start window))
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3572 (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
3573 (buffer-read-only nil) (name) (value))
70141
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3574 (erase-buffer)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3575 (dolist (local locals-list)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3576 (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
3577 (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
3578 (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
3579 (string-match "^\\0x" value))
70141
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3580 (add-text-properties 0 (length name)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3581 `(mouse-face highlight
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3582 help-echo "mouse-2: create watch expression"
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3583 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
3584 name)
ae19dce6b114 (gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first.
Nick Roberts <nickrob@snap.net.nz>
parents: 72392
diff changeset
3585 (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
3586 `(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
3587 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
3588 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
3589 value))
69618
a6d6cceff8ba (gdb-reset): Set buffer local value of
Kim F. Storm <storm@cua.dk>
parents: 69609
diff changeset
3590 (insert
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3591 (concat name "\t" (nth 1 local)
72481
d7b676d23dd8 (gdb-frame-memory-buffer): Make frame
Nick Roberts <nickrob@snap.net.nz>
parents: 72435
diff changeset
3592 "\t" value "\n")))
70141
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3593 (set-window-start window start)
21438c8b3a3f (gdb-data-list-register-values-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 70053
diff changeset
3594 (set-window-point window p))))))))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3595
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3596 (defun gdb-get-register-names ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3597 "Create a list of register names."
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3598 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3599 (setq gdb-register-names nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3600 (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
3601 (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
3602
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3603 (provide 'gdb-ui)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3604
55696
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
3605 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3606 ;;; gdb-ui.el ends here