annotate lisp/progmodes/gdb-ui.el @ 67438:2e919998931e

(w32_abort) [__GNUC__]: Add instructions for attaching GDB to the abort dialog.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 09 Dec 2005 19:29:58 +0000
parents 7736e7015779
children e81d8f1aa8fe 37d0562504bf
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
59922
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
7 ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
8
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
10
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
11 ;; 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
12 ;; 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
13 ;; 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
14 ;; any later version.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
15
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
16 ;; 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
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
19 ;; GNU General Public License for more details.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
20
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
21 ;; 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
22 ;; 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
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63732
diff changeset
24 ;; Boston, MA 02110-1301, USA.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
25
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
26 ;;; Commentary:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
27
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
28 ;; 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
29 ;; 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
30 ;; 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
31 ;; 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
32 ;; 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
33 ;; 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
34 ;; (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
35
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
36 ;; 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
37 ;; 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
38
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
39 ;; This file has evolved from gdba.el that was included with GDB 5.0 and
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
40 ;; written by Tom Lord and Jim Kingdon. It uses GDB's annotation interface.
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
41 ;; You don't need to know about annotations to use this mode as a debugger,
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
42 ;; 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
43 ;; 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
44
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
45 ;; GDB developers plan to make the annotation interface obsolete. A new
55850
63ca25eb73a1 (gdb-current-frame, gud-watch)
Nick Roberts <nickrob@snap.net.nz>
parents: 55764
diff changeset
46 ;; interface called GDB/MI (machine interface) has been designed to replace
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
47 ;; it. Some GDB/MI commands are used in this file through the CLI command
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
48 ;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included with
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
49 ;; GDB (6.2 onwards) that uses GDB/MI as the primary interface to GDB. It is
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
50 ;; still under development and is part of a process to migrate Emacs from
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
51 ;; annotations to GDB/MI.
67233
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
52
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 ;; This mode SHOULD WORK WITH GDB 5.0 onwards but you will NEED GDB 6.0
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 ;; onwards to use watch expressions.
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
55
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
56 ;;; 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
57
64241
a19a23509f95 Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents: 64085
diff changeset
58 ;; 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
59 ;; 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
60 ;; 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
61 ;; 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
62
64241
a19a23509f95 Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents: 64085
diff changeset
63 ;; #ifdef UNBUFFERED
64999
e1cdc6178b3e (toggle-gdb-use-inferior-io-buffer):
Nick Roberts <nickrob@snap.net.nz>
parents: 64993
diff changeset
64 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0);
64241
a19a23509f95 Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents: 64085
diff changeset
65 ;; #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
66
64241
a19a23509f95 Add note about buffering with Windows.
Nick Roberts <nickrob@snap.net.nz>
parents: 64085
diff changeset
67 ;; 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
68
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
69 ;;; 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
70
67096
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
71 ;; 1) Strings that are watched don't update in the speedbar when their
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
72 ;; contents change.
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
73 ;; 2) Watch expressions go out of scope when the inferior is re-run.
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
74 ;; 3) Cannot handle multiple debug sessions.
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
75
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
76 ;;; TODO:
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
77
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
78 ;; 1) Use MI command -data-read-memory for memory window.
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
79 ;; 2) Highlight changed register values (use MI commands
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
80 ;; -data-list-register-values and -data-list-changed-registers instead
67309
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
81 ;; of 'info registers' after release of 22.1.
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
82 ;; 3) Use tree-widget.el instead of the speedbar for watch-expressions?
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
83 ;; 4) Mark breakpoint locations on scroll-bar of source buffer?
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
84 ;; 5) After release of 22.1, use "-var-list-children --all-values"
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
85 ;; and "-stack-list-locals --simple-values" which need GDB 6.1 onwards.
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
86 ;; 6) After release of 22.1, use "-var-update --all-values" which needs
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
87 ;; GDB 6.4 onwards.
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
88 ;; 7) With gud-print and gud-pstar, print the variable name in the GUD
66681
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
89 ;; buffer instead of the value's history number.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
90
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
91 ;;; Code:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
92
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
93 (require 'gud)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
94
65231
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
95 (defvar tool-bar-map)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
96 (defvar speedbar-initial-expansion-list-name)
65231
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
97
64702
56f44995f925 (gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents: 64697
diff changeset
98 (defvar gdb-frame-address "main" "Initialization for Assembler buffer.")
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
99 (defvar gdb-previous-frame-address nil)
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
100 (defvar gdb-memory-address "main")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
101 (defvar gdb-previous-frame nil)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
102 (defvar gdb-selected-frame nil)
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
103 (defvar gdb-frame-number nil)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
104 (defvar gdb-current-language nil)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
105 (defvar gdb-var-list nil "List of variables in watch window.")
64702
56f44995f925 (gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents: 64697
diff changeset
106 (defvar gdb-var-changed nil "Non-nil means that `gdb-var-list' has changed.")
62723
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
107 (defvar gdb-main-file nil "Source file from which program execution begins.")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
108 (defvar gdb-overlay-arrow-position nil)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
109 (defvar gdb-server-prefix nil)
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
110 (defvar gdb-flush-pending-output nil)
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
111 (defvar gdb-location-alist nil
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
112 "Alist of breakpoint numbers and full filenames.")
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
113 (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
114 and #define directives otherwise.")
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
115 (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
116 (defvar gdb-macro-info nil
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
117 "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
118 (defvar gdb-buffer-fringe-width nil)
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
119
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
120 (defvar gdb-buffer-type nil
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
121 "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
122 (make-variable-buffer-local 'gdb-buffer-type)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
123
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
124 (defvar gdb-input-queue ()
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
125 "A list of gdb command objects.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
126
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
127 (defvar gdb-prompting nil
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
128 "True when gdb is idle with no pending input.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
129
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
130 (defvar gdb-output-sink 'user
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
131 "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
132 Possible values are these symbols:
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
133
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
134 `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
135 for the user to see.
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
136
64702
56f44995f925 (gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents: 64697
diff changeset
137 `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
138
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
139 `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
140 annotation is received. Then the output-sink
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
141 becomes:...
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
142 `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
143 for subsequent processing by a command. This is the
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
144 disposition of output generated by commands that
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
145 gdb mode sends to gdb on its own behalf.
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
146 `post-emacs' -- ignore output until the prompt annotation is
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
147 received, then go to USER disposition.
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
148
64702
56f44995f925 (gdb-frame-address, gdb-var-changed, gdb-output-sink, gdba,
Juanma Barranquero <lekktu@gmail.com>
parents: 64697
diff changeset
149 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
150 \(`user' and `emacs').")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
151
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
152 (defvar gdb-current-item nil
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
153 "The most recent command item sent to gdb.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
154
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
155 (defvar gdb-pending-triggers '()
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
156 "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
157 handlers.")
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
158
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
159 (defvar gdb-first-post-prompt nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
160 (defvar gdb-version nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
161 (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
162 (defvar gdb-source-file-list nil
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
163 "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
164 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
165
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
166 (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
167 '(
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
168 ;; var = (struct struct_tag) value
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
169 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
170 (1 font-lock-variable-name-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
171 (3 font-lock-keyword-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
172 (4 font-lock-type-face))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
173 ;; var = (type) value
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
174 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\sw\\|[_.]\\)+\\)"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
175 (1 font-lock-variable-name-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
176 (3 font-lock-type-face))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
177 ;; var = val
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
178 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
179 (1 font-lock-variable-name-face))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
180 )
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
181 "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
182
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
183 (defvar gdb-locals-font-lock-keywords-2
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
184 '(
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
185 ;; var = type value
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
186 ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
187 (1 font-lock-variable-name-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
188 (3 font-lock-type-face))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
189 )
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
190 "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
191
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
192 ;; Variables for GDB 6.4+
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
193
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
194 (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
195 (defvar gdb-changed-registers nil
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
196 "List of changed register numbers (strings).")
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
197
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
198 ;;;###autoload
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
199 (defun gdba (command-line)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
200 "Run gdb on program FILE in buffer *gud-FILE*.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
201 The directory containing FILE becomes the initial working directory
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
202 and source-file directory for your debugger.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
203
54668
69a699e79a0d (gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents: 54617
diff changeset
204 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
205 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
206 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
207 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
208
54901
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
209 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
210 `gdb-show-main', the layout below will appear unless
54760
c6ccb7a82f9f (gdb-source-window): Remove variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 54729
diff changeset
211 `gdb-use-inferior-io-buffer' is nil when the source buffer
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
212 occupies the full width of the frame. Keybindings are given in
54760
c6ccb7a82f9f (gdb-source-window): Remove variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 54729
diff changeset
213 relevant buffer.
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
214
54901
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
215 Watch expressions appear in the speedbar/slowbar.
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
216
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
217 The following commands help control operation :
54901
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
218
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
219 `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
220 `gdb-restore-windows' - To restore the window layout.
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
221
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
222 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
223 detailed description of this mode.
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
224
fa4feb8b3c34 (gdb-goto-info): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 54760
diff changeset
225
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
226 +--------------------------------------------------------------+
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
227 | GDB Toolbar |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
228 +-------------------------------+------------------------------+
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
229 | GUD buffer (I/O of GDB) | Locals buffer |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
230 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
231 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
232 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
233 +-------------------------------+------------------------------+
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
234 | Source buffer | I/O buffer (of inferior) |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
235 | | (comint-mode) |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
236 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
237 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
238 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
239 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
240 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
241 | | |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
242 +-------------------------------+------------------------------+
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
243 | Stack buffer | Breakpoints buffer |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
244 | RET gdb-frames-select | SPC gdb-toggle-breakpoint |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
245 | | RET gdb-goto-breakpoint |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
246 | | d gdb-delete-breakpoint |
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
247 +-------------------------------+------------------------------+"
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
248 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
249 (interactive (list (gud-query-cmdline 'gdba)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
250 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
251 ;; Let's start with a basic gud-gdb buffer and then modify it a bit.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
252 (gdb command-line)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
253 (gdb-init-1))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
254
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
255 (defvar gdb-debug-log nil)
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
256
64697
7767f4fb012a * progmodes/gdb-ui.el (gdb-enable-debug-log): Add autoload cookie.
Nick Roberts <nickrob@snap.net.nz>
parents: 64654
diff changeset
257 ;;;###autoload
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
258 (defcustom gdb-enable-debug-log nil
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
259 "Non-nil means record the process input and output in `gdb-debug-log'."
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
260 :type 'boolean
57851
67b88e92a24d (gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents: 57791
diff changeset
261 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
262 :version "22.1")
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
263
62115
515e18600ed2 (gdb-cpp-define-alist-program): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 62065
diff changeset
264 (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
265 "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
266 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
267 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
268 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
269
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
270 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
271 predefined macros."
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
272 :type 'string
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
273 :group 'gud
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
274 :version "22.1")
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
275
62065
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
276 (defcustom gdb-cpp-define-alist-flags ""
62723
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
277 "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
278 :type 'string
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
279 :group 'gud
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
280 :version "22.1")
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
281
62723
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
282 (defcustom gdb-show-main nil
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
283 "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
284 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
285 :type 'boolean
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
286 :group 'gud
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
287 :version "22.1")
0ae5fe9ca759 *** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents: 62716
diff changeset
288
66582
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
289 (defcustom gdb-use-inferior-io-buffer nil
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
290 "Non-nil means display output from the inferior in a separate buffer."
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
291 :type 'boolean
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
292 :group 'gud
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
293 :version "22.1")
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
294
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
295 (defun gdb-use-inferior-io-buffer (arg)
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
296 "Toggle separate IO for inferior.
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
297 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
298 (interactive "P")
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
299 (setq gdb-use-inferior-io-buffer
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
300 (if (null arg)
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
301 (not gdb-use-inferior-io-buffer)
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
302 (> (prefix-numeric-value arg) 0)))
67309
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
303 (message (format "Separate inferior IO %sabled"
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
304 (if gdb-use-inferior-io-buffer "en" "dis")))
66582
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
305 (if (and gud-comint-buffer
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
306 (buffer-name gud-comint-buffer))
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
307 (condition-case nil
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
308 (if gdb-use-inferior-io-buffer
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
309 (gdb-restore-windows)
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
310 (kill-buffer (gdb-inferior-io-name)))
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
311 (error nil))))
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
312
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
313 (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
314
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
315 (defun gdb-create-define-alist ()
62065
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
316 "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
317 (let* ((file (buffer-file-name))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
318 (output
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
319 (with-output-to-string
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
320 (with-current-buffer standard-output
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
321 (call-process shell-file-name
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
322 (if (file-exists-p file) file nil)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
323 (list t nil) nil "-c"
62065
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
324 (concat gdb-cpp-define-alist-program " "
115b0152e8bb (gdb-cpp-define-alist-flags): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62050
diff changeset
325 gdb-cpp-define-alist-flags)))))
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
326 (define-list (split-string output "\n" t))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
327 (name))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
328 (setq gdb-define-alist nil)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
329 (dolist (define define-list)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
330 (setq name (nth 1 (split-string define "[( ]")))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
331 (push (cons name define) gdb-define-alist))))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
332
62136
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
333 (defun gdb-tooltip-print ()
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
334 (tooltip-show
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
335 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
336 (let ((string (buffer-string)))
69b9edc69fe5 (gdb-tooltip-print): Moved from tooltip.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 62115
diff changeset
337 ;; 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
338 (substring string 0 (- (length string) 1))))
63443
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
339 (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
340
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
341 ;; 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
342 ;; 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
343 ;; unexpected starting annotation (phase error).
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
344 (defun gdb-tooltip-print-1 (expr)
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
345 (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
346 (goto-char (point-min))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
347 (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
348 (unless (looking-at "\\S-+.*(.*).*")
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
349 (gdb-enqueue-input
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
350 (list (concat gdb-server-prefix "print " expr "\n")
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
351 'gdb-tooltip-print))))))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
352
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
353 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)")
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
354
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
355 (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
356 "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
357 (goto-char (point-min))
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
358 (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
359 (while (re-search-forward gdb-source-file-regexp nil t)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
360 (push (or (match-string 1) (match-string 2)) gdb-source-file-list))
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
361 (dolist (buffer (buffer-list))
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
362 (with-current-buffer buffer
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
363 (when (and buffer-file-name
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
364 (member (file-name-nondirectory buffer-file-name)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
365 gdb-source-file-list))
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
366 (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
367 (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
368 (when gud-tooltip-mode
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
369 (make-local-variable 'gdb-define-alist)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
370 (gdb-create-define-alist)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
371 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))))
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
372
66977
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
373 (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
374 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
375 (varno (nth 1 var)) (expr))
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
376 (string-match "\\(var[0-9]+\\)\\.\\(.*\\)" varno)
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
377 (dolist (var1 gdb-var-list)
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
378 (if (string-equal (nth 1 var1) (match-string 1 varno))
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
379 (setq expr (concat (car var1) "." (match-string 2 varno)))))
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
380 expr))
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
381
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
382 (defun gdb-init-1 ()
54616
47c4cb867a84 (gdb-ann3, gdb-send-item)
Nick Roberts <nickrob@snap.net.nz>
parents: 54538
diff changeset
383 (setq gdb-debug-log nil)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
384 (set (make-local-variable 'gud-minor-mode) 'gdba)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
385 (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
386 ;;
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
387 (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
388 (gud-call "break %f:%l" arg)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
389 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
390 (beginning-of-line)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
391 (forward-char 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
392 (gud-call "break *%a" arg)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
393 "\C-b" "Set breakpoint at current line or address.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
394 ;;
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
395 (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
396 (gud-call "clear %f:%l" arg)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
397 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
398 (beginning-of-line)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
399 (forward-char 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
400 (gud-call "clear *%a" arg)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
401 "\C-d" "Remove breakpoint at current line or address.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
402 ;;
66886
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
403 (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
404 (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
405 (save-excursion
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
406 (beginning-of-line)
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
407 (forward-char 2)
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
408 (gud-call "until *%a" arg)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
409 "\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
410 ;;
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
411 (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
412 nil "Start or continue execution.")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
413
66977
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
414 ;; For debugging Emacs only.
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
415 (gud-def gud-pp
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
416 (gud-call
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
417 (concat
6ea7a5538417 (gdb-ann3): Move definition of gud-pp to here.
Nick Roberts <nickrob@snap.net.nz>
parents: 66886
diff changeset
418 "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
419 '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
420 (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
421 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
422
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
423 (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
424 'gdb-mouse-set-clear-breakpoint)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
425 (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
426 'gdb-mouse-set-clear-breakpoint)
66419
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
427 (define-key gud-minor-mode-map [left-fringe mouse-2]
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
428 'gdb-mouse-until)
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
429 (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
430 'gdb-mouse-until)
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
431 (define-key gud-minor-mode-map [left-margin mouse-2]
f8729e3300dc (gdb-ann3): Bind mouse-2 to gdb-mouse-until in the margin also.
Nick Roberts <nickrob@snap.net.nz>
parents: 67164
diff changeset
432 'gdb-mouse-until)
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
433 (define-key gud-minor-mode-map [left-margin mouse-3]
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
434 'gdb-mouse-toggle-breakpoint-margin)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
435 (define-key gud-minor-mode-map [left-fringe mouse-3]
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
436 'gdb-mouse-toggle-breakpoint-fringe)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
437
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
438 (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
439
57664
4d6eec4c1ef8 * progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents: 57661
diff changeset
440 ;; (re-)initialize
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
441 (setq gdb-frame-address (if gdb-show-main "main" nil))
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
442 (setq gdb-previous-frame-address nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
443 gdb-memory-address "main"
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
444 gdb-previous-frame nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
445 gdb-selected-frame nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
446 gdb-current-language nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
447 gdb-frame-number nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
448 gdb-var-list nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
449 gdb-var-changed nil
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
450 gdb-first-post-prompt t
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
451 gdb-prompting nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
452 gdb-input-queue nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
453 gdb-current-item nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
454 gdb-pending-triggers nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
455 gdb-output-sink 'user
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
456 gdb-server-prefix "server "
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
457 gdb-flush-pending-output nil
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
458 gdb-location-alist nil
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
459 gdb-source-file-list nil
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
460 gdb-error nil
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
461 gdb-macro-info nil
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
462 gdb-buffer-fringe-width (car (window-fringes)))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
463
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
464 (setq gdb-buffer-type 'gdba)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
465
54729
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
466 (if gdb-use-inferior-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
467
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
468 ;; 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
469 (setq gdb-version nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
470 (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
471 'gdb-get-version)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
472
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
473 (defun gdb-init-2 ()
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
474 (if (eq window-system 'w32)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
475 (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
476 (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
477 (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
478
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
479 (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
480 (progn
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
481 (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
482 '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
483 (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
484 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
485 (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
486 'gdb-get-register-names))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
487 ; Needs GDB 6.2 onwards.
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
488 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
489 (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
490 '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
491 (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
492
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
493 ;; find source file and compilation directory here
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
494 (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
495 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran program
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
496 (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
497
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
498 (run-hooks 'gdba-mode-hook))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
499
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
500 (defun gdb-get-version ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
501 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
502 (if (and (re-search-forward gdb-error-regexp nil t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
503 (string-match ".*(missing implementation)" (match-string 1)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
504 (setq gdb-version "pre-6.4")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
505 (setq gdb-version "6.4+"))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
506 (gdb-init-2))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
507
66419
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
508 (defun gdb-mouse-until (event)
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
509 "Execute source lines by dragging the overlay arrow (fringe) with the mouse."
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
510 (interactive "e")
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
511 (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
512 (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
513 (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
514 (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
515 (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
516 (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
517 (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
518 (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
519 (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
520 (marker-position
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
521 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
522 (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
523 (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
524 (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
525 (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
526 (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
527 (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
528 (marker-position
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
529 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
530 (save-excursion
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
531 (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
532 (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
533 (gud-call (concat "until *%a")))))))))
66419
5da1cd84fb2c (gdb-mouse-until): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66417
diff changeset
534
67096
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
535 (defcustom gdb-speedbar-auto-raise t
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
536 "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
537 updated."
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
538 :type 'boolean
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
539 :group 'gud
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
540 :version "22.1")
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
541
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
542 (defun gdb-speedbar-auto-raise (arg)
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
543 "Toggle automatic raising of the speedbar for watch expressions."
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
544 (interactive "P")
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
545 (setq gdb-speedbar-auto-raise
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
546 (if (null arg)
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
547 (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
548 (> (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
549 (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
550 (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
551
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
552 (defcustom gdb-use-colon-colon-notation nil
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
553 "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
554 :type 'boolean
57851
67b88e92a24d (gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents: 57791
diff changeset
555 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
556 :version "22.1")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
557
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
558 (defun gud-watch (&optional event)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
559 "Watch expression at point."
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
560 (interactive (list last-input-event))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
561 (if event (posn-set-point (event-end event)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
562 (require 'tooltip)
66676
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
563 (save-selected-window
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
564 (let ((expr (tooltip-identifier-from-point (point))))
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
565 (if (and (string-equal gdb-current-language "c")
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
566 gdb-use-colon-colon-notation gdb-selected-frame)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
567 (setq expr (concat gdb-selected-frame "::" expr)))
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
568 (catch 'already-watched
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
569 (dolist (var gdb-var-list)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
570 (if (string-equal expr (car var)) (throw 'already-watched nil)))
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
571 (set-text-properties 0 (length expr) nil expr)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
572 (gdb-enqueue-input
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
573 (list
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
574 (if (eq gud-minor-mode 'gdba)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
575 (concat "server interpreter mi \"-var-create - * " expr "\"\n")
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
576 (concat"-var-create - * " expr "\n"))
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
577 `(lambda () (gdb-var-create-handler ,expr))))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
578
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
579 (defconst gdb-var-create-regexp
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
580 "name=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
581
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
582 (defun gdb-var-create-handler (expr)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
583 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
584 (if (re-search-forward gdb-var-create-regexp nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
585 (let ((var (list expr
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
586 (match-string 1)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
587 (match-string 2)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
588 (match-string 3)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
589 nil nil)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
590 (push var gdb-var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
591 (speedbar 1)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
592 (unless (string-equal
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
593 speedbar-initial-expansion-list-name "GUD")
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
594 (speedbar-change-initial-expansion-list "GUD"))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
595 (gdb-enqueue-input
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
596 (list
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
597 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
598 'gdba)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
599 (concat "server interpreter mi \"-var-evaluate-expression "
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
600 (nth 1 var) "\"\n")
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
601 (concat "-var-evaluate-expression " (nth 1 var) "\n"))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
602 `(lambda () (gdb-var-evaluate-expression-handler
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
603 ,(nth 1 var) nil))))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
604 (setq gdb-var-changed t))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
605 (if (search-forward "Undefined command" nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
606 (message-box "Watching expressions requires gdb 6.0 onwards")
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
607 (message "No symbol \"%s\" in current context." expr))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
608
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
609 (defun gdb-var-evaluate-expression-handler (varnum changed)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
610 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
611 (re-search-forward ".*value=\\(\".*\"\\)" nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
612 (catch 'var-found
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
613 (let ((num 0))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
614 (dolist (var gdb-var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
615 (if (string-equal varnum (cadr var))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
616 (progn
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
617 (if changed (setcar (nthcdr 5 var) t))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
618 (setcar (nthcdr 4 var) (read (match-string 1)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
619 (setcar (nthcdr num gdb-var-list) var)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
620 (throw 'var-found nil)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
621 (setq num (+ num 1)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
622 (setq gdb-var-changed t))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
623
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
624 (defun gdb-var-list-children (varnum)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
625 (gdb-enqueue-input
60477
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
626 (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
627 `(lambda () (gdb-var-list-children-handler ,varnum)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
628
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
629 (defconst gdb-var-list-children-regexp
66837
51ebdb18e3d9 (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 66726
diff changeset
630 "name=\"\\(.*?\\)\",exp=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",\
51ebdb18e3d9 (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 66726
diff changeset
631 type=\"\\(.*?\\)\"")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
632
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
633 (defun gdb-var-list-children-handler (varnum)
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
634 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
635 (let ((var-list nil))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
636 (catch 'child-already-watched
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
637 (dolist (var gdb-var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
638 (if (string-equal varnum (cadr var))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
639 (progn
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
640 (push var var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
641 (while (re-search-forward gdb-var-list-children-regexp nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
642 (let ((varchild (list (match-string 2)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
643 (match-string 1)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
644 (match-string 3)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
645 (match-string 4)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
646 nil nil)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
647 (dolist (var1 gdb-var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
648 (if (string-equal (cadr var1) (cadr varchild))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
649 (throw 'child-already-watched nil)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
650 (push varchild var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
651 (gdb-enqueue-input
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
652 (list
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
653 (concat
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
654 "server interpreter mi \"-var-evaluate-expression "
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
655 (nth 1 varchild) "\"\n")
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
656 `(lambda () (gdb-var-evaluate-expression-handler
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
657 ,(nth 1 varchild) nil)))))))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
658 (push var var-list)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
659 (setq gdb-var-list (nreverse var-list)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
660
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
661 (defun gdb-var-update ()
64346
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
662 (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
663 (gdb-enqueue-input
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
664 (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
665 'gdb-var-update-handler))
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
666 (push 'gdb-var-update gdb-pending-triggers)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
667
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
668 (defconst gdb-var-update-regexp "name=\"\\(.*?\\)\"")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
669
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
670 (defun gdb-var-update-handler ()
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
671 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
672 (while (re-search-forward gdb-var-update-regexp nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
673 (catch 'var-found-1
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
674 (let ((varnum (match-string 1)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
675 (dolist (var gdb-var-list)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
676 (gdb-enqueue-input
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
677 (list
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
678 (concat "server interpreter mi \"-var-evaluate-expression "
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
679 varnum "\"\n")
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
680 `(lambda () (gdb-var-evaluate-expression-handler ,varnum t))))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
681 (throw 'var-found-1 nil)))))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
682 (setq gdb-pending-triggers
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
683 (delq 'gdb-var-update gdb-pending-triggers))
60153
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
684 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
685 ;; Dummy command to update speedbar at right time.
60153
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
686 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
687 ;; Keep gdb-pending-triggers non-nil till end.
60153
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
688 (push 'gdb-speedbar-timer gdb-pending-triggers)))
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
689
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
690 (defun gdb-speedbar-timer-fn ()
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
691 (setq gdb-pending-triggers
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
692 (delq 'gdb-speedbar-timer gdb-pending-triggers))
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
693 (with-current-buffer gud-comint-buffer
10993bad7aee (gdb-var-update-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 60124
diff changeset
694 (speedbar-timer-fn)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
695
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
696 (defun gdb-var-delete ()
64346
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
697 "Delete watch expression at point from the speedbar."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
698 (interactive)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
699 (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
700 '(gdbmi gdba))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
701 (let ((text (speedbar-line-text)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
702 (string-match "\\(\\S-+\\)" text)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
703 (let* ((expr (match-string 1 text))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
704 (var (assoc expr gdb-var-list))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
705 (varnum (cadr var)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
706 (unless (string-match "\\." varnum)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
707 (gdb-enqueue-input
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
708 (list
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
709 (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
710 'gdba)
55764
25f133a490aa (gdb-var-update, gdb-var-update-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 55762
diff changeset
711 (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
712 (concat "-var-delete " varnum "\n"))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
713 'ignore))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
714 (setq gdb-var-list (delq var gdb-var-list))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
715 (dolist (varchild gdb-var-list)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
716 (if (string-match (concat (nth 1 var) "\\.") (nth 1 varchild))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
717 (setq gdb-var-list (delq varchild gdb-var-list))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
718 (setq gdb-var-changed t))))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
719
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
720 (defun gdb-edit-value (text token indent)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
721 "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
722 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
723 (varnum (cadr var)) (value))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
724 (setq value (read-string "New value: "))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
725 (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
726 (list
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
727 (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
728 (concat "server interpreter mi \"-var-assign "
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
729 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
730 (concat "-var-assign " varnum " " value "\n"))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
731 'ignore))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
732
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
733 (defcustom gdb-show-changed-values t
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
734 "If non-nil highlight values that have recently changed in the speedbar.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
735 The highlighting is done with `font-lock-warning-face'."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
736 :type 'boolean
58049
fd0093bd412a (gdb-current-stack-level): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 57982
diff changeset
737 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
738 :version "22.1")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
739
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
740 (defun gdb-speedbar-expand-node (text token indent)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
741 "Expand the node the user clicked on.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
742 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
743 TOKEN is data related to this node.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
744 INDENT is the current indentation depth."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
745 (cond ((string-match "+" text) ;expand this node
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
746 (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
747 (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
748 (gdb-var-list-children token)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
749 (gdb-var-list-children-1 token))
64346
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
750 (progn
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
751 (gdbmi-var-update)
ef82d5d73c0d (gdb-var-update, gdb-var-update-handler):
Nick Roberts <nickrob@snap.net.nz>
parents: 64241
diff changeset
752 (gdbmi-var-list-children token))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
753 ((string-match "-" text) ;contract this node
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
754 (dolist (var gdb-var-list)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
755 (if (string-match (concat token "\\.") (nth 1 var))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
756 (setq gdb-var-list (delq var gdb-var-list))))
66162
9698655085d3 (gdb-var-create-handler): Make watch
Nick Roberts <nickrob@snap.net.nz>
parents: 65973
diff changeset
757 (setq gdb-var-changed t)
9698655085d3 (gdb-var-create-handler): Make watch
Nick Roberts <nickrob@snap.net.nz>
parents: 65973
diff changeset
758 (with-current-buffer gud-comint-buffer
9698655085d3 (gdb-var-create-handler): Make watch
Nick Roberts <nickrob@snap.net.nz>
parents: 65973
diff changeset
759 (speedbar-timer-fn)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
760
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
761 (defun gdb-get-target-string ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
762 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
763 gud-target-name))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
764
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
765
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
766 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
767 ;; gdb buffers.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
768 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
769 ;; 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
770 ;; of that particular buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
771 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
772 ;; 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
773 ;; is constructed specially.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
774 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
775 ;; Others are constructed by gdb-get-create-buffer and
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
776 ;; 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
777
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
778 (defvar gdb-buffer-rules-assoc '())
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
779
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
780 (defun gdb-get-buffer (key)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
781 "Return the gdb buffer tagged with type KEY.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
782 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
783 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
784 (gdb-look-for-tagged-buffer key (buffer-list))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
785
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
786 (defun gdb-get-create-buffer (key)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
787 "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
788 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
789 (or (gdb-get-buffer key)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
790 (let* ((rules (assoc key gdb-buffer-rules-assoc))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
791 (name (funcall (gdb-rules-name-maker rules)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
792 (new (get-buffer-create name)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
793 (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
794 (let ((trigger))
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
795 (if (cdr (cdr rules))
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
796 (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
797 (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
798 (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
799 (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
800 (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
801 (if trigger (funcall trigger)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
802 new))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
803
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
804 (defun gdb-rules-name-maker (rules) (car (cdr rules)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
805
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
806 (defun gdb-look-for-tagged-buffer (key bufs)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
807 (let ((retval nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
808 (while (and (not retval) bufs)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
809 (set-buffer (car bufs))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
810 (if (eq gdb-buffer-type key)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
811 (setq retval (car bufs)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
812 (setq bufs (cdr bufs)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
813 retval))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
814
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
815 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
816 ;; 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
817 ;; 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
818 ;; roles in defining a buffer type:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
819 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
820 ;; NAME - Return a name for this buffer type.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
821 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
822 ;; The remaining function(s) are optional:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
823 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
824 ;; 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
825 ;; the proper mode for the buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
826 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
827
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
828 (defun gdb-set-buffer-rules (buffer-type &rest rules)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
829 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
830 (if binding
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
831 (setcdr binding rules)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
832 (push (cons buffer-type rules)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
833 gdb-buffer-rules-assoc))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
834
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
835 ;; GUD buffers are an exception to the rules
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
836 (gdb-set-buffer-rules 'gdba 'error)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
837
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
838 ;; 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
839 ;; behalf of emacs (rather than the user).
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
840 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
841 (gdb-set-buffer-rules 'gdb-partial-output-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
842 'gdb-partial-output-name)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
843
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
844 (defun gdb-partial-output-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
845 (concat "*partial-output-"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
846 (gdb-get-target-string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
847 "*"))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
848
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
849
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
850 (gdb-set-buffer-rules 'gdb-inferior-io
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
851 'gdb-inferior-io-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
852 'gdb-inferior-io-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
853
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
854 (defun gdb-inferior-io-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
855 (concat "*input/output of "
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
856 (gdb-get-target-string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
857 "*"))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
858
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
859 (defun gdb-display-inferior-io-buffer ()
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
860 "Display IO of inferior in a separate window."
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
861 (interactive)
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
862 (if gdb-use-inferior-io-buffer
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
863 (gdb-display-buffer
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
864 (gdb-get-create-buffer 'gdb-inferior-io))))
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
865
65231
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
866 (defconst gdb-frame-parameters
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
867 '((height . 14) (width . 80)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
868 (unsplittable . t)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
869 (tool-bar-lines . nil)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
870 (menu-bar-lines . nil)
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
871 (minibuffer . nil)))
cdfa3b89c6bb (tool-bar-map): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64999
diff changeset
872
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
873 (defun gdb-frame-inferior-io-buffer ()
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
874 "Display IO of inferior in a new frame."
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
875 (interactive)
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
876 (if gdb-use-inferior-io-buffer
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
877 (let ((special-display-regexps (append special-display-regexps '(".*")))
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
878 (special-display-frame-alist gdb-frame-parameters))
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
879 (display-buffer (gdb-get-create-buffer 'gdb-inferior-io)))))
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
880
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
881 (defvar gdb-inferior-io-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
882 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
883 (define-key map "\C-c\C-c" 'gdb-inferior-io-interrupt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
884 (define-key map "\C-c\C-z" 'gdb-inferior-io-stop)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
885 (define-key map "\C-c\C-\\" 'gdb-inferior-io-quit)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
886 (define-key map "\C-c\C-d" 'gdb-inferior-io-eof)
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
887 (define-key map "\C-d" 'gdb-inferior-io-eof)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
888 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
889
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
890 (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
891 "Major mode for gdb inferior-io."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
892 :syntax-table nil :abbrev-table nil
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
893 ;; 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
894 ;; 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
895 ;; a dummy one.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
896 (make-comint-in-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
897 (substring (buffer-name) 1 (- (length (buffer-name)) 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
898 (current-buffer) "hexl")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
899 (setq comint-input-sender 'gdb-inferior-io-sender))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
900
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
901 (defun gdb-inferior-io-sender (proc string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
902 ;; PROC is the pseudo-process created to satisfy comint.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
903 (with-current-buffer (process-buffer proc)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
904 (setq proc (get-buffer-process gud-comint-buffer))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
905 (process-send-string proc string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
906 (process-send-string proc "\n")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
907
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
908 (defun gdb-inferior-io-interrupt ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
909 "Interrupt the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
910 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
911 (interrupt-process
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
912 (get-buffer-process gud-comint-buffer) comint-ptyp))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
913
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
914 (defun gdb-inferior-io-quit ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
915 "Send quit signal to the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
916 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
917 (quit-process
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
918 (get-buffer-process gud-comint-buffer) comint-ptyp))
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-inferior-io-stop ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
921 "Stop the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
922 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
923 (stop-process
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
924 (get-buffer-process gud-comint-buffer) comint-ptyp))
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 (defun gdb-inferior-io-eof ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
927 "Send end-of-file to the program being debugged."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
928 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
929 (process-send-eof
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
930 (get-buffer-process gud-comint-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
931
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
932
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
933 ;; gdb communications
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
934 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
935
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
936 ;; INPUT: things sent to gdb
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
937 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
938 ;; 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
939 ;; user-like input) or a list of the form:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
940 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
941 ;; (INPUT-STRING HANDLER-FN)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
942 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
943 ;; 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
944 ;; 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
945 ;; commands autonomously.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
946 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
947 ;; These lists are consumed tail first.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
948 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
949
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
950 (defun gdb-send (proc string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
951 "A comint send filter for gdb.
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
952 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
953 (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
954 (let ((inhibit-read-only t))
9e9e3aac0fda (gdb-send): Bind inhibit-read-only to t
Nick Roberts <nickrob@snap.net.nz>
parents: 66162
diff changeset
955 (remove-text-properties (point-min) (point-max) '(face))))
60477
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
956 (let ((item (concat string "\n")))
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
957 (if gud-running
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
958 (progn
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
959 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log))
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
960 (process-send-string proc item))
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
961 (gdb-enqueue-input item))))
54538
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 ;; 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
964 ;; is a query, or other non-top-level prompt.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
965
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
966 (defun gdb-enqueue-input (item)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
967 (if gdb-prompting
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
968 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
969 (gdb-send-item item)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
970 (setq gdb-prompting nil))
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
971 (push item gdb-input-queue)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
972
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
973 (defun gdb-dequeue-input ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
974 (let ((queue gdb-input-queue))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
975 (and queue
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
976 (let ((last (car (last queue))))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
977 (unless (nbutlast queue) (setq gdb-input-queue '()))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
978 last))))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
979
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
980 (defun gdb-send-item (item)
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
981 (setq gdb-flush-pending-output nil)
60477
2b7513e741b1 (gdb-var-create-handler): Handle just MI case.
Nick Roberts <nickrob@snap.net.nz>
parents: 60326
diff changeset
982 (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
983 (setq gdb-current-item item)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
984 (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
985 (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
986 (if (stringp item)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
987 (progn
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
988 (setq gdb-output-sink 'user)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
989 (process-send-string process item))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
990 (progn
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
991 (gdb-clear-partial-output)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
992 (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
993 (process-send-string process
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
994 (car item))))
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
995 ;; case: eq gud-minor-mode 'gdbmi
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
996 (gdb-clear-partial-output)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
997 (setq gdb-output-sink 'emacs)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
998 (process-send-string process (car item)))))
54538
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 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1001 ;; output -- things gdb prints to emacs
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 ;; GDB output is a stream interrupted by annotations.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1004 ;; Annotations can be recognized by their beginning
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1005 ;; 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
1006 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1007 ;; The tag is a string obeying symbol syntax.
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 ;; The optional part `<opt>' can be either the empty string
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1010 ;; 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
1011 ;; For example, the SOURCE annotation is followed by a filename,
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1012 ;; 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
1013 ;; any newlines.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1014 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1015
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1016 (defcustom gud-gdba-command-name "gdb -annotate=3"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1017 "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
1018 :type 'string
57851
67b88e92a24d (gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents: 57791
diff changeset
1019 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
1020 :version "22.1")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1021
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1022 (defvar gdb-annotation-rules
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1023 '(("pre-prompt" gdb-pre-prompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1024 ("prompt" gdb-prompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1025 ("commands" gdb-subprompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1026 ("overload-choice" gdb-subprompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1027 ("query" gdb-subprompt)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1028 ;; 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
1029 ("nquery" gdb-subprompt)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1030 ("prompt-for-continue" gdb-subprompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1031 ("post-prompt" gdb-post-prompt)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1032 ("source" gdb-source)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1033 ("starting" gdb-starting)
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1034 ("exited" gdb-exited)
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1035 ("signalled" gdb-exited)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1036 ("signal" gdb-stopping)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1037 ("breakpoint" gdb-stopping)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1038 ("watchpoint" gdb-stopping)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1039 ("frame-begin" gdb-frame-begin)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1040 ("stopped" gdb-stopped)
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1041 ("error-begin" gdb-error)
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1042 ("error" gdb-error)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1043 ) "An assoc mapping annotation tags to functions which process them.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1044
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1045 (defun gdb-resync()
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1046 (setq gdb-flush-pending-output t)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1047 (setq gud-running nil)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1048 (setq gdb-output-sink 'user)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1049 (setq gdb-input-queue nil)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1050 (setq gdb-pending-triggers nil)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1051 (setq gdb-prompting t))
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1052
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1053 (defconst gdb-source-spec-regexp
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
1054 "\\(.*\\):\\([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
1055
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1056 ;; Do not use this except as an annotation handler.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1057 (defun gdb-source (args)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1058 (string-match gdb-source-spec-regexp args)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1059 ;; Extract the frame position from the marker.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1060 (setq gud-last-frame
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1061 (cons
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1062 (match-string 1 args)
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
1063 (string-to-number (match-string 2 args))))
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
1064 (setq gdb-frame-address (match-string 3 args))
54962
c3272c09f927 (gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents: 54901
diff changeset
1065 ;; cover for auto-display output which comes *before*
c3272c09f927 (gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents: 54901
diff changeset
1066 ;; stopped annotation
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1067 (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
1068
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1069 (defun gdb-pre-prompt (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1070 "An annotation handler for `pre-prompt'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1071 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
1072 happens to be in effect."
67164
c3990f178905 (gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents: 67147
diff changeset
1073 (setq gdb-error nil)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1074 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1075 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1076 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1077 ((eq sink 'emacs)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1078 (setq gdb-output-sink 'post-emacs))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1079 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1080 (gdb-resync)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1081 (error "Phase error in gdb-pre-prompt (got %s)" sink)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1082
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1083 (defun gdb-prompt (ignored)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1084 "An annotation handler for `prompt'.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1085 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
1086 (when gdb-first-prompt
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1087 (gdb-init-1)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1088 (setq gdb-first-prompt nil))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1089 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1090 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1091 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1092 ((eq sink 'post-emacs)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1093 (setq gdb-output-sink 'user)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1094 (let ((handler
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1095 (car (cdr gdb-current-item))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1096 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1097 (funcall handler))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1098 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1099 (gdb-resync)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1100 (error "Phase error in gdb-prompt (got %s)" sink))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1101 (let ((input (gdb-dequeue-input)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1102 (if input
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1103 (gdb-send-item input)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1104 (progn
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1105 (setq gdb-prompting t)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1106 (gud-display-frame)))))
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 (defun gdb-subprompt (ignored)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1109 "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
1110 (setq gdb-prompting t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1111
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1112 (defun gdb-starting (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1113 "An annotation handler for `starting'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1114 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
1115 not GDB."
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1116 (setq gdb-active-process t)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1117 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1118 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1119 ((eq sink 'user)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1120 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1121 (setq gud-running t)
54729
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
1122 (if gdb-use-inferior-io-buffer
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1123 (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
1124 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1125 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1126 (error "Unexpected `starting' annotation")))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1127
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1128 (defun gdb-stopping (ignored)
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1129 "An annotation handler for `breakpoint' and other annotations.
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1130 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
1131 being debugged."
54729
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
1132 (if gdb-use-inferior-io-buffer
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1133 (let ((sink gdb-output-sink))
54729
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
1134 (cond
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
1135 ((eq sink 'inferior)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1136 (setq gdb-output-sink 'user))
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1137 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1138 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1139 (error "Unexpected stopping annotation"))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1140
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1141 (defun gdb-exited (ignored)
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1142 "An annotation handler for `exited' and `signalled'.
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1143 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
1144 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
1145 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
1146 directives."
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1147 (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
1148 (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
1149 (setq gdb-overlay-arrow-position nil)
61896
e8b38798dd7b (gdb-active-process): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 61870
diff changeset
1150 (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
1151
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1152 (defun gdb-frame-begin (ignored)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1153 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1154 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1155 ((eq sink 'inferior)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1156 (setq gdb-output-sink 'user))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1157 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1158 ((eq sink 'emacs) t)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1159 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1160 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1161 (error "Unexpected frame-begin annotation (%S)" sink)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1162
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1163 (defun gdb-stopped (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1164 "An annotation handler for `stopped'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1165 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
1166 sink to `user' in `gdb-stopping', that is fine."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1167 (setq gud-running nil)
67164
c3990f178905 (gdb-stopped): Detect process when attaching.
Nick Roberts <nickrob@snap.net.nz>
parents: 67147
diff changeset
1168 (setq gdb-active-process t)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1169 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1170 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1171 ((eq sink 'inferior)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1172 (setq gdb-output-sink 'user))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1173 ((eq sink 'user) t)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1174 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1175 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1176 (error "Unexpected stopped annotation")))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1177
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1178 (defun gdb-error (ignored)
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1179 (setq gdb-error (not gdb-error)))
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1180
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1181 (defun gdb-post-prompt (ignored)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1182 "An annotation handler for `post-prompt'.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1183 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
1184 happens to be appropriate."
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1185 ;; Don't add to queue if there outstanding items or GDB is not known yet.
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1186 (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
1187 (gdb-get-selected-frame)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1188 (gdb-invalidate-frames)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1189 (gdb-invalidate-breakpoints)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1190 ;; Do this through gdb-get-selected-frame -> gdb-frame-handler
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1191 ;; so gdb-frame-address is updated.
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1192 ;; (gdb-invalidate-assembler)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1193
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1194 (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
1195 (gdb-invalidate-registers)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1196 (gdb-get-changed-registers)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1197 (gdb-invalidate-registers-1))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1198
63358
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1199 (gdb-invalidate-memory)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1200 (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
1201 (gdb-invalidate-locals)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1202 (gdb-invalidate-locals-1))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1203
63358
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1204 (gdb-invalidate-threads)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1205 (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
1206 ;; 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
1207 ;; 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
1208 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1209 (setq gdb-var-changed t) ; force update
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1210 (dolist (var gdb-var-list)
7d3302b1aa9b (gdb-registers-mode): Let gdbmi use
Nick Roberts <nickrob@snap.net.nz>
parents: 63033
diff changeset
1211 (setcar (nthcdr 5 var) nil))
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1212 (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
1213 (gdb-var-update)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1214 (gdb-var-update-1)))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1215 (setq gdb-first-post-prompt nil)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1216 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1217 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1218 ((eq sink 'user) t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1219 ((eq sink 'pre-emacs)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1220 (setq gdb-output-sink 'emacs))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1221 (t
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1222 (gdb-resync)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1223 (error "Phase error in gdb-post-prompt (got %s)" sink)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1224
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1225 (defun gud-gdba-marker-filter (string)
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1226 "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
1227 (if gdb-flush-pending-output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1228 nil
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1229 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1230 ;; 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
1231 (setq gud-marker-acc (concat gud-marker-acc string))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1232 ;; 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
1233 (let ((output ""))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1234 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1235 ;; 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
1236 (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
1237 (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
1238 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1239 ;; 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
1240 ;; 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
1241 ;; elsewhere.
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1242 (setq output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1243 (gdb-concat-output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1244 output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1245 (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
1246 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1247 ;; 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
1248 (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
1249 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1250 ;; 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
1251 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1252 (let* ((annotation-type (match-string 1 annotation))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1253 (annotation-arguments (match-string 2 annotation))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1254 (annotation-rule (assoc annotation-type
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1255 gdb-annotation-rules)))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1256 ;; Call the handler for this annotation.
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1257 (if annotation-rule
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1258 (funcall (car (cdr annotation-rule))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1259 annotation-arguments)
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1260 ;; 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
1261 ;; 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
1262 ;; us to blow up.
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1263 ))))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1264 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1265 ;; 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
1266 ;; 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
1267 (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
1268 gud-marker-acc)
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1269 (progn
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1270 ;; 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
1271 (setq output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1272 (gdb-concat-output output
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1273 (substring gud-marker-acc 0
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1274 (match-beginning 0))))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1275 ;;
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1276 ;; 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
1277 (setq gud-marker-acc (substring gud-marker-acc
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1278 (match-beginning 0))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1279 ;;
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1280 ;; 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
1281 (progn
58431
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1282 (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
1283 (setq gud-marker-acc "")))
da65edef151e (gdb-flush-pending-output): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 58420
diff changeset
1284 output)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1285
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1286 (defun gdb-concat-output (so-far new)
63653
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1287 (if gdb-error
ec766f32b118 (gdb-error): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 63443
diff changeset
1288 (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
1289 (let ((sink gdb-output-sink))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1290 (cond
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1291 ((eq sink 'user) (concat so-far new))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1292 ((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
1293 ((eq sink 'emacs)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1294 (gdb-append-to-partial-output new)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1295 so-far)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1296 ((eq sink 'inferior)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1297 (gdb-append-to-inferior-io new)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1298 so-far)
58420
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1299 (t
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1300 (gdb-resync)
97e4fc5c7297 (gdb-resync): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 58049
diff changeset
1301 (error "Bogon output sink %S" sink)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1302
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1303 (defun gdb-append-to-partial-output (string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1304 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1305 (goto-char (point-max))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1306 (insert string)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1307
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1308 (defun gdb-clear-partial-output ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1309 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1310 (erase-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1311
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1312 (defun gdb-append-to-inferior-io (string)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1313 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1314 (goto-char (point-max))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1315 (insert-before-markers string))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1316 (if (not (string-equal string ""))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1317 (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1318
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1319 (defun gdb-clear-inferior-io ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1320 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1321 (erase-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1322
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1323
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1324 ;; 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
1325 ;; 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
1326 ;; type.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1327 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1328 ;; 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
1329 ;; 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
1330 ;; behind the user's back.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1331 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1332 ;; The output phasing associated with the variable gdb-output-sink
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1333 ;; help us to run commands behind the user's back.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1334 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1335 ;; 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
1336 ;; command.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1337 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1338
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1339 ;; 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
1340 ;; 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
1341 ;; 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
1342 ;; might have changed it's output.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1343 ;;
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1344 ;; 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
1345 ;; 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
1346 ;; 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
1347
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1348 (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
1349 output-handler)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1350 `(defun ,name (&optional ignored)
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
1351 (if (and ,demand-predicate
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1352 (not (member ',name
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1353 gdb-pending-triggers)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1354 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1355 (gdb-enqueue-input
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1356 (list ,gdb-command ',output-handler))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1357 (push ',name gdb-pending-triggers)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1358
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1359 (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
1360 `(defun ,name ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1361 (setq gdb-pending-triggers
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1362 (delq ',trigger
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1363 gdb-pending-triggers))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1364 (let ((buf (gdb-get-buffer ',buf-key)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1365 (and buf
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1366 (with-current-buffer buf
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
1367 (let* ((window (get-buffer-window buf 0))
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
1368 (p (window-point window))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1369 (buffer-read-only nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1370 (erase-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1371 (insert-buffer-substring (gdb-get-create-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1372 'gdb-partial-output-buffer))
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
1373 (set-window-point window p)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1374 ;; put customisation here
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1375 (,custom-defun)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1376
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1377 (defmacro def-gdb-auto-updated-buffer (buffer-key
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1378 trigger-name gdb-command
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1379 output-handler-name custom-defun)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1380 `(progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1381 (def-gdb-auto-update-trigger ,trigger-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1382 ;; The demand predicate:
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
1383 (gdb-get-buffer ',buffer-key)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1384 ,gdb-command
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1385 ,output-handler-name)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1386 (def-gdb-auto-update-handler ,output-handler-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1387 ,trigger-name ,buffer-key ,custom-defun)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1388
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1389
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1390 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1391 ;; Breakpoint buffer : This displays the output of `info breakpoints'.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1392 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1393 (gdb-set-buffer-rules 'gdb-breakpoints-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1394 'gdb-breakpoints-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1395 'gdb-breakpoints-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1396
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1397 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1398 ;; This defines the auto update rule for buffers of type
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1399 ;; `gdb-breakpoints-buffer'.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1400 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1401 ;; 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
1402 ;; handles the `foo-invalidated' message. That function is called:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1403 gdb-invalidate-breakpoints
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1404 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1405 ;; To update the buffer, this command is sent to gdb.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1406 "server info breakpoints\n"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1407 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1408 ;; 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
1409 ;; 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
1410 ;; the appropriately typed buffer. That function will be called:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1411 gdb-info-breakpoints-handler
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1412 ;; buffer specific functions
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1413 gdb-info-breakpoints-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1414
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1415 (defconst breakpoint-xpm-data
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1416 "/* XPM */
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1417 static char *magick[] = {
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1418 /* columns rows colors chars-per-pixel */
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1419 \"10 10 2 1\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1420 \" c red\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1421 \"+ c None\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1422 /* pixels */
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1423 \"+++ +++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1424 \"++ ++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1425 \"+ +\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1426 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1427 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1428 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1429 \" \",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1430 \"+ +\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1431 \"++ ++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1432 \"+++ +++\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1433 };"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1434 "XPM data used for breakpoint icon.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1435
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1436 (defconst breakpoint-enabled-pbm-data
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1437 "P1
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1438 10 10\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1439 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
1440 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
1441 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
1442 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
1443 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
1444 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
1445 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
1446 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
1447 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
1448 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
1449 "PBM data used for enabled breakpoint icon.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1450
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1451 (defconst breakpoint-disabled-pbm-data
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1452 "P1
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1453 10 10\",
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1454 0 0 1 0 1 0 1 0 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1455 0 1 0 1 0 1 0 1 0 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1456 1 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1457 0 1 0 1 0 1 0 1 0 1
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1458 1 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1459 0 1 0 1 0 1 0 1 0 1
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1460 1 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1461 0 1 0 1 0 1 0 1 0 1
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1462 0 0 1 0 1 0 1 0 1 0
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1463 0 0 0 1 0 1 0 1 0 0"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1464 "PBM data used for disabled breakpoint icon.")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1465
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1466 (defvar breakpoint-enabled-icon nil
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1467 "Icon for enabled breakpoint in display margin.")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1468
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1469 (defvar breakpoint-disabled-icon nil
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
1470 "Icon for disabled breakpoint in display margin.")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1471
57262
df4b0ff293d8 (breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents: 56330
diff changeset
1472 ;; 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
1473 (and (display-images-p)
641cb7192482 Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents: 57851
diff changeset
1474 (define-fringe-bitmap 'breakpoint
641cb7192482 Don't call define-fringe-bitmap if the display doesn't support images.
Eli Zaretskii <eliz@gnu.org>
parents: 57851
diff changeset
1475 "\x3c\x7e\xff\xff\xff\xff\x7e\x3c"))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1476
60760
a706fe4203bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents: 60541
diff changeset
1477 (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
1478 '((t
88ef15014617 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents: 60839
diff changeset
1479 :foreground "red"
88ef15014617 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents: 60839
diff changeset
1480 :weight bold))
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1481 "Face for enabled breakpoint icon in fringe."
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1482 :group 'gud)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1483
60760
a706fe4203bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents: 60541
diff changeset
1484 (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
1485 ;; 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
1486 ;; 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
1487 ;; if it has to be approximated.
60869
88ef15014617 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents: 60839
diff changeset
1488 '((((background dark)) :foreground "grey60")
88ef15014617 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-204
Miles Bader <miles@gnu.org>
parents: 60839
diff changeset
1489 (((background light)) :foreground "grey40"))
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1490 "Face for disabled breakpoint icon in fringe."
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
1491 :group 'gud)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1492
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1493 ;; 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
1494 (defun gdb-info-breakpoints-custom ()
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1495 (let ((flag) (bptno))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1496 ;; 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
1497 (dolist (buffer (buffer-list))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1498 (with-current-buffer buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1499 (if (and (eq gud-minor-mode 'gdba)
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1500 (not (string-match "\\`\\*.+\\*\\'" (buffer-name))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1501 (gdb-remove-breakpoint-icons (point-min) (point-max)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1502 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1503 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1504 (goto-char (point-min))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1505 (while (< (point) (- (point-max) 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1506 (forward-line 1)
62936
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
1507 (if (looking-at "[^\t].*?breakpoint")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1508 (progn
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1509 (looking-at "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)")
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1510 (setq bptno (match-string 1))
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1511 (setq flag (char-after (match-beginning 2)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1512 (beginning-of-line)
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1513 (if (re-search-forward " in \\(.*\\) at\\s-+" nil t)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1514 (progn
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1515 (let ((buffer-read-only nil))
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1516 (add-text-properties (match-beginning 1) (match-end 1)
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1517 '(face font-lock-function-name-face)))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1518 (looking-at "\\(\\S-+\\):\\([0-9]+\\)")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1519 (let ((line (match-string 2)) (buffer-read-only nil)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1520 (file (match-string 1)))
62614
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
1521 (add-text-properties (line-beginning-position)
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
1522 (line-end-position)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1523 '(mouse-face highlight
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1524 help-echo "mouse-2, RET: visit breakpoint"))
59988
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
1525 (unless (file-exists-p file)
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1526 (setq file (cdr (assoc bptno gdb-location-alist))))
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1527 (if (and file
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1528 (not (string-equal file "File not found")))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1529 (with-current-buffer
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1530 (find-file-noselect file 'nowarn)
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1531 (set (make-local-variable 'gud-minor-mode)
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1532 'gdba)
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1533 (set (make-local-variable 'tool-bar-map)
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1534 gud-tool-bar-map)
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1535 ;; Only want one breakpoint icon at each
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1536 ;; location.
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1537 (save-excursion
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1538 (goto-line (string-to-number line))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1539 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1540 (gdb-enqueue-input
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1541 (list
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1542 (concat gdb-server-prefix "list "
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1543 (match-string-no-properties 1) ":1\n")
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1544 'ignore))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1545 (gdb-enqueue-input
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1546 (list (concat gdb-server-prefix "info source\n")
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1547 `(lambda () (gdb-get-location
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
1548 ,bptno ,line ,flag))))))))))
54962
c3272c09f927 (gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents: 54901
diff changeset
1549 (end-of-line)))))
c3272c09f927 (gdb-goto-info): Require 'info.
Nick Roberts <nickrob@snap.net.nz>
parents: 54901
diff changeset
1550 (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
1551
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1552 (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
1553 "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
1554 (interactive "e")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1555 (mouse-minibuffer-check event)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1556 (let ((posn (event-end event)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1557 (if (numberp (posn-point posn))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1558 (with-selected-window (posn-window posn)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1559 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1560 (goto-char (posn-point posn))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1561 (if (or (posn-object posn)
57262
df4b0ff293d8 (breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents: 56330
diff changeset
1562 (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
1563 'breakpoint))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1564 (gud-remove nil)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1565 (gud-break nil)))))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1566
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1567 (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
1568 "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
1569 (interactive "e")
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1570 (mouse-minibuffer-check event)
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1571 (let ((posn (event-end event)))
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1572 (if (numberp (posn-point posn))
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1573 (with-selected-window (posn-window posn)
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1574 (save-excursion
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1575 (goto-char (posn-point posn))
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
1576 (if (posn-object posn)
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1577 (gdb-enqueue-input
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1578 (list
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1579 (let ((bptno (get-text-property
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1580 0 'gdb-bptno (car (posn-string posn)))))
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1581 (concat gdb-server-prefix
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1582 (if (get-text-property
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1583 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
1584 "disable "
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1585 "enable ")
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1586 bptno "\n"))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1587 'ignore))))))))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1588
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1589 (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
1590 "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
1591 (interactive "e")
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1592 (mouse-minibuffer-check event)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1593 (let* ((posn (event-end event))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1594 (pos (posn-point posn))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1595 obj)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1596 (when (numberp pos)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1597 (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
1598 (save-excursion
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1599 (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
1600 (goto-char pos)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1601 (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
1602 (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
1603 (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
1604 (when (stringp obj)
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1605 (gdb-enqueue-input
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1606 (list
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1607 (concat gdb-server-prefix
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1608 (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
1609 "disable "
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1610 "enable ")
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
1611 (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
1612 'ignore))))))))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1613
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1614 (defun gdb-breakpoints-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1615 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1616 (concat "*breakpoints of " (gdb-get-target-string) "*")))
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 (defun gdb-display-breakpoints-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1619 "Display status of user-settable breakpoints."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1620 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1621 (gdb-display-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1622 (gdb-get-create-buffer 'gdb-breakpoints-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1623
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1624 (defun gdb-frame-breakpoints-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1625 "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
1626 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
1627 (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
1628 (special-display-frame-alist gdb-frame-parameters))
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
1629 (display-buffer (gdb-get-create-buffer 'gdb-breakpoints-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1630
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1631 (defvar gdb-breakpoints-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1632 (let ((map (make-sparse-keymap))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1633 (menu (make-sparse-keymap "Breakpoints")))
60946
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
1634 (define-key menu [quit] '("Quit" . kill-this-buffer))
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
1635 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1636 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint))
60946
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
1637 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1638 (suppress-keymap map)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1639 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1640 (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
1641 (define-key map "D" 'gdb-delete-breakpoint)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
1642 (define-key map "q" 'kill-this-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1643 (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
1644 (define-key map [mouse-2] 'gdb-goto-breakpoint)
60946
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
1645 (define-key map [follow-link] 'mouse-face)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1646 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1647
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1648 (defun gdb-breakpoints-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1649 "Major mode for gdb breakpoints.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1650
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1651 \\{gdb-breakpoints-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1652 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1653 (setq major-mode 'gdb-breakpoints-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1654 (setq mode-name "Breakpoints")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1655 (use-local-map gdb-breakpoints-mode-map)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1656 (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
1657 (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
1658 (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
1659 'gdb-invalidate-breakpoints
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1660 'gdbmi-invalidate-breakpoints))
54538
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 (defun gdb-toggle-breakpoint ()
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
1663 "Enable/disable breakpoint at current line."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1664 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1665 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1666 (beginning-of-line 1)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
1667 (if (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
62884
ab597e7c8a07 (gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents: 62867
diff changeset
1668 (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)\\s-+")
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1669 (looking-at
62884
ab597e7c8a07 (gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents: 62867
diff changeset
1670 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)\\s-+\\S-+\\s-+\\S-+:[0-9]+"))
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1671 (gdb-enqueue-input
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1672 (list
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1673 (concat gdb-server-prefix
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1674 (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
1675 "disable "
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1676 "enable ")
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1677 (match-string 1) "\n") 'ignore))
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1678 (error "Not recognized as break/watchpoint line"))))
54538
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 (defun gdb-delete-breakpoint ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1681 "Delete the breakpoint at current line."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1682 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1683 (beginning-of-line 1)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
1684 (if (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
62936
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
1685 (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)")
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1686 (looking-at
62936
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
1687 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\s-+\\S-+\\s-+\\S-+:[0-9]+"))
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1688 (gdb-enqueue-input
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1689 (list
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1690 (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
1691 (error "Not recognized as break/watchpoint line")))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1692
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
1693 (defun gdb-goto-breakpoint (&optional event)
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1694 "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
1695 (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
1696 (if event (posn-set-point (event-end event)))
66676
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
1697 ;; Hack to stop gdb-goto-breakpoint displaying in GUD buffer.
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
1698 (let ((window (get-buffer-window gud-comint-buffer)))
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
1699 (if window (save-selected-window (select-window window))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1700 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1701 (beginning-of-line 1)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
1702 (if (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
62936
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
1703 (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)")
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1704 (looking-at
62936
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
1705 "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+.\\s-+\\S-+\\s-+\
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
1706 \\(\\S-+\\):\\([0-9]+\\)"))
59988
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
1707 (let ((bptno (match-string 1))
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
1708 (file (match-string 2))
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
1709 (line (match-string 3)))
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1710 (save-selected-window
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
1711 (let* ((buf (find-file-noselect
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
1712 (if (file-exists-p file) file
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1713 (cdr (assoc bptno gdb-location-alist)))))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
1714 (window (display-buffer buf)))
56330
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1715 (with-current-buffer buf
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1716 (goto-line (string-to-number line))
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1717 (set-window-point window (point))))))
a76e88488fd7 (gdb-goto-breakpoint): String match more
Nick Roberts <nickrob@snap.net.nz>
parents: 56285
diff changeset
1718 (error "Not recognized as break/watchpoint line"))))
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
1719
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1720
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1721 ;; Frames buffer. This displays a perpetually correct bactracktrace
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1722 ;; (from the command `where').
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1723 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1724 ;; Alas, if your stack is deep, it is costly.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1725 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1726 (gdb-set-buffer-rules 'gdb-stack-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1727 'gdb-stack-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1728 'gdb-frames-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1729
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1730 (def-gdb-auto-updated-buffer gdb-stack-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1731 gdb-invalidate-frames
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1732 "server where\n"
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1733 gdb-info-frames-handler
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1734 gdb-info-frames-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1735
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1736 (defun gdb-info-frames-custom ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1737 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1738 (save-excursion
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1739 (let ((buffer-read-only nil)
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1740 bl el)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1741 (goto-char (point-min))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1742 (while (< (point) (point-max))
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1743 (setq bl (line-beginning-position)
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1744 el (line-end-position))
67096
ca31f8486563 (gdb-speedbar-auto-raise): New function and variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67077
diff changeset
1745 (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
1746 (add-text-properties bl el
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
1747 '(mouse-face highlight
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
1748 help-echo "mouse-2, RET: Select frame")))
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1749 (goto-char bl)
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1750 (when (looking-at "^#\\([0-9]+\\)")
65861
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1751 (when (string-equal (match-string 1) gdb-frame-number)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1752 (put-text-property bl (+ bl 4)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1753 'face '(:inverse-video t)))
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1754 (when (re-search-forward
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1755 (concat
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1756 (if (string-equal (match-string 1) "0") "" " in ")
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1757 "\\([^ ]+\\) (") el t)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1758 (put-text-property (match-beginning 1) (match-end 1)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1759 'face font-lock-function-name-face)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1760 (setq bl (match-end 0))
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1761 (while (re-search-forward "<\\([^>]+\\)>" el t)
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1762 (put-text-property (match-beginning 1) (match-end 1)
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1763 'face font-lock-function-name-face))
65861
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1764 (goto-char bl)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1765 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1766 (put-text-property (match-beginning 1) (match-end 1)
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1767 'face font-lock-variable-name-face))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1768 (forward-line 1))))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1769
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1770 (defun gdb-stack-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1771 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1772 (concat "*stack frames of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1773
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1774 (defun gdb-display-stack-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1775 "Display backtrace of current stack."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1776 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1777 (gdb-display-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1778 (gdb-get-create-buffer 'gdb-stack-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1779
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1780 (defun gdb-frame-stack-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1781 "Display backtrace of current stack in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1782 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
1783 (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
1784 (special-display-frame-alist gdb-frame-parameters))
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
1785 (display-buffer (gdb-get-create-buffer 'gdb-stack-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1786
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1787 (defvar gdb-frames-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1788 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1789 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
1790 (define-key map "q" 'kill-this-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1791 (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
1792 (define-key map [mouse-2] 'gdb-frames-select)
60946
a44ce059d2d1 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 60869
diff changeset
1793 (define-key map [follow-link] 'mouse-face)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1794 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1795
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1796 (defun gdb-frames-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1797 "Major mode for gdb frames.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1798
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1799 \\{gdb-frames-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1800 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1801 (setq major-mode 'gdb-frames-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1802 (setq mode-name "Frames")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1803 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1804 (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
1805 (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
1806 (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
1807 'gdb-invalidate-frames
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1808 'gdbmi-invalidate-frames))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1809
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1810 (defun gdb-get-frame-number ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1811 (save-excursion
65861
8063c9277e58 (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65859
diff changeset
1812 (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
1813 (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
1814 (pos (re-search-backward "^#*\\([0-9]+\\)" start t))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1815 (n (or (and pos (match-string-no-properties 1)) "0")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1816 n)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1817
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
1818 (defun gdb-frames-select (&optional event)
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1819 "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
1820 (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
1821 (if event (posn-set-point (event-end event)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1822 (gdb-enqueue-input
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1823 (list (concat gdb-server-prefix "frame "
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
1824 (gdb-get-frame-number) "\n") 'ignore))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1825 (gud-display-frame))
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
1826
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1827
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1828 ;; Threads buffer. This displays a selectable thread list.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1829 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1830 (gdb-set-buffer-rules 'gdb-threads-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1831 'gdb-threads-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1832 'gdb-threads-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1833
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1834 (def-gdb-auto-updated-buffer gdb-threads-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1835 gdb-invalidate-threads
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1836 (concat gdb-server-prefix "info threads\n")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1837 gdb-info-threads-handler
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1838 gdb-info-threads-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1839
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1840 (defun gdb-info-threads-custom ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1841 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1842 (let ((buffer-read-only nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1843 (goto-char (point-min))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1844 (while (< (point) (point-max))
66637
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
1845 (unless (looking-at "No ")
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
1846 (add-text-properties (line-beginning-position) (line-end-position)
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
1847 '(mouse-face highlight
7567f8b4780e (gdb-mouse-until): Make it work in the disassembly buffer too.
Nick Roberts <nickrob@snap.net.nz>
parents: 66582
diff changeset
1848 help-echo "mouse-2, RET: select thread")))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1849 (forward-line 1)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1850
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1851 (defun gdb-threads-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1852 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1853 (concat "*threads of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1854
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1855 (defun gdb-display-threads-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1856 "Display IDs of currently known threads."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1857 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1858 (gdb-display-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1859 (gdb-get-create-buffer 'gdb-threads-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1860
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1861 (defun gdb-frame-threads-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1862 "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
1863 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
1864 (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
1865 (special-display-frame-alist gdb-frame-parameters))
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
1866 (display-buffer (gdb-get-create-buffer 'gdb-threads-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1867
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1868 (defvar gdb-threads-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1869 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1870 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
1871 (define-key map "q" 'kill-this-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1872 (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
1873 (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
1874 (define-key map [follow-link] 'mouse-face)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1875 map))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1876
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1877 (defvar gdb-threads-font-lock-keywords
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1878 '(
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1879 (") +\\([^ ]+\\) (" (1 font-lock-function-name-face))
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1880 ("in \\([^ ]+\\) (" (1 font-lock-function-name-face))
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1881 ("\\(\\(\\sw\\|[_.]\\)+\\)=" (1 font-lock-variable-name-face))
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1882 )
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
1883 "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
1884
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1885 (defun gdb-threads-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1886 "Major mode for gdb frames.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1887
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
1888 \\{gdb-threads-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1889 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1890 (setq major-mode 'gdb-threads-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1891 (setq mode-name "Threads")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1892 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1893 (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
1894 (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
1895 '(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
1896 (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
1897 'gdb-invalidate-threads)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1898
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1899 (defun gdb-get-thread-number ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1900 (save-excursion
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1901 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1902 (match-string-no-properties 1)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1903
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
1904 (defun gdb-threads-select (&optional event)
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1905 "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
1906 (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
1907 (if event (posn-set-point (event-end event)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1908 (gdb-enqueue-input
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1909 (list (concat gdb-server-prefix "thread "
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1910 (gdb-get-thread-number) "\n") 'ignore))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1911 (gud-display-frame))
59708
9ce7d8f69f2c (gdb-goto-breakpoint, gdb-frames-select)
Nick Roberts <nickrob@snap.net.nz>
parents: 59635
diff changeset
1912
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1913
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1914 ;; Registers buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1915 ;;
62826
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1916 (defcustom gdb-all-registers nil
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1917 "Non-nil means include floating-point registers."
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1918 :type 'boolean
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1919 :group 'gud
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1920 :version "22.1")
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1921
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1922 (gdb-set-buffer-rules 'gdb-registers-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1923 'gdb-registers-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1924 'gdb-registers-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1925
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1926 (def-gdb-auto-updated-buffer gdb-registers-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1927 gdb-invalidate-registers
62826
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1928 (concat
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
1929 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
1930 gdb-info-registers-handler
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1931 gdb-info-registers-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1932
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
1933 (defun gdb-info-registers-custom ()
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
1934 (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
1935 (save-excursion
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
1936 (let ((buffer-read-only nil)
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1937 start end)
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
1938 (goto-char (point-min))
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
1939 (while (< (point) (point-max))
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1940 (setq start (line-beginning-position))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1941 (setq end (line-end-position))
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
1942 (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
1943 (unless (string-equal (match-string 0) "The")
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1944 (put-text-property start (match-end 0)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1945 'face font-lock-variable-name-face)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1946 (add-text-properties start end
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1947 '(help-echo "mouse-2: edit value"
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1948 mouse-face highlight))))
66554
ba2cdafde956 (gdb-tooltip-print-1): Fix regexp.
Nick Roberts <nickrob@snap.net.nz>
parents: 66456
diff changeset
1949 (forward-line 1))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1950
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1951 (defun gdb-edit-register-value (&optional event)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1952 (interactive (list last-input-event))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1953 (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
1954 (if event (posn-set-point (event-end event)))
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1955 (beginning-of-line)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1956 (let* ((register (current-word))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1957 (value (read-string (format "New value (%s): " register))))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1958 (gdb-enqueue-input
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1959 (list (concat gdb-server-prefix "set $" register "=" value "\n")
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1960 'ignore)))))
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1961
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1962 (defvar gdb-registers-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1963 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1964 (suppress-keymap map)
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1965 (define-key map "\r" 'gdb-edit-register-value)
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
1966 (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
1967 (define-key map " " 'gdb-all-registers)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
1968 (define-key map "q" 'kill-this-buffer)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
1969 map))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1970
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1971 (defun gdb-registers-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1972 "Major mode for gdb registers.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1973
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1974 \\{gdb-registers-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
1975 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1976 (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
1977 (setq mode-name "Registers")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1978 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1979 (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
1980 (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
1981 (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
1982 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1983 (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
1984 'gdb-invalidate-registers)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
1985 'gdb-invalidate-registers-1))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1986
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1987 (defun gdb-registers-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1988 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1989 (concat "*registers of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1990
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1991 (defun gdb-display-registers-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1992 "Display integer register contents."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1993 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1994 (gdb-display-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1995 (gdb-get-create-buffer 'gdb-registers-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1996
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1997 (defun gdb-frame-registers-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
1998 "Display integer register contents in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1999 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2000 (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
2001 (special-display-frame-alist gdb-frame-parameters))
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2002 (display-buffer (gdb-get-create-buffer 'gdb-registers-buffer))))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2003
67309
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
2004 (defun gdb-all-registers ()
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2005 "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
2006 (interactive)
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2007 (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
2008 (if gdb-all-registers
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2009 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2010 (setq gdb-all-registers nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2011 (with-current-buffer (gdb-get-create-buffer 'gdb-registers-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2012 (setq mode-name "Registers")))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2013 (setq gdb-all-registers t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2014 (with-current-buffer (gdb-get-create-buffer 'gdb-registers-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2015 (setq mode-name "Registers:All")))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2016 (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
2017 (if gdb-all-registers "en" "dis")))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2018 (gdb-invalidate-registers)))
62826
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2019
787677122f52 (gdb-all-registers): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62723
diff changeset
2020
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2021 ;; Memory buffer.
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2022 ;;
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2023 (defcustom gdb-memory-repeat-count 32
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2024 "Number of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2025 :type 'integer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2026 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2027 :version "22.1")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2028
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2029 (defcustom gdb-memory-format "x"
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2030 "Display format of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2031 :type '(choice (const :tag "Hexadecimal" "x")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2032 (const :tag "Signed decimal" "d")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2033 (const :tag "Unsigned decimal" "u")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2034 (const :tag "Octal" "o")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2035 (const :tag "Binary" "t"))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2036 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2037 :version "22.1")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2038
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2039 (defcustom gdb-memory-unit "w"
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2040 "Unit size of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2041 :type '(choice (const :tag "Byte" "b")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2042 (const :tag "Halfword" "h")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2043 (const :tag "Word" "w")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2044 (const :tag "Giant word" "g"))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2045 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2046 :version "22.1")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2047
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2048 (gdb-set-buffer-rules 'gdb-memory-buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2049 'gdb-memory-buffer-name
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2050 'gdb-memory-mode)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2051
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2052 (def-gdb-auto-updated-buffer gdb-memory-buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2053 gdb-invalidate-memory
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2054 (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
2055 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2056 gdb-read-memory-handler
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2057 gdb-read-memory-custom)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2058
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2059 (defun gdb-read-memory-custom ()
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2060 (save-excursion
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2061 (goto-char (point-min))
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2062 (if (looking-at "0x[[:xdigit:]]+")
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2063 (setq gdb-memory-address (match-string 0)))))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2064
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2065 (defvar gdb-memory-mode-map
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2066 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2067 (suppress-keymap map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2068 (define-key map "q" 'kill-this-buffer)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2069 map))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2070
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2071 (defun gdb-memory-set-address (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2072 "Set the start memory address."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2073 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2074 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2075 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2076 (let ((arg (read-from-minibuffer "Memory address: ")))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2077 (setq gdb-memory-address arg))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2078 (gdb-invalidate-memory)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2079
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2080 (defun gdb-memory-set-repeat-count (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2081 "Set the number of data items in memory window."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2082 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2083 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2084 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2085 (let* ((arg (read-from-minibuffer "Repeat count: "))
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2086 (count (string-to-number arg)))
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2087 (if (<= count 0)
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2088 (error "Positive numbers only")
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2089 (customize-set-variable 'gdb-memory-repeat-count count)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2090 (gdb-invalidate-memory)))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2091
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2092 (defun gdb-memory-format-binary ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2093 "Set the display format to binary."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2094 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2095 (customize-set-variable 'gdb-memory-format "t")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2096 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2097
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2098 (defun gdb-memory-format-octal ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2099 "Set the display format to octal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2100 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2101 (customize-set-variable 'gdb-memory-format "o")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2102 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2103
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2104 (defun gdb-memory-format-unsigned ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2105 "Set the display format to unsigned decimal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2106 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2107 (customize-set-variable 'gdb-memory-format "u")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2108 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2109
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2110 (defun gdb-memory-format-signed ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2111 "Set the display format to decimal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2112 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2113 (customize-set-variable 'gdb-memory-format "d")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2114 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2115
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2116 (defun gdb-memory-format-hexadecimal ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2117 "Set the display format to hexadecimal."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2118 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2119 (customize-set-variable 'gdb-memory-format "x")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2120 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2121
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2122 (defvar gdb-memory-format-map
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2123 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2124 (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
2125 map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2126 "Keymap to select format in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2127
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2128 (defvar gdb-memory-format-menu (make-sparse-keymap "Format")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2129 "Menu of display formats in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2130
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2131 (define-key gdb-memory-format-menu [binary]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2132 '(menu-item "Binary" gdb-memory-format-binary
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2133 :button (:radio . (equal gdb-memory-format "t"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2134 (define-key gdb-memory-format-menu [octal]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2135 '(menu-item "Octal" gdb-memory-format-octal
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2136 :button (:radio . (equal gdb-memory-format "o"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2137 (define-key gdb-memory-format-menu [unsigned]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2138 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2139 :button (:radio . (equal gdb-memory-format "u"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2140 (define-key gdb-memory-format-menu [signed]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2141 '(menu-item "Signed Decimal" gdb-memory-format-signed
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2142 :button (:radio . (equal gdb-memory-format "d"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2143 (define-key gdb-memory-format-menu [hexadecimal]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2144 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2145 :button (:radio . (equal gdb-memory-format "x"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2146
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2147 (defun gdb-memory-format-menu (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2148 (interactive "@e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2149 (x-popup-menu event gdb-memory-format-menu))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2150
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2151 (defun gdb-memory-format-menu-1 (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2152 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2153 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2154 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2155 (let* ((selection (gdb-memory-format-menu event))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2156 (binding (and selection (lookup-key gdb-memory-format-menu
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2157 (vector (car selection))))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2158 (if binding (call-interactively binding)))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2159
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2160 (defun gdb-memory-unit-giant ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2161 "Set the unit size to giant words (eight bytes)."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2162 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2163 (customize-set-variable 'gdb-memory-unit "g")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2164 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2165
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2166 (defun gdb-memory-unit-word ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2167 "Set the unit size to words (four bytes)."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2168 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2169 (customize-set-variable 'gdb-memory-unit "w")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2170 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2171
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2172 (defun gdb-memory-unit-halfword ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2173 "Set the unit size to halfwords (two bytes)."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2174 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2175 (customize-set-variable 'gdb-memory-unit "h")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2176 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2177
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2178 (defun gdb-memory-unit-byte ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2179 "Set the unit size to bytes."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2180 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2181 (customize-set-variable 'gdb-memory-unit "b")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2182 (gdb-invalidate-memory))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2183
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2184 (defvar gdb-memory-unit-map
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2185 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2186 (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
2187 map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2188 "Keymap to select units in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2189
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2190 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2191 "Menu of units in the header line.")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2192
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2193 (define-key gdb-memory-unit-menu [giantwords]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2194 '(menu-item "Giant words" gdb-memory-unit-giant
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2195 :button (:radio . (equal gdb-memory-unit "g"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2196 (define-key gdb-memory-unit-menu [words]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2197 '(menu-item "Words" gdb-memory-unit-word
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2198 :button (:radio . (equal gdb-memory-unit "w"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2199 (define-key gdb-memory-unit-menu [halfwords]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2200 '(menu-item "Halfwords" gdb-memory-unit-halfword
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2201 :button (:radio . (equal gdb-memory-unit "h"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2202 (define-key gdb-memory-unit-menu [bytes]
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2203 '(menu-item "Bytes" gdb-memory-unit-byte
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2204 :button (:radio . (equal gdb-memory-unit "b"))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2205
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2206 (defun gdb-memory-unit-menu (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2207 (interactive "@e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2208 (x-popup-menu event gdb-memory-unit-menu))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2209
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2210 (defun gdb-memory-unit-menu-1 (event)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2211 (interactive "e")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2212 (save-selected-window
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2213 (select-window (posn-window (event-start event)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2214 (let* ((selection (gdb-memory-unit-menu event))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2215 (binding (and selection (lookup-key gdb-memory-unit-menu
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2216 (vector (car selection))))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2217 (if binding (call-interactively binding)))))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2218
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2219 ;;from make-mode-line-mouse-map
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2220 (defun gdb-make-header-line-mouse-map (mouse function) "\
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2221 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
2222 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
2223 corresponding to the mode line clicked."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2224 (let ((map (make-sparse-keymap)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2225 (define-key map (vector 'header-line mouse) function)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2226 (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2227 map))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2228
65855
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2229 (defvar gdb-memory-font-lock-keywords
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2230 '(;; <__function.name+n>
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2231 ("<\\(\\(\\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
2232 )
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2233 "Font lock keywords used in `gdb-memory-mode'.")
97ab21c68453 2005-10-06 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 65231
diff changeset
2234
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2235 (defun gdb-memory-mode ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2236 "Major mode for examining memory.
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2237
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2238 \\{gdb-memory-mode-map}"
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2239 (kill-all-local-variables)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2240 (setq major-mode 'gdb-memory-mode)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2241 (setq mode-name "Memory")
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2242 (setq buffer-read-only t)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2243 (use-local-map gdb-memory-mode-map)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2244 (setq header-line-format
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2245 '(:eval
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2246 (concat
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2247 "Read address["
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2248 (propertize
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2249 "-"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2250 'face font-lock-warning-face
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2251 'help-echo "mouse-1: Decrement address"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2252 'mouse-face 'mode-line-highlight
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2253 'local-map
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2254 (gdb-make-header-line-mouse-map
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2255 'mouse-1
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2256 #'(lambda () (interactive)
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2257 (let ((gdb-memory-address
64654
c61eb15a6bfc Smarten comments.
Nick Roberts <nickrob@snap.net.nz>
parents: 64346
diff changeset
2258 ;; Let GDB do the arithmetic.
62867
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2259 (concat
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2260 gdb-memory-address " - "
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2261 (number-to-string
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2262 (* gdb-memory-repeat-count
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2263 (cond ((string= gdb-memory-unit "b") 1)
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2264 ((string= gdb-memory-unit "h") 2)
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2265 ((string= gdb-memory-unit "w") 4)
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2266 ((string= gdb-memory-unit "g") 8)))))))
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2267 (gdb-invalidate-memory)))))
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2268 "|"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2269 (propertize "+"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2270 'face font-lock-warning-face
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2271 'help-echo "mouse-1: Increment address"
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2272 'mouse-face 'mode-line-highlight
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2273 'local-map (gdb-make-header-line-mouse-map
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2274 'mouse-1
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2275 #'(lambda () (interactive)
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2276 (let ((gdb-memory-address nil))
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2277 (gdb-invalidate-memory)))))
366567a93053 (gdb-memory-set-repeat-count):
Nick Roberts <nickrob@snap.net.nz>
parents: 62845
diff changeset
2278 "]: "
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2279 (propertize gdb-memory-address
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2280 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2281 'help-echo "mouse-1: Set memory address"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2282 'mouse-face 'mode-line-highlight
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2283 'local-map (gdb-make-header-line-mouse-map
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2284 'mouse-1
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2285 #'gdb-memory-set-address))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2286 " Repeat Count: "
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2287 (propertize (number-to-string gdb-memory-repeat-count)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2288 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2289 'help-echo "mouse-1: Set repeat count"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2290 'mouse-face 'mode-line-highlight
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2291 'local-map (gdb-make-header-line-mouse-map
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2292 'mouse-1
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2293 #'gdb-memory-set-repeat-count))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2294 " Display Format: "
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2295 (propertize gdb-memory-format
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2296 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2297 'help-echo "mouse-3: Select display format"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2298 'mouse-face 'mode-line-highlight
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2299 'local-map gdb-memory-format-map)
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2300 " Unit Size: "
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2301 (propertize gdb-memory-unit
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2302 'face font-lock-warning-face
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2303 'help-echo "mouse-3: Select unit size"
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2304 'mouse-face 'mode-line-highlight
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2305 '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
2306 (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
2307 '(gdb-memory-font-lock-keywords))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2308 (run-mode-hooks 'gdb-memory-mode-hook)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2309 'gdb-invalidate-memory)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2310
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2311 (defun gdb-memory-buffer-name ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2312 (with-current-buffer gud-comint-buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2313 (concat "*memory of " (gdb-get-target-string) "*")))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2314
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2315 (defun gdb-display-memory-buffer ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2316 "Display memory contents."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2317 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2318 (gdb-display-buffer
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2319 (gdb-get-create-buffer 'gdb-memory-buffer)))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2320
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2321 (defun gdb-frame-memory-buffer ()
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2322 "Display memory contents in a new frame."
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2323 (interactive)
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2324 (let ((special-display-regexps (append special-display-regexps '(".*")))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2325 (special-display-frame-alist gdb-frame-parameters))
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2326 (display-buffer (gdb-get-create-buffer 'gdb-memory-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2327
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2328
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2329 ;; Locals buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2330 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2331 (gdb-set-buffer-rules 'gdb-locals-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2332 'gdb-locals-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2333 'gdb-locals-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2334
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2335 (def-gdb-auto-update-trigger gdb-invalidate-locals
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2336 (gdb-get-buffer 'gdb-locals-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2337 "server info locals\n"
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2338 gdb-info-locals-handler)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2339
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2340 (defvar gdb-locals-watch-map
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2341 (let ((map (make-sparse-keymap)))
67077
251a74c1f668 (gdb-locals-watch-keymap): Add "\r" binding to local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 67072
diff changeset
2342 (define-key map "\r" '(lambda () (interactive)
251a74c1f668 (gdb-locals-watch-keymap): Add "\r" binding to local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 67072
diff changeset
2343 (beginning-of-line)
251a74c1f668 (gdb-locals-watch-keymap): Add "\r" binding to local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 67072
diff changeset
2344 (gud-watch)))
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2345 (define-key map [mouse-2] '(lambda (event) (interactive "e")
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2346 (mouse-set-point event)
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2347 (beginning-of-line)
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2348 (gud-watch)))
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2349 map)
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2350 "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
2351
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2352 (defconst gdb-struct-string
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2353 (concat (propertize "[struct/union]"
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2354 'mouse-face 'highlight
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2355 '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
2356 '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
2357
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2358 (defconst gdb-array-string
67125
39c6d2fd1f63 (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 67111
diff changeset
2359 (concat " " (propertize "[array]"
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2360 'mouse-face 'highlight
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2361 '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
2362 '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
2363
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2364 ;; Abbreviate for arrays and structures.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2365 ;; 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
2366 (defun gdb-info-locals-handler ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2367 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2368 gdb-pending-triggers))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2369 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2370 (with-current-buffer buf
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2371 (goto-char (point-min))
62614
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
2372 (while (re-search-forward "^[ }].*\n" nil t)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2373 (replace-match "" nil nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2374 (goto-char (point-min))
62614
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
2375 (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
2376 (replace-match gdb-struct-string nil nil))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2377 (goto-char (point-min))
62614
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
2378 (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
2379 (replace-match gdb-array-string nil nil))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2380 (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2381 (and buf
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2382 (with-current-buffer buf
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2383 (let* ((window (get-buffer-window buf 0))
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2384 (p (window-point window))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2385 (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
2386 (erase-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2387 (insert-buffer-substring (gdb-get-create-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2388 'gdb-partial-output-buffer))
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2389 (set-window-point window p)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2390 (run-hooks 'gdb-info-locals-hook))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2391
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2392 (defvar gdb-locals-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2393 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2394 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2395 (define-key map "q" 'kill-this-buffer)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2396 map))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2397
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2398 (defun gdb-locals-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2399 "Major mode for gdb locals.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2400
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2401 \\{gdb-locals-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2402 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2403 (setq major-mode 'gdb-locals-mode)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2404 (setq mode-name (concat "Locals:" gdb-selected-frame))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2405 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2406 (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
2407 (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
2408 '(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
2409 (run-mode-hooks 'gdb-locals-mode-hook)
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
2410 (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
2411 (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
2412 'gdb-invalidate-locals
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2413 'gdb-invalidate-locals-1)
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2414 'gdbmi-invalidate-locals))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2415
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2416 (defun gdb-locals-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2417 (with-current-buffer gud-comint-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2418 (concat "*locals of " (gdb-get-target-string) "*")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2419
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2420 (defun gdb-display-locals-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2421 "Display local variables of current stack and their values."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2422 (interactive)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2423 (gdb-display-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2424 (gdb-get-create-buffer 'gdb-locals-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2425
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2426 (defun gdb-frame-locals-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2427 "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
2428 (interactive)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2429 (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
2430 (special-display-frame-alist gdb-frame-parameters))
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2431 (display-buffer (gdb-get-create-buffer 'gdb-locals-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2432
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2433
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2434 ;;;; Window management
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2435 (defun gdb-display-buffer (buf &optional size)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2436 (let ((answer (get-buffer-window buf 0))
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2437 (must-split nil))
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2438 (if answer
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2439 (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
2440 ;; The buffer is not yet displayed.
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2441 (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
2442 (let ((window (get-lru-window)))
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2443 (if (and window
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2444 (not (eq window (get-buffer-window gud-comint-buffer))))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2445 (progn
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2446 (set-window-buffer window buf)
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2447 (setq answer window))
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2448 (setq must-split t)))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2449 (if must-split
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2450 (let* ((largest (get-largest-window))
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2451 (cur-size (window-height largest))
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2452 (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
2453 (setq answer (split-window largest new-size))
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2454 (set-window-buffer answer buf)
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2455 (set-window-dedicated-p answer t)))
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2456 answer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2457
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2458
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2459 ;;; Shared keymap initialization:
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2460
59922
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2461 (let ((menu (make-sparse-keymap "GDB-Windows")))
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2462 (define-key gud-menu-map [displays]
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2463 `(menu-item "GDB-Windows" ,menu
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2464 :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
2465 (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
2466 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2467 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2468 (define-key menu [disassembly]
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2469 '("Disassembly" . gdb-display-assembler-buffer))
59922
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2470 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2471 (define-key menu [inferior]
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2472 '(menu-item "Inferior IO" gdb-display-inferior-io-buffer
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2473 :enable gdb-use-inferior-io-buffer))
59922
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2474 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer))
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2475 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer))
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
2476 (define-key menu [breakpoints]
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
2477 '("Breakpoints" . gdb-display-breakpoints-buffer)))
59922
79e9767b47c8 Update copyright. Put GDB-Frames before
Nick Roberts <nickrob@snap.net.nz>
parents: 59852
diff changeset
2478
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2479 (let ((menu (make-sparse-keymap "GDB-Frames")))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2480 (define-key gud-menu-map [frames]
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2481 `(menu-item "GDB-Frames" ,menu
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2482 :visible (memq gud-minor-mode '(gdbmi gdba))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2483 (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
2484 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
59808
37a65df00ab2 (gdb-memory-address)
Nick Roberts <nickrob@snap.net.nz>
parents: 59766
diff changeset
2485 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2486 (define-key menu [disassembly] '("Disassembiy" . gdb-frame-assembler-buffer))
55328
4440fe0e7dc6 (gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 55217
diff changeset
2487 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2488 (define-key menu [inferior]
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2489 '(menu-item "Inferior IO" gdb-frame-inferior-io-buffer
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2490 :enable gdb-use-inferior-io-buffer))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2491 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2492 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
2493 (define-key menu [breakpoints]
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
2494 '("Breakpoints" . gdb-frame-breakpoints-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2495
66886
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
2496 (let ((menu (make-sparse-keymap "GDB-UI/MI")))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2497 (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
2498 `(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
2499 ,menu :visible (memq gud-minor-mode '(gdbmi gdba))))
63443
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
2500 (define-key menu [gdb-use-inferior-io]
66582
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
2501 '(menu-item "Separate inferior IO" gdb-use-inferior-io-buffer
66886
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
2502 :visible (eq gud-minor-mode 'gdba)
66582
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
2503 :help "Toggle separate IO for inferior."
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
2504 :button (:toggle . gdb-use-inferior-io-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2505 (define-key menu [gdb-many-windows]
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2506 '(menu-item "Display Other Windows" gdb-many-windows
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2507 :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
2508 :button (:toggle . gdb-many-windows)))
63443
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
2509 (define-key menu [gdb-restore-windows]
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
2510 '(menu-item "Restore Window Layout" gdb-restore-windows
24c727190495 (gdb-tooltip-print): Respect
Nick Roberts <nickrob@snap.net.nz>
parents: 63358
diff changeset
2511 :help "Restore standard layout for debug session.")))
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2512
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2513 (defun gdb-frame-gdb-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2514 "Display GUD buffer in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2515 (interactive)
66676
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2516 (let ((special-display-regexps (append special-display-regexps '(".*")))
66681
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2517 (special-display-frame-alist gdb-frame-parameters)
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2518 (same-window-regexps nil))
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2519 (display-buffer gud-comint-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2520
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2521 (defun gdb-display-gdb-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2522 "Display GUD buffer."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2523 (interactive)
66681
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2524 (let ((same-window-regexps nil))
8c0e5dfc2c31 (gdb-buffer-type): Remove duplicate declaration.
Nick Roberts <nickrob@snap.net.nz>
parents: 66676
diff changeset
2525 (pop-to-buffer gud-comint-buffer)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2526
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2527 (defun gdb-set-window-buffer (name)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2528 (set-window-buffer (selected-window) (get-buffer name))
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2529 (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
2530
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2531 (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
2532 "Layout the window pattern for `gdb-many-windows'."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2533 (gdb-display-locals-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2534 (gdb-display-stack-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2535 (delete-other-windows)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2536 (gdb-display-breakpoints-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2537 (delete-other-windows)
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2538 ; Don't dedicate.
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2539 (pop-to-buffer gud-comint-buffer)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2540 (split-window nil ( / ( * (window-height) 3) 4))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2541 (split-window nil ( / (window-height) 3))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2542 (split-window-horizontally)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2543 (other-window 1)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2544 (gdb-set-window-buffer (gdb-locals-buffer-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2545 (other-window 1)
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2546 (switch-to-buffer
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2547 (if gud-last-last-frame
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2548 (gud-find-file (car gud-last-last-frame))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2549 (gud-find-file gdb-main-file)))
54729
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
2550 (when gdb-use-inferior-io-buffer
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
2551 (split-window-horizontally)
7bfccd78beed (gdb-use-inferior-io-buffer): New option.
Nick Roberts <nickrob@snap.net.nz>
parents: 54668
diff changeset
2552 (other-window 1)
61459
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2553 (gdb-set-window-buffer
c1538e237b52 (gdb-display-inferior-io-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 60946
diff changeset
2554 (gdb-get-create-buffer 'gdb-inferior-io)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2555 (other-window 1)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2556 (gdb-set-window-buffer (gdb-stack-buffer-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2557 (split-window-horizontally)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2558 (other-window 1)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2559 (gdb-set-window-buffer (gdb-breakpoints-buffer-name))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2560 (other-window 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2561
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2562 (defcustom gdb-many-windows nil
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2563 "Nil means just pop up the GUD buffer unless `gdb-show-main' is t.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2564 In this case it starts with two windows: one displaying the GUD
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2565 buffer and the other with the source file with the main routine
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2566 of the inferior. Non-nil means display the layout shown for
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2567 `gdba'."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2568 :type 'boolean
57851
67b88e92a24d (gdb-enable-debug-log)
Nick Roberts <nickrob@snap.net.nz>
parents: 57791
diff changeset
2569 :group 'gud
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59988
diff changeset
2570 :version "22.1")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2571
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2572 (defun gdb-many-windows (arg)
66582
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
2573 "Toggle the number of windows in the basic arrangement.
89dec7a16b7a (gdb-use-inferior-io-buffer): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 66577
diff changeset
2574 With arg, display additional buffers iff arg is positive."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2575 (interactive "P")
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2576 (setq gdb-many-windows
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2577 (if (null arg)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2578 (not gdb-many-windows)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2579 (> (prefix-numeric-value arg) 0)))
66577
8be29c332588 (gdb-many-windows): Leave window configuration
Nick Roberts <nickrob@snap.net.nz>
parents: 66554
diff changeset
2580 (if (and gud-comint-buffer
8be29c332588 (gdb-many-windows): Leave window configuration
Nick Roberts <nickrob@snap.net.nz>
parents: 66554
diff changeset
2581 (buffer-name gud-comint-buffer))
8be29c332588 (gdb-many-windows): Leave window configuration
Nick Roberts <nickrob@snap.net.nz>
parents: 66554
diff changeset
2582 (condition-case nil
8be29c332588 (gdb-many-windows): Leave window configuration
Nick Roberts <nickrob@snap.net.nz>
parents: 66554
diff changeset
2583 (gdb-restore-windows)
8be29c332588 (gdb-many-windows): Leave window configuration
Nick Roberts <nickrob@snap.net.nz>
parents: 66554
diff changeset
2584 (error nil))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2585
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2586 (defun gdb-restore-windows ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2587 "Restore the basic arrangement of windows used by gdba.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2588 This arrangement depends on the value of `gdb-many-windows'."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2589 (interactive)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2590 (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
2591 (delete-other-windows)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2592 (if gdb-many-windows
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2593 (gdb-setup-windows)
66676
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2594 (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
2595 (split-window)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2596 (other-window 1)
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2597 (switch-to-buffer
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2598 (if gud-last-last-frame
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2599 (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
2600 (gud-find-file gdb-main-file)))
ecdb869b880e (gud-watch): Use save-selected-window in
Nick Roberts <nickrob@snap.net.nz>
parents: 66637
diff changeset
2601 (other-window 1))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2602
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2603 (defun gdb-reset ()
57791
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2604 "Exit a debugging session cleanly.
d1b93fc4ce47 Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57664
diff changeset
2605 Kills the gdb buffers and resets the source buffers."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2606 (dolist (buffer (buffer-list))
55696
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2607 (unless (eq buffer gud-comint-buffer)
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2608 (with-current-buffer buffer
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2609 (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
2610 (if (string-match "\\`\\*.+\\*\\'" (buffer-name))
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2611 (kill-buffer nil)
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2612 (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
2613 (setq gud-minor-mode nil)
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
2614 (kill-local-variable 'tool-bar-map)
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2615 (kill-local-variable 'gdb-define-alist))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2616 (when (markerp gdb-overlay-arrow-position)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2617 (move-marker gdb-overlay-arrow-position nil)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2618 (setq gdb-overlay-arrow-position nil))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2619 (setq overlay-arrow-variable-list
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2620 (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2621 (setq gud-running nil)
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2622 (setq gdb-active-process nil)
67072
430a3ff7880b (gdb-locals-watch-keymap): New local map.
Nick Roberts <nickrob@snap.net.nz>
parents: 66977
diff changeset
2623 (setq gdb-var-list nil)
62050
9658387c7d01 (gdb-cpp-define-alist-program)
Nick Roberts <nickrob@snap.net.nz>
parents: 61896
diff changeset
2624 (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
2625
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2626 (defun gdb-source-info ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2627 "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
2628 buffers."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2629 (goto-char (point-min))
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2630 (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
2631 (looking-at "\\S-+"))
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2632 (setq gdb-main-file (match-string 0)))
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2633 (goto-char (point-min))
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2634 (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
2635 (setq gdb-macro-info t))
58534
c655bc81dfc0 (gdb-view-source, gdb-selected-view):
Nick Roberts <nickrob@snap.net.nz>
parents: 58521
diff changeset
2636 (if gdb-many-windows
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2637 (gdb-setup-windows)
59988
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2638 (gdb-get-create-buffer 'gdb-breakpoints-buffer)
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2639 (if gdb-show-main
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2640 (let ((pop-up-windows t))
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2641 (display-buffer (gud-find-file gdb-main-file))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2642
59988
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2643 (defun gdb-get-location (bptno line flag)
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2644 "Find the directory containing the relevant source file.
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2645 Put in buffer and place breakpoint icon."
fb52ec059049 (gdb-location-list): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59922
diff changeset
2646 (goto-char (point-min))
60326
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2647 (catch 'file-not-found
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2648 (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
2649 (when (looking-at "\\S-+")
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2650 (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
2651 (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
2652 (gdb-resync)
62202
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2653 (unless (assoc bptno gdb-location-alist)
327af4f748d5 (gdb-macro-info): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 62136
diff changeset
2654 (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
2655 (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
2656 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
2657 (throw 'file-not-found nil))
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2658 (with-current-buffer
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2659 (find-file-noselect (match-string 0))
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2660 (save-current-buffer
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2661 (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
2662 (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
2663 ;; 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
2664 (save-excursion
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2665 (goto-line (string-to-number line))
47c96976e43d (gdb-get-location): Use a warning instead
Nick Roberts <nickrob@snap.net.nz>
parents: 60153
diff changeset
2666 (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
2667
60073
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2668 (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
2669
6fba1da8f37e (gdb-find-file-unhook): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 59998
diff changeset
2670 (defun gdb-find-file-hook ()
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2671 "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
2672 of the current session."
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2673 (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
2674 ;; 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
2675 gud-comint-buffer
66726
04a53d446ab1 (gdb-var-create-handler, gdb-var-delete)
Nick Roberts <nickrob@snap.net.nz>
parents: 66681
diff changeset
2676 (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
2677 'gdba))
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
2678 (if (member buffer-file-name gdb-source-file-list)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
2679 (with-current-buffer (find-buffer-visiting buffer-file-name)
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
2680 (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
2681 (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
2682
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2683 ;;from put-image
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2684 (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
2685 "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
2686 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
2687 `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
2688 PUTSTRING."
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2689 (let ((string (make-string 1 ?x))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2690 (buffer (current-buffer)))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2691 (setq putstring (copy-sequence putstring))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2692 (let ((overlay (make-overlay pos pos buffer))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2693 (prop (or dprop
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2694 (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
2695 (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
2696 (if sprops
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2697 (add-text-properties 0 1 sprops string))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2698 (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
2699 (overlay-put overlay 'before-string string))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2700
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2701 ;;from remove-images
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2702 (defun gdb-remove-strings (start end &optional buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2703 "Remove strings between START and END in BUFFER.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2704 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
2705 BUFFER nil or omitted means use the current buffer."
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2706 (unless buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2707 (setq buffer (current-buffer)))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2708 (dolist (overlay (overlays-in start end))
61870
584906b2e6d5 (gdb-location-alist): Rename from
Nick Roberts <nickrob@snap.net.nz>
parents: 61494
diff changeset
2709 (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
2710 (delete-overlay overlay))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2711
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2712 (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
2713 (let ((start (- (line-beginning-position) 1))
dd9b63b29d80 (gdb-info-locals-handler): Make regexps
Nick Roberts <nickrob@snap.net.nz>
parents: 62202
diff changeset
2714 (end (+ (line-end-position) 1))
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
2715 (putstring (if enabled "B" "b"))
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
2716 (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
2717 (add-text-properties
66417
bec18a123c03 (gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents: 66412
diff changeset
2718 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
2719 putstring)
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2720 (if enabled
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2721 (add-text-properties
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2722 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
2723 (add-text-properties
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2724 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2725 (gdb-remove-breakpoint-icons start end)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2726 (if (display-images-p)
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
2727 (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
2728 (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
2729 gdb-buffer-fringe-width) 8)
54668
69a699e79a0d (gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents: 54617
diff changeset
2730 (gdb-put-string
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2731 nil (1+ start)
57262
df4b0ff293d8 (breakpoint): Define as fringe bitmap.
Kim F. Storm <storm@cua.dk>
parents: 56330
diff changeset
2732 `(left-fringe breakpoint
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2733 ,(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
2734 'breakpoint-enabled
66412
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2735 'breakpoint-disabled))
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2736 'gdb-bptno bptno
8438430a751a (gdb-ann3): Bind mouse-3 in left fringe
Kim F. Storm <storm@cua.dk>
parents: 66382
diff changeset
2737 'gdb-enabled enabled)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2738 (when (< left-margin-width 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2739 (save-current-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2740 (setq left-margin-width 2)
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
2741 (if source-window
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
2742 (set-window-margins
65859
398b39fb5c3f (gdb-fringe-width): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 65855
diff changeset
2743 source-window
55328
4440fe0e7dc6 (gud-watch, gdb-display-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 55217
diff changeset
2744 left-margin-width right-margin-width))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2745 (put-image
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2746 (if enabled
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2747 (or breakpoint-enabled-icon
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2748 (setq breakpoint-enabled-icon
54668
69a699e79a0d (gdb-view-source-function, gdb-view-assembler)
Nick Roberts <nickrob@snap.net.nz>
parents: 54617
diff changeset
2749 (find-image `((:type xpm :data
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2750 ,breakpoint-xpm-data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2751 :ascent 100 :pointer hand)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2752 (:type pbm :data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2753 ,breakpoint-enabled-pbm-data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2754 :ascent 100 :pointer hand)))))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2755 (or breakpoint-disabled-icon
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2756 (setq breakpoint-disabled-icon
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2757 (find-image `((:type xpm :data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2758 ,breakpoint-xpm-data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2759 :conversion disabled
66417
bec18a123c03 (gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents: 66412
diff changeset
2760 :ascent 100 :pointer hand)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2761 (:type pbm :data
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2762 ,breakpoint-disabled-pbm-data
66417
bec18a123c03 (gdb-put-breakpoint-icon): Correct help-echo.
Nick Roberts <nickrob@snap.net.nz>
parents: 66412
diff changeset
2763 :ascent 100 :pointer hand))))))
59617
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2764 (+ start 1)
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2765 putstring
4988bdf5db77 (gdb-put-string): Copy/create strings so
Nick Roberts <nickrob@snap.net.nz>
parents: 58534
diff changeset
2766 'left-margin))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2767 (when (< left-margin-width 2)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2768 (save-current-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2769 (setq left-margin-width 2)
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2770 (let ((window (get-buffer-window (current-buffer) 0)))
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2771 (if window
56285
313e3a9f34ca (breakpoint-enabled-bitmap-face)
Kim F. Storm <storm@cua.dk>
parents: 56258
diff changeset
2772 (set-window-margins
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2773 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
2774 (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
2775 (propertize putstring
a706fe4203bc Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-193
Miles Bader <miles@gnu.org>
parents: 60541
diff changeset
2776 '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
2777 (1+ start)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2778
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2779 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2780 (gdb-remove-strings start end)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2781 (if (display-images-p)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2782 (remove-images start end))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2783 (when remove-margin
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2784 (setq left-margin-width 0)
65973
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2785 (let ((window (get-buffer-window (current-buffer) 0)))
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2786 (if window
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2787 (set-window-margins
ae4953c24452 (gdba): Improve diagram.
Nick Roberts <nickrob@snap.net.nz>
parents: 65884
diff changeset
2788 window left-margin-width right-margin-width)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2789
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2790
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2791 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2792 ;; Assembler buffer.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2793 ;;
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2794 (gdb-set-buffer-rules 'gdb-assembler-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2795 'gdb-assembler-buffer-name
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2796 'gdb-assembler-mode)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2797
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2798 (def-gdb-auto-update-handler gdb-assembler-handler
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2799 gdb-invalidate-assembler
66456
885272126a8e (def-gdb-auto-updated-buffer)
Nick Roberts <nickrob@snap.net.nz>
parents: 66419
diff changeset
2800 gdb-assembler-buffer
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2801 gdb-assembler-custom)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2802
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2803 (defun gdb-assembler-custom ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2804 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
59766
8d2464efeb2e (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 59763
diff changeset
2805 (pos 1) (address) (flag) (bptno))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2806 (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
2807 (save-excursion
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2808 (if (not (equal gdb-frame-address "main"))
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2809 (progn
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2810 (goto-char (point-min))
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2811 (if (and gdb-frame-address
67309
ee8894ca3f64 (gdb-use-inferior-io-buffer, gdb-speedbar-auto-raise):
Nick Roberts <nickrob@snap.net.nz>
parents: 67233
diff changeset
2812 (search-forward gdb-frame-address nil t))
62845
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2813 (progn
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2814 (setq pos (point))
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2815 (beginning-of-line)
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2816 (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
2817 (setq gdb-overlay-arrow-position (make-marker)))
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2818 (set-marker gdb-overlay-arrow-position
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2819 (point) (current-buffer))))))
28ffa958559d (gdb-assembler-custom): Be more careful about preserving point.
Nick Roberts <nickrob@snap.net.nz>
parents: 62826
diff changeset
2820 ;; 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
2821 (gdb-remove-breakpoint-icons (point-min) (point-max))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2822 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2823 (goto-char (point-min))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2824 (while (< (point) (- (point-max) 1))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2825 (forward-line 1)
62936
d5d3c468d5c0 (gdb-set-gud-minor-mode-1)
Nick Roberts <nickrob@snap.net.nz>
parents: 62884
diff changeset
2826 (if (looking-at "[^\t].*?breakpoint")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2827 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2828 (looking-at
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2829 "\\([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
2830 (setq bptno (match-string 1))
8d2464efeb2e (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 59763
diff changeset
2831 (setq flag (char-after (match-beginning 2)))
8d2464efeb2e (gdb-info-breakpoints-custom)
Nick Roberts <nickrob@snap.net.nz>
parents: 59763
diff changeset
2832 (setq address (match-string 3))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2833 (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
2834 (save-excursion
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2835 (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
2836 (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
2837 (gdb-put-breakpoint-icon (eq flag ?y) bptno))))))))
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2838 (if (not (equal gdb-frame-address "main"))
66886
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
2839 (with-current-buffer buffer
10f616ac16f1 Remove face-alias left over from change on
Nick Roberts <nickrob@snap.net.nz>
parents: 66845
diff changeset
2840 (set-window-point (get-buffer-window buffer 0) pos)))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2841
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2842 (defvar gdb-assembler-mode-map
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2843 (let ((map (make-sparse-keymap)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2844 (suppress-keymap map)
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2845 (define-key map "q" 'kill-this-buffer)
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2846 map))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2847
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2848 (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
2849 '(;; <__function.name+n>
4d6eec4c1ef8 * progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents: 57661
diff changeset
2850 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
4d6eec4c1ef8 * progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords): Handle
Masatake YAMATO <jet@gyve.org>
parents: 57661
diff changeset
2851 (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
2852 ;; 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
2853 ("^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
2854 (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
2855 ;; %register(at least i386)
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2856 ("%\\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
2857 ("^\\(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
2858 (1 font-lock-comment-face)
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2859 (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
2860 ("^\\(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
2861 "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
2862
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2863 (defun gdb-assembler-mode ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2864 "Major mode for viewing code assembler.
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2865
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2866 \\{gdb-assembler-mode-map}"
57661
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2867 (kill-all-local-variables)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2868 (setq major-mode 'gdb-assembler-mode)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2869 (setq mode-name (concat "Machine:" gdb-selected-frame))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2870 (setq gdb-overlay-arrow-position nil)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2871 (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
2872 (setq fringes-outside-margins t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2873 (setq buffer-read-only t)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2874 (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
2875 (gdb-invalidate-assembler)
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2876 (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
2877 '(gdb-assembler-font-lock-keywords))
b59713cd72a2 (gdb-get-create-buffer): Allow modes to run
Nick Roberts <nickrob@snap.net.nz>
parents: 57350
diff changeset
2878 (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
2879 'gdb-invalidate-assembler)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2880
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2881 (defun gdb-assembler-buffer-name ()
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2882 (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
2883 (concat "*disassembly of " (gdb-get-target-string) "*")))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2884
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2885 (defun gdb-display-assembler-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2886 "Display disassembly view."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2887 (interactive)
62884
ab597e7c8a07 (gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents: 62867
diff changeset
2888 (setq gdb-previous-frame nil)
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2889 (gdb-display-buffer
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2890 (gdb-get-create-buffer 'gdb-assembler-buffer)))
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2891
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2892 (defun gdb-frame-assembler-buffer ()
55400
1aaa031e318c Improve/extend documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 55330
diff changeset
2893 "Display disassembly view in a new frame."
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2894 (interactive)
62884
ab597e7c8a07 (gdb-toggle-breakpoint): Make regexp more robust.
Nick Roberts <nickrob@snap.net.nz>
parents: 62867
diff changeset
2895 (setq gdb-previous-frame nil)
58521
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2896 (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
2897 (special-display-frame-alist gdb-frame-parameters))
54bb21951d18 (gdb-frame-parameters): Match height and
Nick Roberts <nickrob@snap.net.nz>
parents: 58485
diff changeset
2898 (display-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2899
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2900 ;; modified because if gdb-frame-address has changed value a new command
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2901 ;; 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
2902 (defun gdb-invalidate-assembler (&optional ignored)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2903 (if (gdb-get-buffer 'gdb-assembler-buffer)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2904 (progn
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2905 (unless (and gdb-selected-frame
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2906 (string-equal gdb-selected-frame gdb-previous-frame))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2907 (if (or (not (member 'gdb-invalidate-assembler
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2908 gdb-pending-triggers))
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2909 (not (string-equal gdb-frame-address
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2910 gdb-previous-frame-address)))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2911 (progn
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2912 ;; take previous disassemble command, if any, off the queue
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2913 (with-current-buffer gud-comint-buffer
58485
31d7630f91d4 (gdb-breakpoints-mode-map)
Nick Roberts <nickrob@snap.net.nz>
parents: 58470
diff changeset
2914 (let ((queue gdb-input-queue))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2915 (dolist (item queue)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2916 (if (equal (cdr item) '(gdb-assembler-handler))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2917 (setq gdb-input-queue
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2918 (delete item gdb-input-queue))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2919 (gdb-enqueue-input
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2920 (list
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2921 (concat gdb-server-prefix "disassemble "
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2922 (if (member gdb-frame-address '(nil "main")) nil "0x")
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2923 gdb-frame-address "\n")
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2924 'gdb-assembler-handler))
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2925 (push 'gdb-invalidate-assembler gdb-pending-triggers)
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2926 (setq gdb-previous-frame-address gdb-frame-address)
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2927 (setq gdb-previous-frame gdb-selected-frame)))))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2928
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2929 (defun gdb-get-selected-frame ()
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2930 (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
2931 (progn
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2932 (gdb-enqueue-input
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2933 (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
2934 (push 'gdb-get-selected-frame
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2935 gdb-pending-triggers))))
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2936
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2937 (defun gdb-frame-handler ()
55749
230865f1c59d (gdb-server-prefix): New variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 55696
diff changeset
2938 (setq gdb-pending-triggers
62716
05f48d9c5aed (gdb-frame-address):
Nick Roberts <nickrob@snap.net.nz>
parents: 62659
diff changeset
2939 (delq 'gdb-get-selected-frame gdb-pending-triggers))
67332
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2940 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2941 (if (re-search-forward "Stack level \\([0-9]+\\)" nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2942 (setq gdb-frame-number (match-string 1)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2943 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2944 (if (re-search-forward
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2945 ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? " nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2946 (progn
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2947 (setq gdb-selected-frame (match-string 2))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2948 (if (gdb-get-buffer 'gdb-locals-buffer)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2949 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2950 (setq mode-name (concat "Locals:" gdb-selected-frame))))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2951 (if (gdb-get-buffer 'gdb-assembler-buffer)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2952 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2953 (setq mode-name (concat "Machine:" gdb-selected-frame))))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2954 (setq gdb-frame-address (match-string 1))))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2955 (goto-char (point-min))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2956 (if (re-search-forward " source language \\(\\S-*\\)\." nil t)
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2957 (setq gdb-current-language (match-string 1)))
dc9f95e91f3b (gdb-var-create-handler)
Nick Roberts <nickrob@snap.net.nz>
parents: 67309
diff changeset
2958 (gdb-invalidate-assembler))
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
2959
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2960
67356
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2961 ;; Code specific to GDB 6.4
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
2962 (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
2963
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2964 (defun 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
2965 "Create list of source files for current GDB session."
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2966 (goto-char (point-min))
67364
7736e7015779 (gdb-find-file-unhook): Delete variable.
Nick Roberts <nickrob@snap.net.nz>
parents: 67356
diff changeset
2967 (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
2968 (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
2969 (dolist (buffer (buffer-list))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2970 (with-current-buffer buffer
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2971 (when (member buffer-file-name gdb-source-file-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2972 (set (make-local-variable 'gud-minor-mode) 'gdba)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2973 (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
2974 (when gud-tooltip-mode
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2975 (make-local-variable 'gdb-define-alist)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2976 (gdb-create-define-alist)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2977 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2978
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2979 ; 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
2980 (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
2981 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2982 (list (concat "server interpreter mi \"-var-update " varnum "\"\n")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2983 'ignore))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2984 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2985 (list (concat "server interpreter mi \"-var-list-children --all-values "
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2986 varnum "\"\n")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2987 `(lambda () (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
2988
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2989 (defconst gdb-var-list-children-regexp-1
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2990 "name=\"\\(.+?\\)\",exp=\"\\(.+?\\)\",numchild=\"\\(.+?\\)\",\
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2991 value=\\(\".*?\"\\),type=\"\\(.+?\\)\"}")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2992
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2993 (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
2994 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2995 (let ((var-list nil))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2996 (catch 'child-already-watched
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2997 (dolist (var gdb-var-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2998 (if (string-equal varnum (cadr var))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
2999 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3000 (push var var-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3001 (while (re-search-forward gdb-var-list-children-regexp-1 nil t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3002 (let ((varchild (list (match-string 2)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3003 (match-string 1)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3004 (match-string 3)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3005 (match-string 5)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3006 (read (match-string 4))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3007 nil)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3008 (dolist (var1 gdb-var-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3009 (if (string-equal (cadr var1) (cadr varchild))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3010 (throw 'child-already-watched nil)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3011 (push varchild var-list))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3012 (push var var-list)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3013 (setq gdb-var-changed t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3014 (setq gdb-var-list (nreverse var-list)))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3015
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3016 ; 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
3017 (defun gdb-var-update-1 ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3018 (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
3019 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3020 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3021 (list
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3022 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3023 "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
3024 "-var-update --all-values *\n")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3025 'gdb-var-update-handler-1))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3026 (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
3027
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3028 (defconst gdb-var-update-regexp-1 "name=\"\\(.*?\\)\",value=\\(\".*?\"\\),")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3029
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3030 (defun gdb-var-update-handler-1 ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3031 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3032 (while (re-search-forward gdb-var-update-regexp-1 nil t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3033 (let ((varnum (match-string 1)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3034 (catch 'var-found1
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3035 (let ((num 0))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3036 (dolist (var gdb-var-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3037 (if (string-equal varnum (cadr var))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3038 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3039 (setcar (nthcdr 5 var) t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3040 (setcar (nthcdr 4 var) (read (match-string 2)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3041 (setcar (nthcdr num gdb-var-list) var)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3042 (throw 'var-found1 nil)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3043 (setq num (+ num 1))))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3044 (setq gdb-var-changed t))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3045 (setq gdb-pending-triggers
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3046 (delq 'gdb-var-update gdb-pending-triggers))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3047 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3048 ;; dummy command to update speedbar at right time
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3049 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3050 ;; keep gdb-pending-triggers non-nil till end
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3051 (push 'gdb-speedbar-timer gdb-pending-triggers)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3052
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3053 ;; Registers buffer.
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3054 ;;
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3055 (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
3056 'gdb-registers-buffer-name
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3057 'gdb-registers-mode)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3058
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3059 (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
3060 (gdb-get-buffer 'gdb-registers-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3061 (if (eq gud-minor-mode 'gdba)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3062 "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
3063 "-data-list-register-values x\n")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3064 gdb-data-list-register-values-handler)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3065
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3066 (defconst gdb-data-list-register-values-regexp
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3067 "number=\"\\(.*?\\)\",value=\"\\(.*?\\)\"")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3068
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3069 (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
3070 (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
3071 gdb-pending-triggers))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3072 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3073 (if (re-search-forward gdb-error-regexp nil t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3074 (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
3075 (let ((buffer-read-only nil))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3076 (erase-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3077 (insert (match-string 1))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3078 (goto-char (point-min))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3079 (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
3080 (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
3081 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3082 (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
3083 (setq register (pop register-list))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3084 (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
3085 (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
3086 (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
3087 'face 'font-lock-warning-face
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3088 register-string))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3089 (setq register-values
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3090 (concat register-values register-string)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3091 (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
3092 (with-current-buffer buf
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3093 (let ((p (window-point (get-buffer-window buf 0)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3094 (buffer-read-only nil))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3095 (erase-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3096 (insert register-values)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3097 (set-window-point (get-buffer-window buf 0) p))))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3098 (gdb-data-list-register-values-custom))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3099
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3100 (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
3101 (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
3102 (save-excursion
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3103 (let ((buffer-read-only nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3104 start end)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3105 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3106 (while (< (point) (point-max))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3107 (setq start (line-beginning-position))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3108 (setq end (line-end-position))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3109 (when (looking-at "^[^\t]+")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3110 (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
3111 (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
3112 'face font-lock-variable-name-face)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3113 (add-text-properties start end
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3114 '(help-echo "mouse-2: edit value"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3115 mouse-face highlight))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3116 (forward-line 1))))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3117
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3118 ;; 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
3119 (defun gdb-get-changed-registers ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3120 (if (not (member '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
3121 (progn
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3122 (gdb-enqueue-input
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3123 (list
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3124 (if (eq gud-minor-mode 'gdba)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3125 "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
3126 "-data-list-changed-registers\n")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3127 'gdb-get-changed-registers-handler))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3128 (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
3129
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3130 (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
3131
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3132 (defun gdb-get-changed-registers-handler ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3133 (setq gdb-pending-triggers
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3134 (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
3135 (setq gdb-changed-registers nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3136 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3137 (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
3138 (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
3139
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3140
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3141 ;; Locals buffer.
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3142 ;;
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3143 ;; 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
3144 (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
3145 'gdb-locals-buffer-name
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3146 'gdb-locals-mode)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3147
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3148 (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
3149 (gdb-get-buffer 'gdb-locals-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3150 "server interpreter mi -\"stack-list-locals --simple-values\"\n"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3151 gdb-stack-list-locals-handler)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3152
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3153 (defconst gdb-stack-list-locals-regexp
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3154 "name=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3155
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3156 (defvar gdb-locals-watch-map-1
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3157 (let ((map (make-sparse-keymap)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3158 (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
3159 map)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3160 "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
3161
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3162 ;; 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
3163 ;; 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
3164 (defun gdb-stack-list-locals-handler ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3165 (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
3166 gdb-pending-triggers))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3167 (let (local locals-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3168 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3169 (while (re-search-forward gdb-stack-list-locals-regexp nil t)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3170 (let ((local (list (match-string 1)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3171 (match-string 2)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3172 nil)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3173 (if (looking-at ",value=\\(\".*\"\\)}")
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3174 (setcar (nthcdr 2 local) (read (match-string 1))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3175 (push local locals-list)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3176 (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3177 (and buf (with-current-buffer buf
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3178 (let* ((window (get-buffer-window buf 0))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3179 (p (window-point window))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3180 (buffer-read-only nil))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3181 (erase-buffer)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3182 (dolist (local locals-list)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3183 (setq name (car local))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3184 (if (or (not (nth 2 local))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3185 (string-match "\\*$" (nth 1 local)))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3186 (add-text-properties 0 (length name)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3187 `(mouse-face highlight
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3188 help-echo "mouse-2: create watch expression"
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3189 local-map ,gdb-locals-watch-map-1)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3190 name))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3191 (insert
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3192 (concat name "\t" (nth 1 local)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3193 "\t" (nth 2 local) "\n")))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3194 (set-window-point window p)))))))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3195
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3196 (defun gdb-get-register-names ()
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3197 "Create a list of register names."
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3198 (goto-char (point-min))
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3199 (setq gdb-register-names nil)
568e3be4fb8c (gdb-error-regexp, gdb-first-post-prompt)
Nick Roberts <nickrob@snap.net.nz>
parents: 67332
diff changeset
3200 (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
3201 (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
3202
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3203 (provide 'gdb-ui)
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3204
55696
ed6e91c53c82 (gdb-reset): Use unless. Fix regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55507
diff changeset
3205 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352
54538
35328b5dc91b Moved from lisp directory
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3206 ;;; gdb-ui.el ends here