annotate lisp/progmodes/gdb-ui.el @ 106815:1d1d5d9bd884

Add 2010 to copyright years.
author Glenn Morris <rgm@gnu.org>
date Wed, 13 Jan 2010 00:35:10 -0800
parents ac408704629c
children 5df8e547a422
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1 ;;; gdb-ui.el --- User Interface for running GDB
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3 ;; Author: Nick Roberts <nickrob@gnu.org>
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4 ;; Maintainer: FSF
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
5 ;; Keywords: unix, tools
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
6
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106697
diff changeset
7 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
8 ;; Free Software Foundation, Inc.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
9
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
11
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
15 ;; (at your option) any later version.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
16
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
20 ;; GNU General Public License for more details.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
21
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
24
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
25 ;;; Commentary:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
26
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
27 ;; This mode acts as a graphical user interface to GDB. You can interact with
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
28 ;; GDB through the GUD buffer in the usual way, but there are also further
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
29 ;; buffers which control the execution and describe the state of your program.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
30 ;; It separates the input/output of your program from that of GDB, if
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
31 ;; required, and watches expressions in the speedbar. It also uses features of
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
32 ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
33 ;; (see the GDB Graphical Interface section in the Emacs info manual).
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
34
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
35 ;; By default, M-x gdb will start the debugger.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
36
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
37 ;; This file has evolved from gdba.el that was included with GDB 5.0 and
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
38 ;; written by Tom Lord and Jim Kingdon. It uses GDB's annotation interface.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
39 ;; You don't need to know about annotations to use this mode as a debugger,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
40 ;; but if you are interested developing the mode itself, see the Annotations
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
41 ;; section in the GDB info manual.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
42
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
43 ;; GDB developers plan to make the annotation interface obsolete. A new
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
44 ;; interface called GDB/MI (machine interface) has been designed to replace it.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
45 ;; Some GDB/MI commands are used in this file through the CLI command
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
46 ;; 'interpreter mi <mi-command>'. To help with the process of fully migrating
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
47 ;; Emacs from annotations to GDB/MI, there is an experimental package called
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
48 ;; gdb-mi in the Emacs Lisp Package Archive ("http://tromey.com/elpa/"). It
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
49 ;; comprises of modified gud.el and a file called gdb-mi.el which replaces
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
50 ;; gdb-ui.el. When installed, this overrides the current files and invoking
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
51 ;; M-x gdb will use GDB/MI directly (starts with "gdb -i=mi"). When deleted
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
52 ;; ('d' followed by 'x' in Package Menu mode), the files are deleted and old
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
53 ;; functionality restored. This provides a convenient way to review the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
54 ;; current status/contribute to its improvement. For someone who just wants to
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
55 ;; use GDB, however, the current mode in Emacs 22 is a much better option.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
56 ;; There is also a file, also called gdb-mi.el, a version of which is included
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
57 ;; the GDB distribution. This will probably only work with versions
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
58 ;; distributed with GDB 6.5 or later. Unlike the version in ELPA it works on
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
59 ;; top of gdb-ui.el and you can only start it with M-x gdbmi.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
60
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
61 ;; This mode SHOULD WORK WITH GDB 5.0 or later but you will NEED AT LEAST
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
62 ;; GDB 6.0 to use watch expressions. It works best with GDB 6.4 or later
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
63 ;; where watch expressions will update more quickly.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
64
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
65 ;;; Windows Platforms:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
66
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
67 ;; If you are using Emacs and GDB on Windows you will need to flush the buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
68 ;; explicitly in your program if you want timely display of I/O in Emacs.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
69 ;; Alternatively you can make the output stream unbuffered, for example, by
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
70 ;; using a macro:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
71
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
72 ;; #ifdef UNBUFFERED
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
73 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0);
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
74 ;; #endif
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
75
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
76 ;; and compiling with -DUNBUFFERED while debugging.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
77
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
78 ;; If you are using Cygwin GDB and find that the source is not being displayed
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
79 ;; in Emacs when you step through it, possible solutions are to:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
80
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
81 ;; 1) Use Cygwin X Windows and Cygwin Emacs.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
82 ;; (Since 22.1 Emacs builds under Cygwin.)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
83 ;; 2) Use MinGW GDB instead.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
84 ;; 3) Use cygwin-mount.el
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
85
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
86 ;;; Mac OSX:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
87
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
88 ;; GDB in Emacs on Mac OSX works best with FSF GDB as Apple have made
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
89 ;; some changes to the version that they include as part of Mac OSX.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
90 ;; This requires GDB version 7.0 or later (estimated release date June 2009)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
91 ;; as earlier versions don not compile on Mac OSX.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
92
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
93 ;;; Known Bugs:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
94
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
95 ;; 1) Cannot handle multiple debug sessions.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
96 ;; 2) If you wish to call procedures from your program in GDB
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
97 ;; e.g "call myproc ()", "p mysquare (5)" then use level 2 annotations
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
98 ;; "gdb --annotate=2 myprog" to keep source buffer/selected frame fixed.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
99 ;; 3) After detaching from a process, clicking on the "GO" icon on toolbar
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
100 ;; (gud-go) sends "continue" to GDB (should be "run").
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
101
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
102 ;;; TODO:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
103
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
104 ;; 1) Use MI command -data-read-memory for memory window.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
105 ;; 2) Use tree-buffer.el (from ECB) instead of the speedbar for
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
106 ;; watch-expressions? Handling of watch-expressions needs to be
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
107 ;; overhauled to work for large arrays/structures by creating variable
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
108 ;; objects for visible watch-expressions only.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
109 ;; 3) Mark breakpoint locations on scroll-bar of source buffer?
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
110
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
111 ;;; Code:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
112
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
113 (require 'gud)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
114 (require 'json)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
115 (require 'bindat)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
116
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
117 (defvar tool-bar-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
118 (defvar speedbar-initial-expansion-list-name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
119 (defvar speedbar-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
120
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
121 (defvar gdb-pc-address nil "Initialization for Assembler buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
122 Set to \"main\" at start if `gdb-show-main' is t.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
123 (defvar gdb-frame-address nil "Identity of frame for watch expression.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
124 (defvar gdb-previous-frame-pc-address nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
125 (defvar gdb-memory-address "main")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
126 (defvar gdb-previous-frame nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
127 (defvar gdb-selected-frame nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
128 (defvar gdb-frame-number nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
129 (defvar gdb-current-language nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
130 (defvar gdb-var-list nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
131 "List of variables in watch window.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
132 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS HAS_MORE FP)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
133 where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
134 address for root variables.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
135 (defvar gdb-main-file nil "Source file from which program execution begins.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
136 (defvar gud-old-arrow nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
137 (defvar gdb-thread-indicator nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
138 (defvar gdb-overlay-arrow-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
139 (defvar gdb-stack-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
140 (defvar gdb-server-prefix nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
141 (defvar gdb-flush-pending-output nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
142 (defvar gdb-location-alist nil
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
143 "Alist of breakpoint numbers and full filenames.
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
144 Only used for files that Emacs can't find.")
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
145 (defvar gdb-active-process nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
146 "GUD tooltips display variable values when t, and macro definitions otherwise.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
147 (defvar gdb-recording nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
148 "If t, then record session for playback and reverse execution")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
149 (defvar gdb-error "Non-nil when GDB is reporting an error.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
150 (defvar gdb-macro-info nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
151 "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
152 (defvar gdb-buffer-fringe-width nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
153 (defvar gdb-signalled nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
154 (defvar gdb-source-window nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
155 (defvar gdb-inferior-status nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
156 (defvar gdb-continuation nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
157 (defvar gdb-look-up-stack nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
158 (defvar gdb-frame-begin nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
159 "Non-nil when GDB generates frame-begin annotation.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
160 (defvar gdb-printing t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
161 (defvar gdb-parent-bptno-enabled nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
162 (defvar gdb-ready nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
163 (defvar gdb-stack-update nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
164 (defvar gdb-early-user-input nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
165
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
166 (defvar gdb-buffer-type nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
167 "One of the symbols bound in `gdb-buffer-rules'.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
168 (make-variable-buffer-local 'gdb-buffer-type)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
169
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
170 (defvar gdb-input-queue ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
171 "A list of gdb command objects.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
172
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
173 (defvar gdb-prompting nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
174 "True when gdb is idle with no pending input.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
175
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
176 (defvar gdb-output-sink nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
177 "The disposition of the output of the current gdb command.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
178 Possible values are these symbols:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
179
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
180 `user' -- gdb output should be copied to the GUD buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
181 for the user to see.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
182
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
183 `inferior' -- gdb output should be copied to the inferior-io buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
184
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
185 `pre-emacs' -- output should be ignored util the post-prompt
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
186 annotation is received. Then the output-sink
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
187 becomes:...
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
188 `emacs' -- output should be collected in the partial-output-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
189 for subsequent processing by a command. This is the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
190 disposition of output generated by commands that
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
191 gdb mode sends to gdb on its own behalf.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
192 `post-emacs' -- ignore output until the prompt annotation is
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
193 received, then go to USER disposition.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
194
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
195 gdba (gdb-ui.el) uses all five values, gdbmi (gdb-mi.el) only two
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
196 \(`user' and `emacs').")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
197
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
198 (defvar gdb-current-item nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
199 "The most recent command item sent to gdb.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
200
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
201 (defvar gdb-pending-triggers '()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
202 "A list of trigger functions that have run later than their output handlers.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
203
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
204 (defvar gdb-first-post-prompt nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
205 (defvar gdb-version nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
206 (defvar gdb-locals-font-lock-keywords nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
207 (defvar gdb-source-file-list nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
208 "List of source files for the current executable.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
209 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
210
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
211 (defvar gdb-locals-font-lock-keywords-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
212 '(;; var = (struct struct_tag) value
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
213 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
214 (1 font-lock-variable-name-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
215 (3 font-lock-keyword-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
216 (4 font-lock-type-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
217 ;; var = (type) value
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
218 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\sw\\|[_.]\\)+\\)"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
219 (1 font-lock-variable-name-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
220 (3 font-lock-type-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
221 ;; var = val
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
222 ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
223 (1 font-lock-variable-name-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
224 "Font lock keywords used in `gdb-local-mode'.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
225
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
226 (defvar gdb-locals-font-lock-keywords-2
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
227 '(;; var = type value
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
228 ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
229 (1 font-lock-variable-name-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
230 (3 font-lock-type-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
231 "Font lock keywords used in `gdb-local-mode'.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
232
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
233 ;; Variables for GDB 6.4+
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
234 (defvar gdb-register-names nil "List of register names.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
235 (defvar gdb-changed-registers nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
236 "List of changed register numbers (strings).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
237
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
238 ;;;###autoload
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
239 (defun gdb (command-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
240 "Run gdb on program FILE in buffer *gud-FILE*.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
241 The directory containing FILE becomes the initial working
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
242 directory and source-file directory for your debugger.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
243
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
244 If `gdb-many-windows' is nil (the default value) then gdb just
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
245 pops up the GUD buffer unless `gdb-show-main' is t. In this case
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
246 it starts with two windows: one displaying the GUD buffer and the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
247 other with the source file with the main routine of the inferior.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
248
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
249 If `gdb-many-windows' is t, regardless of the value of
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
250 `gdb-show-main', the layout below will appear unless
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
251 `gdb-use-separate-io-buffer' is nil when the source buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
252 occupies the full width of the frame. Keybindings are shown in
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
253 some of the buffers.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
254
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
255 Watch expressions appear in the speedbar/slowbar.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
256
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
257 The following commands help control operation :
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
258
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
259 `gdb-many-windows' - Toggle the number of windows gdb uses.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
260 `gdb-restore-windows' - To restore the window layout.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
261
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
262 See Info node `(emacs)GDB Graphical Interface' for a more
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
263 detailed description of this mode.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
264
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
265 +----------------------------------------------------------------------+
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
266 | GDB Toolbar |
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
267 +-----------------------------------+----------------------------------+
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
268 | GUD buffer (I/O of GDB) | Locals buffer |
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
269 |-----------------------------------+----------------------------------+
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
270 | | |
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
271 | Source buffer | I/O buffer for debugged program |
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
272 | | |
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
273 |-----------------------------------+----------------------------------+
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
274 | Stack buffer | Breakpoints/threads buffer |
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
275 +-----------------------------------+----------------------------------+
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
276
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
277 The option \"--annotate=3\" must be included in this value. To
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
278 run GDB in text command mode, use `gud-gdb'. You need to use
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
279 text command mode to debug multiple programs within one Emacs
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
280 session."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
281 (interactive (list (gud-query-cmdline 'gdb)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
282
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
283 (when (and gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
284 (buffer-name gud-comint-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
285 (get-buffer-process gud-comint-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
286 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
287 (gdb-restore-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
288 (error
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
289 "Multiple debugging requires restarting in text command mode"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
290
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
291 (gud-common-init command-line nil 'gud-gdba-marker-filter)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
292 (set (make-local-variable 'gud-minor-mode) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
293 (setq comint-input-sender 'gdb-send)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
294
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
295 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
296 (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
297 "Set temporary breakpoint at current line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
298 (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
299 (gud-def gud-step "step %p" "\C-s" "Step one source line with display.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
300 (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
301 (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
302 (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
303 (gud-def gud-cont "continue" "\C-r" "Continue with display.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
304 (gud-def gud-finish "finish" "\C-f" "Finish executing current function.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
305 (gud-def gud-jump
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
306 (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
307 "\C-j" "Set execution address to current line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
308
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
309 (gud-def gud-rstep "reverse-step %p" nil "Reverse step one source line with display.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
310 (gud-def gud-rstepi "reverse-stepi %p" nil "Reverse step one instruction with display.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
311 (gud-def gud-rnext "reverse-next %p" nil "Reverse step one line (skip functions).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
312 (gud-def gud-rnexti "reverse-nexti %p" nil "Reverse step one instruction (skip functions).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
313 (gud-def gud-rcont "reverse-continue" nil "Reverse continue with display.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
314 (gud-def gud-rfinish "reverse-finish" nil "Reverse finish executing current function.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
315
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
316 (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
317 (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
318 (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
319 (gud-def gud-pstar "print* %e" nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
320 "Evaluate C dereferenced pointer expression at point.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
321
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
322 ;; For debugging Emacs only.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
323 (gud-def gud-pv "pv1 %e" "\C-v" "Print the value of the lisp variable.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
324
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
325 (gud-def gud-until "until %l" "\C-u" "Continue to current line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
326 (gud-def gud-run "run" nil "Run the program.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
327
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
328 (local-set-key "\C-i" 'gud-gdb-complete-command)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
329 (setq comint-prompt-regexp "^(.*gdb[+]?) *")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
330 (setq paragraph-start comint-prompt-regexp)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
331 (setq gdb-output-sink 'user)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
332 (setq gdb-first-prompt t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
333 (setq gud-running nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
334 (setq gdb-ready nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
335 (setq gdb-stack-update nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
336 (setq gdb-flush-pending-output nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
337 (setq gdb-early-user-input nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
338 (setq gud-filter-pending-text nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
339 (gdb-thread-identification)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
340 (run-hooks 'gdb-mode-hook))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
341
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
342 ;; Keep as an alias for compatibility with Emacs 22.1.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
343 ;;;###autoload
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
344 (defalias 'gdba 'gdb)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
345
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
346 (defgroup gdb nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
347 "Gdb Graphical Mode options specifically for running Gdb in Emacs."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
348 :group 'processes
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
349 :group 'tools)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
350
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
351 (defcustom gdb-debug-log-max 128
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
352 "Maximum size of `gdb-debug-log'. If nil, size is unlimited."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
353 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
354 :type '(choice (integer :tag "Number of elements")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
355 (const :tag "Unlimited" nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
356 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
357
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
358 (defvar gdb-debug-log nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
359 "List of commands sent to and replies received from GDB.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
360 Most recent commands are listed first. This list stores only the last
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
361 `gdb-debug-log-max' values. This variable is used to debug GDB-UI.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
362
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
363 ;;;###autoload
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
364 (defcustom gdb-enable-debug nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
365 "Non-nil means record the process input and output in `gdb-debug-log'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
366 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
367 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
368 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
369
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
370 (defcustom gdb-cpp-define-alist-program "gcc -E -dM -"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
371 "Shell command for generating a list of defined macros in a source file.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
372 This list is used to display the #define directive associated
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
373 with an identifier as a tooltip. It works in a debug session with
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
374 GDB, when `gud-tooltip-mode' is t.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
375
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
376 Set `gdb-cpp-define-alist-flags' for any include paths or
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
377 predefined macros."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
378 :type 'string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
379 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
380 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
381
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
382 (defcustom gdb-cpp-define-alist-flags ""
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
383 "Preprocessor flags for `gdb-cpp-define-alist-program'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
384 :type 'string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
385 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
386 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
387
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
388 (defcustom gdb-create-source-file-list t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
389 "Non-nil means create a list of files from which the executable was built.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
390 Set this to nil if the GUD buffer displays \"initializing...\" in the mode
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
391 line for a long time when starting, possibly because your executable was
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
392 built from a large number of files. This allows quicker initialization
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
393 but means that these files are not automatically enabled for debugging,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
394 e.g., you won't be able to click in the fringe to set a breakpoint until
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
395 execution has already stopped there."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
396 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
397 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
398 :version "23.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
399
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
400 (defcustom gdb-show-main nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
401 "Non-nil means display source file containing the main routine at startup.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
402 Also display the main routine in the disassembly buffer if present."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
403 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
404 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
405 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
406
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
407 (defcustom gdb-many-windows nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
408 "If nil, just pop up the GUD buffer unless `gdb-show-main' is t.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
409 In this case start with two windows: one displaying the GUD
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
410 buffer and the other with the source file with the main routine
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
411 of the debugged program. Non-nil means display the layout shown
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
412 for `gdba'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
413 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
414 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
415 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
416
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
417 (defcustom gdb-use-separate-io-buffer nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
418 "Non-nil means display output from the debugged program in a separate buffer."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
419 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
420 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
421 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
422
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
423 (defun gdb-force-mode-line-update (status)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
424 (let ((buffer gud-comint-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
425 (if (and buffer (buffer-name buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
426 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
427 (setq mode-line-process
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
428 (format ":%s [%s]"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
429 (process-status (get-buffer-process buffer)) status))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
430 ;; Force mode line redisplay soon.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
431 (force-mode-line-update)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
432
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
433 (defun gdb-enable-debug (arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
434 "Toggle logging of transaction between Emacs and Gdb.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
435 The log is stored in `gdb-debug-log' as an alist with elements
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
436 whose cons is send, send-item or recv and whose cdr is the string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
437 being transferred. This list may grow up to a size of
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
438 `gdb-debug-log-max' after which the oldest element (at the end of
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
439 the list) is deleted every time a new one is added (at the front)."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
440 (interactive "P")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
441 (setq gdb-enable-debug
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
442 (if (null arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
443 (not gdb-enable-debug)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
444 (> (prefix-numeric-value arg) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
445 (message (format "Logging of transaction %sabled"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
446 (if gdb-enable-debug "en" "dis"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
447
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
448 (defun gdb-many-windows (arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
449 "Toggle the number of windows in the basic arrangement.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
450 With prefix argument ARG, display additional buffers if ARG is positive,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
451 otherwise use a single window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
452 (interactive "P")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
453 (setq gdb-many-windows
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
454 (if (null arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
455 (not gdb-many-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
456 (> (prefix-numeric-value arg) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
457 (message (format "Display of other windows %sabled"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
458 (if gdb-many-windows "en" "dis")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
459 (if (and gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
460 (buffer-name gud-comint-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
461 (condition-case nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
462 (gdb-restore-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
463 (error nil))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
464
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
465 (defun gdb-use-separate-io-buffer (arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
466 "Toggle separate IO for debugged program.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
467 With prefix argument ARG, use separate IO if ARG is positive,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
468 otherwise do not."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
469 (interactive "P")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
470 (setq gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
471 (if (null arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
472 (not gdb-use-separate-io-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
473 (> (prefix-numeric-value arg) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
474 (message (format "Separate IO %sabled"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
475 (if gdb-use-separate-io-buffer "en" "dis")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
476 (if (and gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
477 (buffer-name gud-comint-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
478 (condition-case nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
479 (if gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
480 (if gdb-many-windows (gdb-restore-windows))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
481 (kill-buffer (gdb-inferior-io-name)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
482 (error nil))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
483
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
484 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
485
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
486 (defun gdb-create-define-alist ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
487 "Create an alist of #define directives for GUD tooltips."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
488 (let* ((file (buffer-file-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
489 (output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
490 (with-output-to-string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
491 (with-current-buffer standard-output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
492 (and file
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
493 (file-exists-p file)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
494 ;; call-process doesn't work with remote file names.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
495 (not (file-remote-p default-directory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
496 (call-process shell-file-name file
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
497 (list t nil) nil "-c"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
498 (concat gdb-cpp-define-alist-program " "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
499 gdb-cpp-define-alist-flags))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
500 (define-list (split-string output "\n" t)) (name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
501 (setq gdb-define-alist nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
502 (dolist (define define-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
503 (setq name (nth 1 (split-string define "[( ]")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
504 (push (cons name define) gdb-define-alist))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
505
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
506 (declare-function tooltip-show "tooltip" (text &optional use-echo-area))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
507 (defvar tooltip-use-echo-area)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
508
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
509 (defun gdb-tooltip-print (expr)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
510 (tooltip-show
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
511 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
512 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
513 (let ((string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
514 (if (search-forward "=" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
515 (concat expr (buffer-substring (- (point) 2) (point-max)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
516 (buffer-string))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
517 ;; remove newline for gud-tooltip-echo-area
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
518 (substring string 0 (- (length string) 1))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
519 (or gud-tooltip-echo-area tooltip-use-echo-area
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
520 (not (display-graphic-p)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
521
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
522 ;; If expr is a macro for a function don't print because of possible dangerous
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
523 ;; side-effects. Also printing a function within a tooltip generates an
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
524 ;; unexpected starting annotation (phase error).
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
525 (defun gdb-tooltip-print-1 (expr)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
526 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
527 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
528 (if (search-forward "expands to: " nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
529 (unless (looking-at "\\S-+.*(.*).*")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
530 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
531 (list (concat gdb-server-prefix "print " expr "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
532 `(lambda () (gdb-tooltip-print ,expr))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
533
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
534 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
535
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
536 (defun gdb-init-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
537 (set (make-local-variable 'gud-minor-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
538 (buffer-local-value 'gud-minor-mode gud-comint-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
539 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
540 (when gud-tooltip-mode
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
541 (make-local-variable 'gdb-define-alist)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
542 (gdb-create-define-alist)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
543 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
544
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
545 (defun gdb-set-gud-minor-mode-existing-buffers ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
546 "Create list of source files for current GDB session."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
547 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
548 (when (search-forward "read in on demand:" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
549 (while (re-search-forward gdb-source-file-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
550 (push (file-name-nondirectory (or (match-string 1) (match-string 2)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
551 gdb-source-file-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
552 (dolist (buffer (buffer-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
553 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
554 (when (and buffer-file-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
555 (member (file-name-nondirectory buffer-file-name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
556 gdb-source-file-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
557 (gdb-init-buffer)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
558 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
559 (propertize "ready" 'face font-lock-variable-name-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
560
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
561 (defun gdb-find-watch-expression ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
562 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
563 (varnum (car var)) expr array)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
564 (string-match "\\(var[0-9]+\\)\\.\\(.*\\)" varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
565 (let ((var1 (assoc (match-string 1 varnum) gdb-var-list)) var2 varnumlet
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
566 (component-list (split-string (match-string 2 varnum) "\\." t)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
567 (setq expr (nth 1 var1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
568 (setq varnumlet (car var1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
569 (dolist (component component-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
570 (setq var2 (assoc varnumlet gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
571 (setq expr (concat expr
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
572 (if (string-match ".*\\[[0-9]+\\]$" (nth 3 var2))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
573 (concat "[" component "]")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
574 (concat "." component))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
575 (setq varnumlet (concat varnumlet "." component)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
576 expr)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
577
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
578 (defun gdb-toggle-recording ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
579 "Start/stop recording of debug session."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
580 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
581 (if gud-running
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
582 (message-box "Recording cannot be started or stopped while your program is still running")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
583 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
584 (list (concat gdb-server-prefix
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
585 (if gdb-recording "record stop\n" "target record\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
586 'gdb-recording-handler))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
587
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
588 ;; Convenience function for tool bar.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
589 (defalias 'gdb-toggle-recording-1 'gdb-toggle-recording)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
590
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
591 (defun gdb-recording-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
592 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
593 (if (re-search-forward "current architecture doesn't support record function" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
594 (message-box "Not enabled. The current architecture doesn't support the process record function.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
595 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
596 (if (re-search-forward "Undefined target command" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
597 (message-box "Not enabled. Process record requires GDB 7.0 onwards.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
598 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
599 (if (re-search-forward "the program is not being run" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
600 (message-box "Not enabled. Starting process recording requires an active target (running process).")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
601 (setq gdb-recording (not gdb-recording))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
602 ;; Actually forcing the tool-bar to update.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
603 (force-mode-line-update)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
604
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
605 (defun gdb-init-1 ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
606 (gud-def gud-break (if (not (string-match "Machine" mode-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
607 (gud-call "break %f:%l" arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
608 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
609 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
610 (forward-char 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
611 (gud-call "break *%a" arg)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
612 "\C-b" "Set breakpoint at current line or address.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
613 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
614 (gud-def gud-remove (if (not (string-match "Machine" mode-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
615 (gud-call "clear %f:%l" arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
616 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
617 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
618 (forward-char 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
619 (gud-call "clear *%a" arg)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
620 "\C-d" "Remove breakpoint at current line or address.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
621 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
622 (gud-def gud-until (if (not (string-match "Machine" mode-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
623 (gud-call "until %f:%l" arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
624 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
625 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
626 (forward-char 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
627 (gud-call "until *%a" arg)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
628 "\C-u" "Continue to current line or address.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
629 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
630 (gud-def gud-go (gud-call (if gdb-active-process "continue" "run") arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
631 nil "Start or continue execution.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
632
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
633 ;; For debugging Emacs only.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
634 (gud-def gud-pp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
635 (gud-call
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
636 (concat
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
637 "pp1 " (if (eq (buffer-local-value
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
638 'major-mode (window-buffer)) 'speedbar-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
639 (gdb-find-watch-expression) "%e")) arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
640 nil "Print the Emacs s-expression.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
641
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
642 (define-key gud-minor-mode-map [left-margin mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
643 'gdb-mouse-set-clear-breakpoint)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
644 (define-key gud-minor-mode-map [left-fringe mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
645 'gdb-mouse-set-clear-breakpoint)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
646 (define-key gud-minor-mode-map [left-margin C-mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
647 'gdb-mouse-toggle-breakpoint-margin)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
648 (define-key gud-minor-mode-map [left-fringe C-mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
649 'gdb-mouse-toggle-breakpoint-fringe)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
650
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
651 (define-key gud-minor-mode-map [left-margin drag-mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
652 'gdb-mouse-until)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
653 (define-key gud-minor-mode-map [left-fringe drag-mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
654 'gdb-mouse-until)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
655 (define-key gud-minor-mode-map [left-margin mouse-3]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
656 'gdb-mouse-until)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
657 (define-key gud-minor-mode-map [left-fringe mouse-3]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
658 'gdb-mouse-until)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
659
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
660 (define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
661 'gdb-mouse-jump)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
662 (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
663 'gdb-mouse-jump)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
664 (define-key gud-minor-mode-map [left-fringe C-mouse-3]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
665 'gdb-mouse-jump)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
666 (define-key gud-minor-mode-map [left-margin C-mouse-3]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
667 'gdb-mouse-jump)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
668
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
669 ;; (re-)initialize
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
670 (setq gdb-pc-address (if gdb-show-main "main" nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
671 (setq gdb-previous-frame-pc-address nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
672 gdb-memory-address "main"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
673 gdb-previous-frame nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
674 gdb-selected-frame nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
675 gdb-current-language nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
676 gdb-frame-number nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
677 gdb-var-list nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
678 gdb-main-file nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
679 gdb-first-post-prompt t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
680 gdb-prompting nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
681 gdb-input-queue nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
682 gdb-current-item nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
683 gdb-pending-triggers nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
684 gdb-output-sink 'user
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
685 gdb-server-prefix "server "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
686 gdb-location-alist nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
687 gdb-source-file-list nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
688 gdb-error nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
689 gdb-macro-info nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
690 gdb-buffer-fringe-width (car (window-fringes))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
691 gdb-debug-log nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
692 gdb-signalled nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
693 gdb-source-window nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
694 gdb-inferior-status nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
695 gdb-continuation nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
696 gdb-look-up-stack nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
697 gdb-frame-begin nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
698 gdb-printing t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
699 gud-old-arrow nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
700 gdb-thread-indicator nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
701 gdb-register-names nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
702 gdb-recording nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
703
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
704 (setq gdb-buffer-type 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
705
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
706 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
707
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
708 ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
709 (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
710 'gdb-get-version)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
711
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
712 (defun gdb-init-2 ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
713 (if (eq window-system 'w32)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
714 (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
715 (gdb-enqueue-input (list "set height 0\n" 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
716 (gdb-enqueue-input (list "set width 0\n" 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
717
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
718 (if (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
719 (if gdb-create-source-file-list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
720 (gdb-enqueue-input (list (concat gdb-server-prefix "info sources\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
721 'gdb-set-gud-minor-mode-existing-buffers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
722 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
723 ; Needs GDB 6.2 onwards.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
724 (if gdb-create-source-file-list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
725 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
726 (list "server interpreter mi \"-file-list-exec-source-files\"\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
727 'gdb-set-gud-minor-mode-existing-buffers-1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
728 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
729 ; Needs GDB 7.0 onwards.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
730 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
731 (list "server interpreter mi -enable-pretty-printing\n" 'ignore)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
732
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
733 ;; Find source file and compilation directory here.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
734 ;; Works for C, C++, Fortran and Ada but not Java (GDB 6.4)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
735 (gdb-enqueue-input (list "server list\n" 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
736 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
737 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
738
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
739 (defun gdb-get-version ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
740 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
741 (if (re-search-forward "Undefined\\( mi\\)* command:" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
742 (setq gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
743 (setq gdb-version "6.4+"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
744 (gdb-init-2))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
745
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
746 (defmacro gdb-if-arrow (arrow-position &rest body)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
747 `(if ,arrow-position
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
748 (let ((buffer (marker-buffer ,arrow-position)) (line))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
749 (if (equal buffer (window-buffer (posn-window end)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
750 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
751 (when (or (equal start end)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
752 (equal (posn-point start)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
753 (marker-position ,arrow-position)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
754 ,@body))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
755
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
756 (defun gdb-mouse-until (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
757 "Continue running until a source line past the current line.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
758 The destination source line can be selected either by clicking
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
759 with mouse-3 on the fringe/margin or dragging the arrow
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
760 with mouse-1 (default bindings)."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
761 (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
762 (let ((start (event-start event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
763 (end (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
764 (gdb-if-arrow gud-overlay-arrow-position
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
765 (setq line (line-number-at-pos (posn-point end)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
766 (gud-call (concat "until " (number-to-string line))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
767 (gdb-if-arrow gdb-overlay-arrow-position
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
768 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
769 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
770 (forward-line (1- (line-number-at-pos (posn-point end))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
771 (forward-char 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
772 (gud-call (concat "until *%a"))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
773
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
774 (defun gdb-mouse-jump (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
775 "Set execution address/line.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
776 The destination source line can be selected either by clicking with C-mouse-3
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
777 on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings).
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
778 Unlike `gdb-mouse-until' the destination address can be before the current
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
779 line, and no execution takes place."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
780 (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
781 (let ((start (event-start event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
782 (end (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
783 (gdb-if-arrow gud-overlay-arrow-position
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
784 (setq line (line-number-at-pos (posn-point end)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
785 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
786 (gud-call (concat "tbreak " (number-to-string line)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
787 (gud-call (concat "jump " (number-to-string line)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
788 (gdb-if-arrow gdb-overlay-arrow-position
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
789 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
790 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
791 (forward-line (1- (line-number-at-pos (posn-point end))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
792 (forward-char 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
793 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
794 (gud-call (concat "tbreak *%a"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
795 (gud-call (concat "jump *%a")))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
796
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
797 (defcustom gdb-speedbar-auto-raise nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
798 "If non-nil raise speedbar every time display of watch expressions is\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
799 updated."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
800 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
801 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
802 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
803
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
804 (defun gdb-speedbar-auto-raise (arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
805 "Toggle automatic raising of the speedbar for watch expressions.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
806 With prefix argument ARG, automatically raise speedbar if ARG is
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
807 positive, otherwise don't automatically raise it."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
808 (interactive "P")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
809 (setq gdb-speedbar-auto-raise
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
810 (if (null arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
811 (not gdb-speedbar-auto-raise)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
812 (> (prefix-numeric-value arg) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
813 (message (format "Auto raising %sabled"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
814 (if gdb-speedbar-auto-raise "en" "dis"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
815
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
816 (defcustom gdb-use-colon-colon-notation nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
817 "If non-nil use FUN::VAR format to display variables in the speedbar."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
818 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
819 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
820 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
821
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
822 (define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
823 (define-key global-map (concat gud-key-prefix "\C-w") 'gud-watch)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
824
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
825 (declare-function tooltip-identifier-from-point "tooltip" (point))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
826
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
827 (defun gud-watch (&optional arg event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
828 "Watch expression at point.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
829 With arg, enter name of variable to be watched in the minibuffer."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
830 (interactive (list current-prefix-arg last-input-event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
831 (let ((minor-mode (buffer-local-value 'gud-minor-mode gud-comint-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
832 (if (memq minor-mode '(gdbmi gdba))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
833 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
834 (if event (posn-set-point (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
835 (require 'tooltip)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
836 (save-selected-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
837 (let ((expr
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
838 (if arg
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
839 (completing-read "Name of variable: "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
840 'gud-gdb-complete-command)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
841 (if (and transient-mark-mode mark-active)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
842 (buffer-substring (region-beginning) (region-end))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
843 (concat (if (eq major-mode 'gdb-registers-mode) "$")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
844 (tooltip-identifier-from-point (point)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
845 (set-text-properties 0 (length expr) nil expr)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
846 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
847 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
848 (if (eq minor-mode 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
849 (concat
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
850 "server interpreter mi \"-var-create - * " expr "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
851 (concat"-var-create - * " expr "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
852 `(lambda () (gdb-var-create-handler ,expr)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
853 (message "gud-watch is a no-op in this mode."))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
854
106680
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
855 (declare-function speedbar-change-initial-expansion-list "speedbar" (new-default))
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
856
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
857 (defun gdb-var-create-handler (expr)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
858 (let* ((result (gdb-json-partial-output)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
859 (if (not (bindat-get-field result 'msg))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
860 (let ((var
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
861 (list (bindat-get-field result 'name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
862 (if (and (string-equal gdb-current-language "c")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
863 gdb-use-colon-colon-notation gdb-selected-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
864 (setq expr (concat gdb-selected-frame "::" expr))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
865 expr)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
866 (bindat-get-field result 'numchild)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
867 (bindat-get-field result 'type)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
868 (bindat-get-field result 'value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
869 nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
870 (bindat-get-field result 'has_more)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
871 gdb-frame-address)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
872 (push var gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
873 (speedbar 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
874 (unless (string-equal
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
875 speedbar-initial-expansion-list-name "GUD")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
876 (speedbar-change-initial-expansion-list "GUD")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
877 (message-box "No symbol \"%s\" in current context." expr))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
878
106680
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
879 (declare-function speedbar-timer-fn "speedbar" ())
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
880
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
881 (defun gdb-speedbar-update ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
882 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
883 (not (member 'gdb-speedbar-timer gdb-pending-triggers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
884 ;; Dummy command to update speedbar even when idle.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
885 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
886 ;; Keep gdb-pending-triggers non-nil till end.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
887 (push 'gdb-speedbar-timer gdb-pending-triggers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
888
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
889 (defun gdb-speedbar-timer-fn ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
890 (if gdb-speedbar-auto-raise
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
891 (raise-frame speedbar-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
892 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
893 (delq 'gdb-speedbar-timer gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
894 (speedbar-timer-fn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
895
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
896 (defun gdb-var-evaluate-expression-handler (varnum changed)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
897 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
898 (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
899 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
900 (delq (string-to-number (match-string 1)) gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
901 (let ((var (assoc varnum gdb-var-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
902 (when var
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
903 (if changed (setcar (nthcdr 5 var) 'changed))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
904 (setcar (nthcdr 4 var) (read (match-string 2)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
905 (gdb-speedbar-update))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
906
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
907 (defun gdb-var-list-children (varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
908 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
909 (list (concat "server interpreter mi \"-var-list-children " varnum "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
910 `(lambda () (gdb-var-list-children-handler ,varnum)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
911
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
912 (defconst gdb-var-list-children-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
913 "child={.*?name=\"\\(.*?\\)\".*?,exp=\"\\(.*?\\)\".*?,\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
914 numchild=\"\\(.*?\\)\"\\(}\\|.*?,\\(type=\"\\(.*?\\)\"\\)?.*?}\\)")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
915
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
916 (defun gdb-var-list-children-handler (varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
917 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
918 (let ((var-list nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
919 (catch 'child-already-watched
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
920 (dolist (var gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
921 (if (string-equal varnum (car var))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
922 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
923 (push var var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
924 (while (re-search-forward gdb-var-list-children-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
925 (let ((varchild (list (match-string 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
926 (match-string 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
927 (match-string 3)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
928 (match-string 6)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
929 nil nil)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
930 (if (assoc (car varchild) gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
931 (throw 'child-already-watched nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
932 (push varchild var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
933 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
934 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
935 (concat
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
936 "server interpreter mi \"0-var-evaluate-expression "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
937 (car varchild) "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
938 `(lambda () (gdb-var-evaluate-expression-handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
939 ,(car varchild) nil)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
940 (push var var-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
941 (setq gdb-var-list (nreverse var-list)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
942
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
943 (defun gdb-var-update ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
944 (when (not (member 'gdb-var-update gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
945 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
946 (list "server interpreter mi \"-var-update *\"\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
947 'gdb-var-update-handler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
948 (push 'gdb-var-update gdb-pending-triggers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
949
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
950 (defconst gdb-var-update-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
951 "{.*?name=\"\\(.*?\\)\".*?,in_scope=\"\\(.*?\\)\".*?,\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
952 type_changed=\".*?\".*?}")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
953
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
954 (defun gdb-var-update-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
955 (dolist (var gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
956 (setcar (nthcdr 5 var) nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
957 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
958 (let ((n 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
959 (while (re-search-forward gdb-var-update-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
960 (let ((varnum (match-string 1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
961 (if (string-equal (match-string 2) "false")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
962 (let ((var (assoc varnum gdb-var-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
963 (if var (setcar (nthcdr 5 var) 'out-of-scope)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
964 (setq n (1+ n))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
965 (push n gdb-pending-triggers)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
966 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
967 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
968 (concat "server interpreter mi \"" (number-to-string n)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
969 "-var-evaluate-expression " varnum "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
970 `(lambda () (gdb-var-evaluate-expression-handler ,varnum t))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
971 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
972 (delq 'gdb-var-update gdb-pending-triggers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
973
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
974 (defun gdb-var-set-format (format)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
975 "Set the output format for a variable displayed in the speedbar."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
976 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
977 (varnum (car var)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
978 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
979 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
980 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
981 (concat "server interpreter mi \"-var-set-format "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
982 varnum " " format "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
983 (concat "-var-set-format " varnum " " format "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
984 `(lambda () (gdb-var-set-format-handler ,varnum))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
985
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
986 (defconst gdb-var-set-format-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
987 "format=\"\\(.*?\\)\",.*value=\"\\(.*?\\)\"")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
988
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
989 (defun gdb-var-set-format-handler (varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
990 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
991 (if (re-search-forward gdb-var-set-format-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
992 (let ((var (assoc varnum gdb-var-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
993 (setcar (nthcdr 4 var) (match-string 2))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
994 (gdb-var-update-1))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
995
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
996 (defun gdb-var-delete-1 (var varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
997 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
998 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
999 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1000 (concat "server interpreter mi \"-var-delete " varnum "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1001 (concat "-var-delete " varnum "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1002 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1003 (setq gdb-var-list (delq var gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1004 (dolist (varchild gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1005 (if (string-match (concat (car var) "\\.") (car varchild))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1006 (setq gdb-var-list (delq varchild gdb-var-list)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1007
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1008 (defun gdb-var-delete ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1009 "Delete watch expression at point from the speedbar."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1010 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1011 (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1012 '(gdbmi gdba))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1013 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1014 (varnum (car var)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1015 (if (string-match "\\." (car var))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1016 (message-box "Can only delete a root expression")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1017 (gdb-var-delete-1 var varnum)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1018
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1019 (defun gdb-var-delete-children (varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1020 "Delete children of variable object at point from the speedbar."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1021 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1022 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1023 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1024 (concat "server interpreter mi \"-var-delete -c " varnum "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1025 (concat "-var-delete -c " varnum "\n")) 'ignore)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1026
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1027 (defun gdb-edit-value (text token indent)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1028 "Assign a value to a variable displayed in the speedbar."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1029 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1030 (varnum (car var)) (value))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1031 (setq value (read-string "New value: "))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1032 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1033 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1034 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1035 (concat "server interpreter mi \"-var-assign "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1036 varnum " " value "\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1037 (concat "-var-assign " varnum " " value "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1038 `(lambda () (gdb-edit-value-handler ,value))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1039
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1040 (defun gdb-edit-value-handler (value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1041 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1042 (if (re-search-forward gdb-error-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1043 (message-box "Invalid number or expression (%s)" value)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1044
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1045 (defcustom gdb-show-changed-values t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1046 "If non-nil change the face of out of scope variables and changed values.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1047 Out of scope variables are suppressed with `shadow' face.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1048 Changed values are highlighted with the face `font-lock-warning-face'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1049 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1050 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1051 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1052
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1053 (defcustom gdb-max-children 40
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1054 "Maximum number of children before expansion requires confirmation."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1055 :type 'integer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1056 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1057 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1058
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1059 (defcustom gdb-delete-out-of-scope t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1060 "If non-nil delete watch expressions automatically when they go out of scope."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1061 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1062 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1063 :version "22.2")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1064
106680
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
1065 (declare-function speedbar-change-expand-button-char "speedbar" (char))
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
1066 (declare-function speedbar-delete-subblock "speedbar" (indent))
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
1067 (declare-function speedbar-center-buffer-smartly "speedbar" ())
63c5fb6b67fc Declare some functions for the byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106678
diff changeset
1068
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1069 (defun gdb-speedbar-expand-node (text token indent)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1070 "Expand the node the user clicked on.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1071 TEXT is the text of the button we clicked on, a + or - item.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1072 TOKEN is data related to this node.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1073 INDENT is the current indentation depth."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1074 (if (and gud-comint-buffer (buffer-name gud-comint-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1075 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1076 (cond ((string-match "+" text) ;expand this node
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1077 (let* ((var (assoc token gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1078 (expr (nth 1 var)) (children (nth 2 var)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1079 (if (or (<= (string-to-number children) gdb-max-children)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1080 (y-or-n-p
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1081 (format
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
1082 "%s has %s children. Continue? " expr children)))
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1083 (if (and (eq (buffer-local-value
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1084 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1085 (string-equal gdb-version "pre-6.4"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1086 (gdb-var-list-children token)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1087 (gdb-var-list-children-1 token)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1088 ((string-match "-" text) ;contract this node
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1089 (dolist (var gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1090 (if (string-match (concat token "\\.") (car var))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1091 (setq gdb-var-list (delq var gdb-var-list))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1092 (gdb-var-delete-children token)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1093 (speedbar-change-expand-button-char ?+)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1094 (speedbar-delete-subblock indent))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1095 (t (error "Ooops... not sure what to do")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1096 (speedbar-center-buffer-smartly))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1097 (message-box "GUD session has been killed")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1098
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1099 (defun gdb-get-target-string ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1100 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1101 gud-target-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1102
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1103
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1104 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1105 ;; gdb buffers.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1106 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1107 ;; Each buffer has a TYPE -- a symbol that identifies the function
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1108 ;; of that particular buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1109 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1110 ;; The usual gdb interaction buffer is given the type `gdba' and
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1111 ;; is constructed specially.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1112 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1113 ;; Others are constructed by gdb-get-buffer-create and
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1114 ;; named according to the rules set forth in the gdb-buffer-rules-assoc
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1115
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1116 (defvar gdb-buffer-rules-assoc '())
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1117
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1118 (defun gdb-get-buffer (key)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1119 "Return the gdb buffer tagged with type KEY.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1120 The key should be one of the cars in `gdb-buffer-rules-assoc'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1121 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1122 (gdb-look-for-tagged-buffer key (buffer-list))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1123
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1124 (defun gdb-get-buffer-create (key)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1125 "Create a new gdb buffer of the type specified by KEY.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1126 The key should be one of the cars in `gdb-buffer-rules-assoc'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1127 (or (gdb-get-buffer key)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1128 (let* ((rules (assoc key gdb-buffer-rules-assoc))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1129 (name (funcall (gdb-rules-name-maker rules)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1130 (new (get-buffer-create name)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1131 (with-current-buffer new
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1132 (let ((trigger))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1133 (if (cdr (cdr rules))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1134 (setq trigger (funcall (car (cdr (cdr rules))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1135 (setq gdb-buffer-type key)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1136 (set (make-local-variable 'gud-minor-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1137 (buffer-local-value 'gud-minor-mode gud-comint-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1138 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1139 (if trigger (funcall trigger)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1140 new))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1141
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1142 (defun gdb-rules-name-maker (rules) (car (cdr rules)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1143
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1144 (defun gdb-look-for-tagged-buffer (key bufs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1145 (let ((retval nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1146 (while (and (not retval) bufs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1147 (set-buffer (car bufs))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1148 (if (eq gdb-buffer-type key)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1149 (setq retval (car bufs)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1150 (setq bufs (cdr bufs)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1151 retval))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1152
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1153 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1154 ;; This assoc maps buffer type symbols to rules. Each rule is a list of
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1155 ;; at least one and possible more functions. The functions have these
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1156 ;; roles in defining a buffer type:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1157 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1158 ;; NAME - Return a name for this buffer type.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1159 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1160 ;; The remaining function(s) are optional:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1161 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1162 ;; MODE - called in a new buffer with no arguments, should establish
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1163 ;; the proper mode for the buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1164 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1165
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1166 (defun gdb-set-buffer-rules (buffer-type &rest rules)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1167 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1168 (if binding
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1169 (setcdr binding rules)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1170 (push (cons buffer-type rules)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1171 gdb-buffer-rules-assoc))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1172
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1173 ;; GUD buffers are an exception to the rules
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1174 (gdb-set-buffer-rules 'gdba 'error)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1175
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1176 ;; Partial-output buffer : This accumulates output from a command executed on
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1177 ;; behalf of emacs (rather than the user).
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1178 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1179 (gdb-set-buffer-rules 'gdb-partial-output-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1180 'gdb-partial-output-name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1181
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1182 (defun gdb-partial-output-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1183 (concat " *partial-output-"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1184 (gdb-get-target-string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1185 "*"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1186
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1187
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1188 (gdb-set-buffer-rules 'gdb-inferior-io
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1189 'gdb-inferior-io-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1190 'gdb-inferior-io-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1191
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1192 (defun gdb-inferior-io-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1193 (concat "*input/output of "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1194 (gdb-get-target-string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1195 "*"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1196
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1197 (defun gdb-display-separate-io-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1198 "Display IO of debugged program in a separate window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1199 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1200 (if gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1201 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1202 (gdb-get-buffer-create 'gdb-inferior-io) t)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1203
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1204 (defconst gdb-frame-parameters
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1205 '((height . 14) (width . 80)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1206 (unsplittable . t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1207 (tool-bar-lines . nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1208 (menu-bar-lines . nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1209 (minibuffer . nil)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1210
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1211 (defun gdb-frame-separate-io-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1212 "Display IO of debugged program in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1213 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1214 (if gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1215 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1216 (special-display-frame-alist gdb-frame-parameters))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1217 (display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1218
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1219 (defvar gdb-inferior-io-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1220 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1221 (define-key map "\C-c\C-c" 'gdb-separate-io-interrupt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1222 (define-key map "\C-c\C-z" 'gdb-separate-io-stop)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1223 (define-key map "\C-c\C-\\" 'gdb-separate-io-quit)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1224 (define-key map "\C-c\C-d" 'gdb-separate-io-eof)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1225 (define-key map "\C-d" 'gdb-separate-io-eof)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1226 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1227
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1228 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1229 "Major mode for gdb inferior-io."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1230 :syntax-table nil :abbrev-table nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1231 ;; We want to use comint because it has various nifty and familiar
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1232 ;; features. We don't need a process, but comint wants one, so create
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1233 ;; a dummy one.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1234 (make-comint-in-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1235 (substring (buffer-name) 1 (- (length (buffer-name)) 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1236 (current-buffer) "hexl")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1237 (setq comint-input-sender 'gdb-inferior-io-sender))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1238
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1239 (defun gdb-inferior-io-sender (proc string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1240 ;; PROC is the pseudo-process created to satisfy comint.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1241 (with-current-buffer (process-buffer proc)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1242 (setq proc (get-buffer-process gud-comint-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1243 (process-send-string proc string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1244 (process-send-string proc "\n")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1245
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1246 (defun gdb-separate-io-interrupt ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1247 "Interrupt the program being debugged."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1248 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1249 (interrupt-process
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1250 (get-buffer-process gud-comint-buffer) comint-ptyp))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1251
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1252 (defun gdb-separate-io-quit ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1253 "Send quit signal to the program being debugged."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1254 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1255 (quit-process
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1256 (get-buffer-process gud-comint-buffer) comint-ptyp))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1257
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1258 (defun gdb-separate-io-stop ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1259 "Stop the program being debugged."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1260 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1261 (stop-process
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1262 (get-buffer-process gud-comint-buffer) comint-ptyp))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1263
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1264 (defun gdb-separate-io-eof ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1265 "Send end-of-file to the program being debugged."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1266 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1267 (process-send-eof
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1268 (get-buffer-process gud-comint-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1269
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1270
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1271 ;; gdb communications
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1272 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1273
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1274 ;; INPUT: things sent to gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1275 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1276 ;; The queues are lists. Each element is either a string (indicating user or
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1277 ;; user-like input) or a list of the form:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1278 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1279 ;; (INPUT-STRING HANDLER-FN)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1280 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1281 ;; The handler function will be called from the partial-output buffer when the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1282 ;; command completes. This is the way to write commands which invoke gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1283 ;; commands autonomously.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1284 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1285 ;; These lists are consumed tail first.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1286 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1287
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1288 (defun gdb-send (proc string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1289 "A comint send filter for gdb.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1290 This filter may simply queue input for a later time."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1291 (if gdb-ready
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1292 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1293 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1294 (let ((inhibit-read-only t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1295 (remove-text-properties (point-min) (point-max) '(face))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1296 (if gud-running
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1297 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1298 (let ((item (concat string "\n")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1299 (if gdb-enable-debug (push (cons 'send item) gdb-debug-log))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1300 (process-send-string proc item)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1301 (if (string-match "\\\\\\'" string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1302 (setq gdb-continuation (concat gdb-continuation string "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1303 (let ((item (concat
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1304 gdb-continuation string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1305 (if (not comint-input-sender-no-newline) "\n"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1306 (gdb-enqueue-input item)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1307 (setq gdb-continuation nil)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1308 (push (concat string "\n") gdb-early-user-input)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1309
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1310 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1311 ;; is a query, or other non-top-level prompt.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1312
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1313 (defun gdb-enqueue-input (item)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1314 (if (not gud-running)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1315 (if gdb-prompting
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1316 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1317 (gdb-send-item item)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1318 (setq gdb-prompting nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1319 (push item gdb-input-queue))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1320
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1321 (defun gdb-dequeue-input ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1322 (let ((queue gdb-input-queue))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1323 (if queue
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1324 (let ((last (car (last queue))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1325 (unless (nbutlast queue) (setq gdb-input-queue '()))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1326 last)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1327 ;; This should be nil here anyway but set it just to make sure.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1328 (setq gdb-pending-triggers nil))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1329
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1330 (defun gdb-send-item (item)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1331 (setq gdb-flush-pending-output nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1332 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1333 (setq gdb-current-item item)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1334 (let ((process (get-buffer-process gud-comint-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1335 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1336 (if (stringp item)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1337 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1338 (setq gdb-output-sink 'user)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1339 (process-send-string process item))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1340 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1341 (gdb-clear-partial-output)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1342 (setq gdb-output-sink 'pre-emacs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1343 (process-send-string process
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1344 (car item))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1345 ;; case: eq gud-minor-mode 'gdbmi
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1346 (gdb-clear-partial-output)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1347 (setq gdb-output-sink 'emacs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1348 (process-send-string process (car item)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1349
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1350 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1351 ;; output -- things gdb prints to emacs
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1352 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1353 ;; GDB output is a stream interrupted by annotations.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1354 ;; Annotations can be recognized by their beginning
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1355 ;; with \C-j\C-z\C-z<tag><opt>\C-j
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1356 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1357 ;; The tag is a string obeying symbol syntax.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1358 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1359 ;; The optional part `<opt>' can be either the empty string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1360 ;; or a space followed by more data relating to the annotation.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1361 ;; For example, the SOURCE annotation is followed by a filename,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1362 ;; line number and various useless goo. This data must not include
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1363 ;; any newlines.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1364 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1365
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1366 (defcustom gud-gdb-command-name "gdb --annotate=3"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1367 "Default command to execute an executable under the GDB debugger.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1368 The option \"--annotate=3\" must be included in this value if you
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1369 want the GDB Graphical Interface."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1370 :type 'string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1371 :group 'gud
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1372 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1373
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1374 (defvar gdb-annotation-rules
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1375 '(("pre-prompt" gdb-pre-prompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1376 ("prompt" gdb-prompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1377 ("commands" gdb-subprompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1378 ("overload-choice" gdb-subprompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1379 ("query" gdb-subprompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1380 ;; Need this prompt for GDB 6.1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1381 ("nquery" gdb-subprompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1382 ("prompt-for-continue" gdb-subprompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1383 ("post-prompt" gdb-post-prompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1384 ("source" gdb-source)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1385 ("starting" gdb-starting)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1386 ("exited" gdb-exited)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1387 ("signalled" gdb-signalled)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1388 ("signal" gdb-signal)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1389 ("breakpoint" gdb-stopping)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1390 ("watchpoint" gdb-stopping)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1391 ("frame-begin" gdb-frame-begin)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1392 ("stopped" gdb-stopped)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1393 ("error-begin" gdb-error)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1394 ("error" gdb-error)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1395 ("new-thread" (lambda (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1396 (gdb-get-buffer-create 'gdb-threads-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1397 ("thread-changed" gdb-thread-changed))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1398 "An assoc mapping annotation tags to functions which process them.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1399
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1400 (defun gdb-resync()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1401 (setq gdb-flush-pending-output t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1402 (setq gud-running nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1403 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1404 (propertize "stopped" 'face font-lock-warning-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1405 (setq gdb-output-sink 'user)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1406 (setq gdb-input-queue nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1407 (setq gdb-pending-triggers nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1408 (setq gdb-prompting t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1409
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1410 (defconst gdb-source-spec-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1411 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1412
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1413 ;; Do not use this except as an annotation handler.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1414 (defun gdb-source (args)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1415 (string-match gdb-source-spec-regexp args)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1416 ;; Extract the frame position from the marker.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1417 (setq gud-last-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1418 (cons
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1419 (match-string 1 args)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1420 (string-to-number (match-string 2 args))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1421 (setq gdb-pc-address (match-string 3 args))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1422 ;; cover for auto-display output which comes *before*
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1423 ;; stopped annotation
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1424 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1425
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1426 (defun gdb-pre-prompt (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1427 "An annotation handler for `pre-prompt'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1428 This terminates the collection of output from a previous command if that
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1429 happens to be in effect."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1430 (setq gdb-error nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1431 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1432 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1433 ((eq sink 'user) t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1434 ((eq sink 'emacs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1435 (setq gdb-output-sink 'post-emacs))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1436 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1437 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1438 (error "Phase error in gdb-pre-prompt (got %s)" sink)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1439
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1440 (defun gdb-prompt (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1441 "An annotation handler for `prompt'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1442 This sends the next command (if any) to gdb."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1443 (when gdb-first-prompt
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1444 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1445 (propertize "initializing..." 'face font-lock-variable-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1446 (gdb-init-1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1447 (setq gdb-first-prompt nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1448 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1449 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1450 ((eq sink 'user) t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1451 ((eq sink 'post-emacs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1452 (setq gdb-output-sink 'user)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1453 (let ((handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1454 (car (cdr gdb-current-item))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1455 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1456 (funcall handler))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1457 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1458 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1459 (error "Phase error in gdb-prompt (got %s)" sink))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1460 (let ((input (gdb-dequeue-input)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1461 (if input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1462 (gdb-send-item input)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1463 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1464 (setq gdb-prompting t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1465 (gud-display-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1466 (setq gdb-early-user-input (nreverse gdb-early-user-input))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1467 (while gdb-early-user-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1468 (gdb-enqueue-input (car gdb-early-user-input))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1469 (setq gdb-early-user-input (cdr gdb-early-user-input)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1470
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1471 (defun gdb-subprompt (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1472 "An annotation handler for non-top-level prompts."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1473 (setq gdb-prompting t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1474
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1475 (defun gdb-starting (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1476 "An annotation handler for `starting'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1477 This says that I/O for the subprocess is now the program being debugged,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1478 not GDB."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1479 (setq gdb-active-process t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1480 (setq gdb-printing t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1481 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1482 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1483 ((eq sink 'user)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1484 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1485 (setq gud-running t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1486 (setq gdb-stack-update t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1487 ;; Temporarily set gud-running to nil to force "info stack" onto queue.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1488 (let ((gud-running nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1489 (gdb-invalidate-frames)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1490 (unless (or gdb-register-names
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
1491 (string-equal gdb-version "pre-6.4"))
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1492 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1493 (list "server interpreter mi -data-list-register-names\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1494 'gdb-get-register-names))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1495 (setq gdb-inferior-status "running")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1496 (setq gdb-signalled nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1497 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1498 (propertize gdb-inferior-status 'face font-lock-type-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1499 (gdb-remove-text-properties)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1500 (setq gud-old-arrow gud-overlay-arrow-position)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1501 (setq gud-overlay-arrow-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1502 (setq gdb-overlay-arrow-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1503 (setq gdb-stack-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1504 (if gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1505 (setq gdb-output-sink 'inferior))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1506 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1507 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1508 (error "Unexpected `starting' annotation")))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1509
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1510 (defun gdb-signal (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1511 (setq gdb-inferior-status "signal")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1512 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1513 (propertize gdb-inferior-status 'face font-lock-warning-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1514 (gdb-stopping ignored))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1515
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1516 (defun gdb-stopping (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1517 "An annotation handler for `breakpoint' and other annotations.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1518 They say that I/O for the subprocess is now GDB, not the program
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1519 being debugged."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1520 (if gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1521 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1522 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1523 ((eq sink 'inferior)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1524 (setq gdb-output-sink 'user))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1525 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1526 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1527 (error "Unexpected stopping annotation"))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1528
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1529 (defun gdb-exited (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1530 "An annotation handler for `exited' and `signalled'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1531 They say that I/O for the subprocess is now GDB, not the program
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1532 being debugged and that the program is no longer running. This
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1533 function is used to change the focus of GUD tooltips to #define
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1534 directives."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1535 (setq gdb-active-process nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1536 (setq gud-overlay-arrow-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1537 (setq gdb-overlay-arrow-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1538 (setq gdb-stack-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1539 (setq gud-old-arrow nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1540 (setq gdb-inferior-status "exited")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1541 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1542 (propertize gdb-inferior-status 'face font-lock-warning-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1543 (gdb-stopping ignored))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1544
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1545 (defun gdb-signalled (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1546 (setq gdb-signalled t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1547
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1548 (defun gdb-frame-begin (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1549 (setq gdb-frame-begin t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1550 (setq gdb-printing nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1551 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1552 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1553 ((eq sink 'inferior)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1554 (setq gdb-output-sink 'user))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1555 ((eq sink 'user) t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1556 ((eq sink 'emacs) t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1557 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1558 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1559 (error "Unexpected frame-begin annotation (%S)" sink)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1560
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1561 (defcustom gdb-same-frame (not focus-follows-mouse)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1562 "Non-nil means pop up GUD buffer in same frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1563 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1564 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1565 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1566
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1567 (defcustom gdb-find-source-frame nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1568 "Non-nil means try to find a source frame further up stack e.g after signal."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1569 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1570 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1571 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1572
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1573 (defun gdb-find-source-frame (arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1574 "Toggle looking for a source frame further up call stack.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1575 The code associated with current (innermost) frame may not have
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1576 been compiled with debug information, e.g., C library routine.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1577 With prefix argument ARG, look for a source frame further up
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1578 stack to display in the source buffer if ARG is positive,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1579 otherwise don't look further up."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1580 (interactive "P")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1581 (setq gdb-find-source-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1582 (if (null arg)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1583 (not gdb-find-source-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1584 (> (prefix-numeric-value arg) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1585 (message (format "Looking for source frame %sabled"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1586 (if gdb-find-source-frame "en" "dis"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1587
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1588 (defun gdb-stopped (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1589 "An annotation handler for `stopped'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1590 It is just like `gdb-stopping', except that if we already set the output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1591 sink to `user' in `gdb-stopping', that is fine."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1592 (setq gud-running nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1593 (unless (or gud-overlay-arrow-position gud-last-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1594 (if (and gdb-frame-begin gdb-printing)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1595 (setq gud-overlay-arrow-position gud-old-arrow)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1596 ;;Pop up GUD buffer to display current frame when it doesn't have source
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1597 ;;information i.e if not compiled with -g as with libc routines generally.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1598 (if gdb-same-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1599 (gdb-display-gdb-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1600 (gdb-frame-gdb-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1601 (if gdb-find-source-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1602 ;;Try to find source further up stack e.g after signal.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1603 (setq gdb-look-up-stack
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1604 (if (gdb-get-buffer 'gdb-stack-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1605 'keep
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1606 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1607 (gdb-get-buffer-create 'gdb-stack-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1608 (gdb-invalidate-frames)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1609 'delete))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1610 (unless (member gdb-inferior-status '("exited" "signal"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1611 (setq gdb-active-process t) ;Just for attaching case.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1612 (setq gdb-inferior-status "stopped")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1613 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1614 (propertize gdb-inferior-status 'face font-lock-warning-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1615 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1616 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1617 ((eq sink 'inferior)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1618 (setq gdb-output-sink 'user))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1619 ((eq sink 'user) t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1620 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1621 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1622 (error "Unexpected stopped annotation"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1623 (if gdb-signalled (gdb-exited ignored)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1624
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1625 (defun gdb-error (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1626 (setq gdb-error (not gdb-error)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1627
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1628 (defun gdb-thread-changed (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1629 (gdb-frames-force-update))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1630
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1631 (defun gdb-post-prompt (ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1632 "An annotation handler for `post-prompt'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1633 This begins the collection of output from the current command if that
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1634 happens to be appropriate."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1635 ;; Don't add to queue if there outstanding items or gdb-version is not known
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1636 ;; yet.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1637 (unless (or gdb-pending-triggers gdb-first-post-prompt)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1638 (gdb-get-selected-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1639 (gdb-invalidate-frames)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1640 ;; Regenerate breakpoints buffer in case it has been inadvertantly deleted.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1641 (gdb-get-buffer-create 'gdb-breakpoints-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1642 (gdb-invalidate-breakpoints)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1643 ;; Do this through gdb-get-selected-frame -> gdb-frame-handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1644 ;; so gdb-pc-address is updated.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1645 ;; (gdb-invalidate-assembler)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1646
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1647 (if (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1648 (gdb-invalidate-registers)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1649 (gdb-get-changed-registers)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1650 (gdb-invalidate-registers-1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1651
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1652 (gdb-invalidate-memory)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1653 (if (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1654 (gdb-invalidate-locals)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1655 (gdb-invalidate-locals-1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1656
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1657 (gdb-invalidate-threads)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1658 (unless (or (null gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1659 (eq system-type 'darwin)) ;Breaks on Darwin's GDB-5.3.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1660 ;; FIXME: with GDB-6 on Darwin, this might very well work.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1661 ;; Only needed/used with speedbar/watch expressions.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1662 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1663 (if (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1664 (gdb-var-update)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1665 (gdb-var-update-1)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1666 (setq gdb-first-post-prompt nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1667 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1668 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1669 ((eq sink 'user) t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1670 ((eq sink 'pre-emacs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1671 (setq gdb-output-sink 'emacs))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1672 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1673 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1674 (error "Phase error in gdb-post-prompt (got %s)" sink)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1675
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1676 (defconst gdb-buffer-list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1677 '(gdb-stack-buffer gdb-locals-buffer gdb-registers-buffer gdb-threads-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1679 (defun gdb-remove-text-properties ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1680 (dolist (buffertype gdb-buffer-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1681 (let ((buffer (gdb-get-buffer buffertype)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1682 (if buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1683 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1684 (let ((inhibit-read-only t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1685 (remove-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1686 (point-min) (point-max) '(mouse-face nil help-echo nil))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1687
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1688 ;; GUD displays the selected GDB frame. This might might not be the current
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1689 ;; GDB frame (after up, down etc). If no GDB frame is visible but the last
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1690 ;; visited breakpoint is, use that window.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1691 (defun gdb-display-source-buffer (buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1692 (let* ((last-window (if gud-last-last-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1693 (get-buffer-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1694 (gud-find-file (car gud-last-last-frame)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1695 (source-window (or last-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1696 (if (and gdb-source-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1697 (window-live-p gdb-source-window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1698 gdb-source-window))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1699 (when source-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1700 (setq gdb-source-window source-window)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1701 (set-window-buffer source-window buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1702 source-window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1703
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1704 ;; Derived from gud-gdb-marker-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1705 (defvar gdb-fullname-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1706 (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1707
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1708 (defun gud-gdba-marker-filter (string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1709 "A gud marker filter for gdb. Handle a burst of output from GDB."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1710 (if gdb-flush-pending-output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1711 nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1712 (when gdb-enable-debug
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1713 (push (cons 'recv string) gdb-debug-log)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1714 (if (and gdb-debug-log-max
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1715 (> (length gdb-debug-log) gdb-debug-log-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1716 (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1717 ;; Recall the left over gud-marker-acc from last time.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1718 (setq gud-marker-acc (concat gud-marker-acc string))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1719 ;; Start accumulating output for the GUD buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1720 (let ((output ""))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1721 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1722 ;; Process all the complete markers in this chunk.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1723 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1724 (let ((annotation (match-string 1 gud-marker-acc))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1725 (before (substring gud-marker-acc 0 (match-beginning 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1726 (after (substring gud-marker-acc (match-end 0))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1727 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1728 ;; Parse the tag from the annotation, and maybe its arguments.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1729 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1730 (let* ((annotation-type (match-string 1 annotation))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1731 (annotation-arguments (match-string 2 annotation))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1732 (annotation-rule (assoc annotation-type
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1733 gdb-annotation-rules)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1734
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1735 ;; Stuff prior to the match is just ordinary output.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1736 ;; It is either concatenated to OUTPUT or directed
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1737 ;; elsewhere.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1738 (setq output (gdb-concat-output output before))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1739
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1740 ;; Take that stuff off the gud-marker-acc.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1741 (setq gud-marker-acc after)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1742
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1743 ;; Call the handler for this annotation.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1744 (if annotation-rule
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1745 (funcall (car (cdr annotation-rule))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1746 annotation-arguments))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1747
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1748 ;; Else the annotation is not recognized. Ignore it silently,
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1749 ;; so that GDB can add new annotations without causing
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1750 ;; us to blow up.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1751 )))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1752
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1753 ;; Does the remaining text end in a partial line?
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1754 ;; If it does, then keep part of the gud-marker-acc until we get more.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1755 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1756 gud-marker-acc)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1757 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1758 ;; Everything before the potential marker start can be output.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1759 (setq output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1760 (gdb-concat-output output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1761 (substring gud-marker-acc 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1762 (match-beginning 0))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1763 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1764 ;; Everything after, we save, to combine with later input.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1765 (setq gud-marker-acc (substring gud-marker-acc
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1766 (match-beginning 0))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1767 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1768 ;; In case we know the gud-marker-acc contains no partial annotations:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1769 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1770 (setq output (gdb-concat-output output gud-marker-acc))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1771 (setq gud-marker-acc "")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1772 output)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1773
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1774 (defun gdb-concat-output (so-far new)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1775 (if gdb-error
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1776 (put-text-property 0 (length new) 'face font-lock-warning-face new))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1777 (let ((sink gdb-output-sink))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1778 (cond
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1779 ((eq sink 'user) (concat so-far new))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1780 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1781 ((eq sink 'emacs)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1782 (gdb-append-to-partial-output new)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1783 so-far)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1784 ((eq sink 'inferior)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1785 (gdb-append-to-inferior-io new)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1786 so-far)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1787 (t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1788 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1789 (error "Bogon output sink %S" sink)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1790
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1791 (defun gdb-append-to-partial-output (string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1792 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1793 (goto-char (point-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1794 (insert string)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1795
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1796 (defun gdb-clear-partial-output ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1797 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1798 (erase-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1799
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1800 (defun gdb-append-to-inferior-io (string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1801 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1802 (goto-char (point-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1803 (insert-before-markers string))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1804 (if (not (string-equal string ""))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1805 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1806
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1807 (defun gdb-clear-inferior-io ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1808 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1809 (erase-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1810
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1811 (defun gdb-jsonify-buffer (&optional fix-key fix-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1812 "Prepare GDB/MI output in current buffer for parsing with `json-read'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1813
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1814 Field names are wrapped in double quotes and equal signs are
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1815 replaced with semicolons.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1816
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1817 If FIX-KEY is non-nil, strip all \"FIX-KEY=\" occurences from
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
1818 partial output. This is used to get rid of useless keys in lists
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
1819 in MI messages, e.g.: [key=.., key=..]. -stack-list-frames and
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1820 -break-info are examples of MI commands which issue such
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1821 responses.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1822
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1823 If FIX-LIST is non-nil, \"FIX-LIST={..}\" is replaced with
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
1824 \"FIX-LIST=[..]\" prior to parsing. This is used to fix broken
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1825 -break-info output when it contains breakpoint script field
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1826 incompatible with GDB/MI output syntax."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1827 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1828 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1829 ;; Sometimes missing symbol information precedes "^done" record.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1830 (re-search-forward "[[:ascii:]]*?\\^done," nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1831 (replace-match "")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1832 (re-search-forward "(gdb) \n" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1833 (replace-match "")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1834 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1835 (when fix-key
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1836 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1837 (while (re-search-forward (concat "[\\[,]\\(" fix-key "=\\)") nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1838 (replace-match "" nil nil nil 1))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1839 (when fix-list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1840 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1841 ;; Find positions of braces which enclose broken list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1842 (while (re-search-forward (concat fix-list "={\"") nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1843 (let ((p1 (goto-char (- (point) 2)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1844 (p2 (progn (forward-sexp)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1845 (1- (point)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1846 ;; Replace braces with brackets
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1847 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1848 (goto-char p1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1849 (delete-char 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1850 (insert "[")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1851 (goto-char p2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1852 (delete-char 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1853 (insert "]"))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1854 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1855 (insert "{")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1856 (while (re-search-forward
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1857 "\\([[:alnum:]-_]+\\)=\\({\\|\\[\\|\"\"\\|\".*?[^\\]\"\\)" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1858 (replace-match "\"\\1\":\\2" nil nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1859 (goto-char (point-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1860 (insert "}")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1861
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1862 (defun gdb-json-read-buffer (&optional fix-key fix-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1863 "Prepare and parse GDB/MI output in current buffer with `json-read'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1864
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1865 FIX-KEY and FIX-LIST work as in `gdb-jsonify-buffer'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1866 (gdb-jsonify-buffer fix-key fix-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1867 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1868 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1869 (let ((json-array-type 'list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1870 (json-read))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1871
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1872 (defun gdb-json-partial-output (&optional fix-key fix-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1873 "Prepare and parse gdb-partial-output-buffer with `json-read'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1874
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1875 FIX-KEY and FIX-KEY work as in `gdb-jsonify-buffer'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1876 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1877 (gdb-json-read-buffer fix-key fix-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1878
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1879
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1880 ;; One trick is to have a command who's output is always available in a buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1881 ;; of it's own, and is always up to date. We build several buffers of this
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1882 ;; type.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1883 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1884 ;; There are two aspects to this: gdb has to tell us when the output for that
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1885 ;; command might have changed, and we have to be able to run the command
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1886 ;; behind the user's back.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1887 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1888 ;; The output phasing associated with the variable gdb-output-sink
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1889 ;; help us to run commands behind the user's back.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1890 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1891 ;; Below is the code for specificly managing buffers of output from one
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1892 ;; command.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1893 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1894
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1895 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1896 ;; It adds an input for the command we are tracking. It should be the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1897 ;; annotation rule binding of whatever gdb sends to tell us this command
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1898 ;; might have changed it's output.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1899 ;;
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
1900 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed.
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1901 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1902 ;; input in the input queue (see comment about ``gdb communications'' above).
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1903
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1904 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1905 output-handler)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1906 `(defun ,name (&optional ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1907 (if (and ,demand-predicate
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1908 (not (member ',name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1909 gdb-pending-triggers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1910 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1911 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1912 (list ,gdb-command ',output-handler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1913 (push ',name gdb-pending-triggers)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1914
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1915 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1916 `(defun ,name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1917 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1918 (delq ',trigger
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1919 gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1920 (let ((buf (gdb-get-buffer ',buf-key)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1921 (and buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1922 (with-current-buffer buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1923 (let* ((window (get-buffer-window buf 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1924 (start (window-start window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1925 (p (if window (window-point window) (point)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1926 (buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1927 (erase-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1928 (insert-buffer-substring (gdb-get-buffer-create
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1929 'gdb-partial-output-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1930 (if window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1931 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1932 (set-window-start window start)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1933 (set-window-point window p))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1934 (goto-char p))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1935 ;; put customisation here
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1936 (,custom-defun)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1937
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1938 (defmacro def-gdb-auto-updated-buffer (buffer-key
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1939 trigger-name gdb-command
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1940 output-handler-name custom-defun)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1941 `(progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1942 (def-gdb-auto-update-trigger ,trigger-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1943 ;; The demand predicate:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1944 (gdb-get-buffer ',buffer-key)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1945 ,gdb-command
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1946 ,output-handler-name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1947 (def-gdb-auto-update-handler ,output-handler-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1948 ,trigger-name ,buffer-key ,custom-defun)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1949
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1950
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1951 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1952 ;; Breakpoint buffer : This displays the output of `info breakpoints'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1953 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1954 (gdb-set-buffer-rules 'gdb-breakpoints-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1955 'gdb-breakpoints-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1956 'gdb-breakpoints-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1957
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1958 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1959 ;; This defines the auto update rule for buffers of type
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1960 ;; `gdb-breakpoints-buffer'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1961 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1962 ;; It defines a function to serve as the annotation handler that
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1963 ;; handles the `foo-invalidated' message. That function is called:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1964 gdb-invalidate-breakpoints
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1965 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1966 ;; To update the buffer, this command is sent to gdb.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1967 "server info breakpoints\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1968 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1969 ;; This also defines a function to be the handler for the output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1970 ;; from the command above. That function will copy the output into
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1971 ;; the appropriately typed buffer. That function will be called:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1972 gdb-info-breakpoints-handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1973 ;; buffer specific functions
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1974 gdb-info-breakpoints-custom)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1975
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1976 (defconst breakpoint-xpm-data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1977 "/* XPM */
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1978 static char *magick[] = {
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1979 /* columns rows colors chars-per-pixel */
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1980 \"10 10 2 1\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1981 \" c red\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1982 \"+ c None\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1983 /* pixels */
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1984 \"+++ +++\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1985 \"++ ++\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1986 \"+ +\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1987 \" \",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1988 \" \",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1989 \" \",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1990 \" \",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1991 \"+ +\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1992 \"++ ++\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1993 \"+++ +++\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1994 };"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1995 "XPM data used for breakpoint icon.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1996
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1997 (defconst breakpoint-enabled-pbm-data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1998 "P1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1999 10 10\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2000 0 0 0 0 1 1 1 1 0 0 0 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2001 0 0 0 1 1 1 1 1 1 0 0 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2002 0 0 1 1 1 1 1 1 1 1 0 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2003 0 1 1 1 1 1 1 1 1 1 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2004 0 1 1 1 1 1 1 1 1 1 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2005 0 1 1 1 1 1 1 1 1 1 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2006 0 1 1 1 1 1 1 1 1 1 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2007 0 0 1 1 1 1 1 1 1 1 0 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2008 0 0 0 1 1 1 1 1 1 0 0 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2009 0 0 0 0 1 1 1 1 0 0 0 0"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2010 "PBM data used for enabled breakpoint icon.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2011
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2012 (defconst breakpoint-disabled-pbm-data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2013 "P1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2014 10 10\",
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2015 0 0 1 0 1 0 1 0 0 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2016 0 1 0 1 0 1 0 1 0 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2017 1 0 1 0 1 0 1 0 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2018 0 1 0 1 0 1 0 1 0 1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2019 1 0 1 0 1 0 1 0 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2020 0 1 0 1 0 1 0 1 0 1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2021 1 0 1 0 1 0 1 0 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2022 0 1 0 1 0 1 0 1 0 1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2023 0 0 1 0 1 0 1 0 1 0
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2024 0 0 0 1 0 1 0 1 0 0"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2025 "PBM data used for disabled breakpoint icon.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2026
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2027 (defvar breakpoint-enabled-icon nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2028 "Icon for enabled breakpoint in display margin.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2029
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2030 (defvar breakpoint-disabled-icon nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2031 "Icon for disabled breakpoint in display margin.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2032
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2033 (declare-function define-fringe-bitmap "fringe.c"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2034 (bitmap bits &optional height width align))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2035
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2036 (and (display-images-p)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2037 ;; Bitmap for breakpoint in fringe
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2038 (define-fringe-bitmap 'breakpoint
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2039 "\x3c\x7e\xff\xff\xff\xff\x7e\x3c")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2040 ;; Bitmap for gud-overlay-arrow in fringe
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2041 (define-fringe-bitmap 'hollow-right-triangle
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2042 "\xe0\x90\x88\x84\x84\x88\x90\xe0"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2043
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2044 (defface breakpoint-enabled
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2045 '((t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2046 :foreground "red1"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2047 :weight bold))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2048 "Face for enabled breakpoint icon in fringe."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2049 :group 'gdb)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2050
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2051 (defface breakpoint-disabled
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2052 '((((class color) (min-colors 88)) :foreground "grey70")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2053 ;; Ensure that on low-color displays that we end up something visible.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2054 (((class color) (min-colors 8) (background light))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2055 :foreground "black")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2056 (((class color) (min-colors 8) (background dark))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2057 :foreground "white")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2058 (((type tty) (class mono))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2059 :inverse-video t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2060 (t :background "gray"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2061 "Face for disabled breakpoint icon in fringe."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2062 :group 'gdb)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2063
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2064 (defconst gdb-breakpoint-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2065 "\\(?:\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\|\\([0-9]+\\.[0-9]+\\)\\)\\s-+\\(.\\)\\s-+")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2066
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2067 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer).
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2068 (defun gdb-info-breakpoints-custom ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2069 (let ((flag) (bptno))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2070 ;; Remove all breakpoint-icons in source buffers but not assembler buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2071 (dolist (buffer (buffer-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2072 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2073 (if (and (memq gud-minor-mode '(gdba gdbmi))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2074 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2075 (gdb-remove-breakpoint-icons (point-min) (point-max)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2076 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2077 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2078 (let ((buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2079 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2080 (while (< (point) (- (point-max) 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2081 (forward-line 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2082 (if (looking-at gdb-breakpoint-regexp)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2083 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2084 (setq bptno (or (match-string 1) (match-string 2)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2085 (setq flag (char-after (match-beginning 3)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2086 (if (match-string 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2087 (setq gdb-parent-bptno-enabled (eq flag ?y)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2088 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2089 (match-beginning 3) (match-end 3)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2090 (if (eq flag ?y)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2091 '(face font-lock-warning-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2092 '(face font-lock-type-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2093 (let ((bl (point))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2094 (el (line-end-position)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2095 (when (re-search-forward " in \\(.*\\) at" el t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2096 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2097 (match-beginning 1) (match-end 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2098 '(face font-lock-function-name-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2099 (if (re-search-forward
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2100 ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$" el t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2101 (let ((line (match-string 2))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2102 (file (match-string 1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2103 (add-text-properties bl el
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2104 '(mouse-face highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2105 help-echo "mouse-2, RET: visit breakpoint"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2106 (unless (file-exists-p file)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2107 (setq file (cdr (assoc bptno gdb-location-alist))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2108 (if (and file
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2109 (not (string-equal file "File not found")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2110 (with-current-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2111 (find-file-noselect file 'nowarn)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2112 (gdb-init-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2113 ;; Only want one breakpoint icon at each
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2114 ;; location.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2115 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2116 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2117 (forward-line (1- (string-to-number line)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2118 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2119 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2120 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2121 (concat gdb-server-prefix "list "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2122 (match-string-no-properties 1) ":1\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2123 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2124 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2125 (list (concat gdb-server-prefix "info source\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2126 `(lambda () (gdb-get-location
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2127 ,bptno ,line ,flag))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2128 (if (re-search-forward
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2129 "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2130 el t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2131 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2132 (match-beginning 1) (match-end 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2133 '(face font-lock-function-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2134 (end-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2135 (re-search-backward "\\s-\\(\\S-*\\)"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2136 bl t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2137 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2138 (match-beginning 1) (match-end 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2139 '(face font-lock-variable-name-face)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2140 (end-of-line))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2141 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2142
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2143 ;; Breakpoints buffer is always present. Hack to just update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2144 ;; current frame if there's been no execution.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2145 (if gdb-stack-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2146 (setq gdb-stack-update nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2147 (if (gdb-get-buffer 'gdb-stack-buffer) (gdb-info-stack-custom))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2148
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2149 (declare-function gud-remove "gdb-ui" t t) ; gud-def
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2150 (declare-function gud-break "gdb-ui" t t) ; gud-def
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2151 (declare-function fringe-bitmaps-at-pos "fringe.c" (&optional pos window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2152
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2153 (defun gdb-mouse-set-clear-breakpoint (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2154 "Set/clear breakpoint in left fringe/margin at mouse click.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2155 If not in a source or disassembly buffer just set point."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2156 (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2157 (mouse-minibuffer-check event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2158 (let ((posn (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2159 (with-selected-window (posn-window posn)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2160 (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2161 (if (numberp (posn-point posn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2162 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2163 (goto-char (posn-point posn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2164 (if (or (posn-object posn)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2165 (eq (car (fringe-bitmaps-at-pos (posn-point posn)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2166 'breakpoint))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2167 (gud-remove nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2168 (gud-break nil)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2169 (posn-set-point posn))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2170
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2171 (defun gdb-mouse-toggle-breakpoint-margin (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2172 "Enable/disable breakpoint in left margin with mouse click."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2173 (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2174 (mouse-minibuffer-check event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2175 (let ((posn (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2176 (if (numberp (posn-point posn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2177 (with-selected-window (posn-window posn)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2178 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2179 (goto-char (posn-point posn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2180 (if (posn-object posn)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2181 (let* ((bptno (get-text-property
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2182 0 'gdb-bptno (car (posn-string posn)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2183 (string-match "\\([0-9+]\\)*" bptno)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2184 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2185 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2186 (concat gdb-server-prefix
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2187 (if (get-text-property
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2188 0 'gdb-enabled (car (posn-string posn)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2189 "disable "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2190 "enable ")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2191 (match-string 1 bptno) "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2192 'ignore)))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2193
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2194 (defun gdb-mouse-toggle-breakpoint-fringe (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2195 "Enable/disable breakpoint in left fringe with mouse click."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2196 (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2197 (mouse-minibuffer-check event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2198 (let* ((posn (event-end event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2199 (pos (posn-point posn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2200 obj)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2201 (when (numberp pos)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2202 (with-selected-window (posn-window posn)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2203 (with-current-buffer (window-buffer (selected-window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2204 (goto-char pos)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2205 (dolist (overlay (overlays-in pos pos))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2206 (when (overlay-get overlay 'put-break)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2207 (setq obj (overlay-get overlay 'before-string))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2208 (when (stringp obj)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2209 (let* ((bptno (get-text-property 0 'gdb-bptno obj)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2210 (string-match "\\([0-9+]\\)*" bptno)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2211 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2212 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2213 (concat gdb-server-prefix
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2214 (if (get-text-property 0 'gdb-enabled obj)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2215 "disable "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2216 "enable ")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2217 (match-string 1 bptno) "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2218 'ignore)))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2219
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2220 (defun gdb-breakpoints-buffer-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2221 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2222 (concat "*breakpoints of " (gdb-get-target-string) "*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2223
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2224 (defun gdb-display-breakpoints-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2225 "Display status of user-settable breakpoints."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2226 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2227 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2228 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2229
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2230 (defun gdb-frame-breakpoints-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2231 "Display status of user-settable breakpoints in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2232 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2233 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2234 (special-display-frame-alist gdb-frame-parameters))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2235 (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2236
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2237 (defvar gdb-breakpoints-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2238 (let ((map (make-sparse-keymap))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2239 (menu (make-sparse-keymap "Breakpoints")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2240 (define-key menu [quit] '("Quit" . gdb-delete-frame-or-window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2241 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2242 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2243 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2244 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2245 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2246 (define-key map " " 'gdb-toggle-breakpoint)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2247 (define-key map "D" 'gdb-delete-breakpoint)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2248 ;; Don't bind "q" to kill-this-buffer as we need it for breakpoint icons.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2249 (define-key map "q" 'gdb-delete-frame-or-window)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2250 (define-key map "\r" 'gdb-goto-breakpoint)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2251 (define-key map [mouse-2] 'gdb-goto-breakpoint)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2252 (define-key map [follow-link] 'mouse-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2253 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2254
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2255 (defun gdb-delete-frame-or-window ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2256 "Delete frame if there is only one window. Otherwise delete the window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2257 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2258 (if (one-window-p) (delete-frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2259 (delete-window)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2260
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2261 ;;from make-mode-line-mouse-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2262 (defun gdb-make-header-line-mouse-map (mouse function) "\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2263 Return a keymap with single entry for mouse key MOUSE on the header line.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2264 MOUSE is defined to run function FUNCTION with no args in the buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2265 corresponding to the mode line clicked."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2266 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2267 (define-key map (vector 'header-line mouse) function)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2268 (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2269 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2270
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2271 (defmacro gdb-propertize-header (name buffer help-echo mouse-face face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2272 `(propertize ,name
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
2273 'help-echo ,help-echo
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2274 'mouse-face ',mouse-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2275 'face ',face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2276 'local-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2277 (gdb-make-header-line-mouse-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2278 'mouse-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2279 (lambda (event) (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2280 (save-selected-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2281 (select-window (posn-window (event-start event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2282 (set-window-dedicated-p (selected-window) nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2283 (switch-to-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2284 (gdb-get-buffer-create ',buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2285 (setq header-line-format(gdb-set-header ',buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2286 (set-window-dedicated-p (selected-window) t))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2287
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2288 (defun gdb-set-header (buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2289 (cond ((eq buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2290 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2291 (gdb-propertize-header "Locals" gdb-locals-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2292 nil nil mode-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2293 " "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2294 (gdb-propertize-header "Registers" gdb-registers-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2295 "mouse-1: select" mode-line-highlight mode-line-inactive)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2296 ((eq buffer 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2297 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2298 (gdb-propertize-header "Locals" gdb-locals-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2299 "mouse-1: select" mode-line-highlight mode-line-inactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2300 " "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2301 (gdb-propertize-header "Registers" gdb-registers-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2302 nil nil mode-line)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2303 ((eq buffer 'gdb-breakpoints-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2304 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2305 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2306 nil nil mode-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2307 " "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2308 (gdb-propertize-header "Threads" gdb-threads-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2309 "mouse-1: select" mode-line-highlight mode-line-inactive)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2310 ((eq buffer 'gdb-threads-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2311 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2312 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2313 "mouse-1: select" mode-line-highlight mode-line-inactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2314 " "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2315 (gdb-propertize-header "Threads" gdb-threads-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2316 nil nil mode-line)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2317
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2318 (defvar gdb-breakpoints-header
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2319 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2320 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2321 nil nil mode-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2322 " "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2323 (gdb-propertize-header "Threads" gdb-threads-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2324 "mouse-1: select" mode-line-highlight mode-line-inactive)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2325
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2326 (defun gdb-breakpoints-mode ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2327 "Major mode for gdb breakpoints.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2328
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2329 \\{gdb-breakpoints-mode-map}"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2330 (kill-all-local-variables)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2331 (setq major-mode 'gdb-breakpoints-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2332 (setq mode-name "Breakpoints")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2333 (use-local-map gdb-breakpoints-mode-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2334 (setq buffer-read-only t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2335 (buffer-disable-undo)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2336 (setq header-line-format gdb-breakpoints-header)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2337 (run-mode-hooks 'gdb-breakpoints-mode-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2338 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2339 'gdb-invalidate-breakpoints
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2340 'gdbmi-invalidate-breakpoints))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2341
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2342 (defun gdb-toggle-breakpoint ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2343 "Enable/disable breakpoint at current line."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2344 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2345 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2346 (beginning-of-line 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2347 (if (looking-at gdb-breakpoint-regexp)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2348 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2349 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2350 (concat gdb-server-prefix
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2351 (if (eq ?y (char-after (match-beginning 3)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2352 "disable "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2353 "enable ")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2354 (or (match-string 1) (match-string 2)) "\n") 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2355 (error "Not recognized as break/watchpoint line"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2356
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2357 (defun gdb-delete-breakpoint ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2358 "Delete the breakpoint at current line."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2359 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2360 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2361 (beginning-of-line 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2362 (if (looking-at gdb-breakpoint-regexp)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2363 (if (match-string 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2364 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2365 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2366 (concat gdb-server-prefix "delete " (match-string 1) "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2367 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2368 (message-box "This breakpoint cannot be deleted on its own."))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2369 (error "Not recognized as break/watchpoint line"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2370
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2371 (defun gdb-goto-breakpoint (&optional event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2372 "Display the breakpoint location specified at current line."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2373 (interactive (list last-input-event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2374 (if event (posn-set-point (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2375 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2376 (beginning-of-line 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2377 (if (looking-at "\\([0-9]+\\.?[0-9]*\\) .*\\s-+\\(\\S-+\\):\\([0-9]+\\)$")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2378 (let ((bptno (match-string 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2379 (file (match-string 2))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2380 (line (match-string 3)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2381 (save-selected-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2382 (let* ((buffer (find-file-noselect
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2383 (if (file-exists-p file) file
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2384 (cdr (assoc bptno gdb-location-alist)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2385 (window (or (gdb-display-source-buffer buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2386 (display-buffer buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2387 (setq gdb-source-window window)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2388 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2389 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2390 (forward-line (1- (string-to-number line)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2391 (set-window-point window (point))))))
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
2392 (error "No location specified"))))
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2393
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2394
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2395 ;; Frames buffer. This displays a perpetually correct backtrace
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2396 ;; (from the command `where').
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2397 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2398 ;; Alas, if your stack is deep, it is costly.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2399 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2400 (defcustom gdb-max-frames 40
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2401 "Maximum number of frames displayed in call stack."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2402 :type 'integer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2403 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2404 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2405
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2406 (gdb-set-buffer-rules 'gdb-stack-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2407 'gdb-stack-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2408 'gdb-frames-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2409
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2410 (def-gdb-auto-updated-buffer gdb-stack-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2411 gdb-invalidate-frames
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2412 (concat "server info stack " (number-to-string gdb-max-frames) "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2413 gdb-info-stack-handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2414 gdb-info-stack-custom)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2415
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2416 ;; This may be more important for embedded targets where unwinding the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2417 ;; stack may take a long time.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2418 (defadvice gdb-invalidate-frames (around gdb-invalidate-frames-advice
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2419 (&optional ignored) activate compile)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2420 "Only queue \"info stack\" if execution has occurred."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2421 (if gdb-stack-update ad-do-it))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2422
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2423 (defun gdb-info-stack-custom ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2424 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2425 (let (move-to)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2426 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2427 (unless (eq gdb-look-up-stack 'delete)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2428 (let ((buffer-read-only nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2429 bl el)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2430 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2431 (while (< (point) (point-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2432 (setq bl (line-beginning-position)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2433 el (line-end-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2434 (when (looking-at "#")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2435 (add-text-properties bl el
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2436 '(mouse-face highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2437 help-echo "mouse-2, RET: Select frame")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2438 (goto-char bl)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2439 (when (looking-at "^#\\([0-9]+\\)")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2440 (when (string-equal (match-string 1) gdb-frame-number)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2441 (if (gud-tool-bar-item-visible-no-fringe)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2442 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2443 (put-text-property bl (+ bl 4)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2444 'face '(:inverse-video t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2445 (setq move-to bl))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2446 (or gdb-stack-position
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2447 (setq gdb-stack-position (make-marker)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2448 (set-marker gdb-stack-position (point))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2449 (setq move-to gdb-stack-position)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2450 (when (re-search-forward "\\([^ ]+\\) (" el t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2451 (put-text-property (match-beginning 1) (match-end 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2452 'face font-lock-function-name-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2453 (setq bl (match-end 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2454 (while (re-search-forward "<\\([^>]+\\)>" el t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2455 (put-text-property (match-beginning 1) (match-end 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2456 'face font-lock-function-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2457 (goto-char bl)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2458 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2459 (put-text-property (match-beginning 1) (match-end 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2460 'face font-lock-variable-name-face))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2461 (forward-line 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2462 (forward-line -1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2463 (when (looking-at "(More stack frames follow...)")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2464 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2465 (match-beginning 0) (match-end 0)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2466 '(mouse-face highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2467 gdb-max-frames t
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2468 help-echo
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2469 "mouse-2, RET: customize gdb-max-frames to see more frames"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2470 )))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2471 (when gdb-look-up-stack
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2472 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2473 (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2474 (let ((start (line-beginning-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2475 (file (match-string 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2476 (line (match-string 2)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2477 (re-search-backward "^#*\\([0-9]+\\)" start t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2478 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2479 (list (concat gdb-server-prefix "frame "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2480 (match-string 1) "\n") 'gdb-set-hollow))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2481 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2482 (list (concat gdb-server-prefix "frame 0\n") 'ignore))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2483 (when move-to
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2484 (let ((window (get-buffer-window (current-buffer) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2485 (when window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2486 (with-selected-window window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2487 (goto-char move-to)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2488 (unless (pos-visible-in-window-p)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2489 (recenter '(center)))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2490 (if (eq gdb-look-up-stack 'delete)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2491 (kill-buffer (gdb-get-buffer 'gdb-stack-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2492 (setq gdb-look-up-stack nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2493
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2494 (defun gdb-set-hollow ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2495 (if gud-last-last-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2496 (with-current-buffer (gud-find-file (car gud-last-last-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2497 (setq fringe-indicator-alist
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2498 '((overlay-arrow . hollow-right-triangle))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2499
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2500 (defun gdb-stack-buffer-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2501 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2502 (concat "*stack frames of " (gdb-get-target-string) "*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2503
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2504 (defun gdb-display-stack-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2505 "Display backtrace of current stack."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2506 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2507 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2508 (gdb-get-buffer-create 'gdb-stack-buffer) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2509
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2510 (defun gdb-frame-stack-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2511 "Display backtrace of current stack in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2512 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2513 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2514 (special-display-frame-alist gdb-frame-parameters))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2515 (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2516
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2517 (defvar gdb-frames-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2518 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2519 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2520 (define-key map "q" 'kill-this-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2521 (define-key map "\r" 'gdb-frames-select)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2522 (define-key map "F" 'gdb-frames-force-update)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2523 (define-key map [mouse-2] 'gdb-frames-select)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2524 (define-key map [follow-link] 'mouse-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2525 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2526
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2527 (declare-function gdbmi-invalidate-frames "ext:gdb-mi" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2528
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2529 (defun gdb-frames-force-update ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2530 "Force update of call stack.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2531 Use when the displayed call stack gets out of sync with the
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2532 actual one, e.g after using the Gdb command \"return\" or setting
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2533 $pc directly from the GUD buffer. This command isn't normally needed."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2534 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2535 (setq gdb-stack-update t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2536 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2537 (gdb-invalidate-frames)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2538 (gdbmi-invalidate-frames)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2539
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2540 (defun gdb-frames-mode ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2541 "Major mode for gdb call stack.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2542
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2543 \\{gdb-frames-mode-map}"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2544 (kill-all-local-variables)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2545 (setq major-mode 'gdb-frames-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2546 (setq mode-name "Frames")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2547 (setq gdb-stack-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2548 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2549 (setq truncate-lines t) ;; Make it easier to see overlay arrow.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2550 (setq buffer-read-only t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2551 (buffer-disable-undo)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2552 (gdb-thread-identification)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2553 (use-local-map gdb-frames-mode-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2554 (run-mode-hooks 'gdb-frames-mode-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2555 (setq gdb-stack-update t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2556 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2557 'gdb-invalidate-frames
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2558 'gdbmi-invalidate-frames))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2559
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2560 (defun gdb-get-frame-number ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2561 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2562 (end-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2563 (let* ((start (line-beginning-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2564 (pos (re-search-backward "^#*\\([0-9]+\\)" start t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2565 (n (or (and pos (match-string 1)) "0")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2566 n)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2567
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2568 (defun gdb-frames-select (&optional event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2569 "Select the frame and display the relevant source."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2570 (interactive (list last-input-event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2571 (if event (posn-set-point (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2572 (if (get-text-property (point) 'gdb-max-frames)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2573 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2574 (message-box "After setting gdb-max-frames, you need to enter\n\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2575 another GDB command e.g pwd, to see new frames")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2576 (customize-variable-other-window 'gdb-max-frames))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2577 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2578 (list (concat gdb-server-prefix "frame "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2579 (gdb-get-frame-number) "\n") 'ignore))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2580
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2581
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2582 ;; Threads buffer. This displays a selectable thread list.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2583 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2584 (gdb-set-buffer-rules 'gdb-threads-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2585 'gdb-threads-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2586 'gdb-threads-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2587
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2588 (def-gdb-auto-updated-buffer gdb-threads-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2589 gdb-invalidate-threads
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2590 (concat gdb-server-prefix "info threads\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2591 gdb-info-threads-handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2592 gdb-info-threads-custom)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2593
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2594 (defun gdb-info-threads-custom ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2595 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2596 (let ((buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2597 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2598 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2599 (if (re-search-forward "\\* \\([0-9]+\\)" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2600 (setq gdb-thread-indicator
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2601 (propertize (concat " [" (match-string 1) "]")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2602 ; FIXME: this help-echo doesn't work
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2603 'help-echo "thread id")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2604 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2605 (while (< (point) (point-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2606 (unless (looking-at "No ")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2607 (add-text-properties (line-beginning-position) (line-end-position)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2608 '(mouse-face highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2609 help-echo "mouse-2, RET: select thread")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2610 (forward-line 1))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2611
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2612 (defun gdb-threads-buffer-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2613 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2614 (concat "*threads of " (gdb-get-target-string) "*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2615
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2616 (defun gdb-display-threads-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2617 "Display IDs of currently known threads."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2618 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2619 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2620 (gdb-get-buffer-create 'gdb-threads-buffer) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2621
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2622 (defun gdb-frame-threads-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2623 "Display IDs of currently known threads in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2624 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2625 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2626 (special-display-frame-alist gdb-frame-parameters))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2627 (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2628
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2629 (defvar gdb-threads-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2630 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2631 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2632 (define-key map "q" 'kill-this-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2633 (define-key map "\r" 'gdb-threads-select)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2634 (define-key map [mouse-2] 'gdb-threads-select)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2635 (define-key map [follow-link] 'mouse-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2636 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2637
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2638 (defvar gdb-threads-font-lock-keywords
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2639 '((") +\\([^ ]+\\) (" (1 font-lock-function-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2640 ("in \\([^ ]+\\) (" (1 font-lock-function-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2641 ("\\(\\(\\sw\\|[_.]\\)+\\)=" (1 font-lock-variable-name-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2642 "Font lock keywords used in `gdb-threads-mode'.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2643
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2644 (defun gdb-threads-mode ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2645 "Major mode for gdb threads.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2646
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2647 \\{gdb-threads-mode-map}"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2648 (kill-all-local-variables)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2649 (setq major-mode 'gdb-threads-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2650 (setq mode-name "Threads")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2651 (setq buffer-read-only t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2652 (buffer-disable-undo)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2653 (setq header-line-format gdb-breakpoints-header)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2654 (use-local-map gdb-threads-mode-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2655 (set (make-local-variable 'font-lock-defaults)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2656 '(gdb-threads-font-lock-keywords))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2657 (run-mode-hooks 'gdb-threads-mode-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2658 ;; Force "info threads" onto queue.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2659 (lambda () (let ((gud-running nil)) (gdb-invalidate-threads))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2660
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2661 (defun gdb-get-thread-number ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2662 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2663 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2664 (match-string-no-properties 1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2665
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2666 (defun gdb-threads-select (&optional event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2667 "Select the thread and display the relevant source."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2668 (interactive (list last-input-event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2669 (if event (posn-set-point (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2670 (setq gdb-stack-update t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2671 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2672 (list (concat gdb-server-prefix "thread "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2673 (gdb-get-thread-number) "\n") 'ignore))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2674 (gud-display-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2675
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2676 (defun gdb-thread-identification ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2677 (setq mode-line-buffer-identification
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2678 (list (car mode-line-buffer-identification)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2679 '(gdb-thread-indicator gdb-thread-indicator))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2680
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2681 ;; Registers buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2682 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2683 (defcustom gdb-all-registers nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2684 "Non-nil means include floating-point registers."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2685 :type 'boolean
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2686 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2687 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2688
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2689 (gdb-set-buffer-rules 'gdb-registers-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2690 'gdb-registers-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2691 'gdb-registers-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2692
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2693 (def-gdb-auto-updated-buffer gdb-registers-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2694 gdb-invalidate-registers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2695 (concat
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2696 gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2697 gdb-info-registers-handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2698 gdb-info-registers-custom)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2699
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2700 (defun gdb-info-registers-custom ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2701 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2702 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2703 (let ((buffer-read-only nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2704 start end)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2705 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2706 (while (< (point) (point-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2707 (setq start (line-beginning-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2708 (setq end (line-end-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2709 (when (looking-at "^[^ ]+")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2710 (unless (string-equal (match-string 0) "The")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2711 (put-text-property start (match-end 0)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2712 'face font-lock-variable-name-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2713 (add-text-properties start end
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2714 '(help-echo "mouse-2: edit value"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2715 mouse-face highlight))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2716 (forward-line 1))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2717
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2718 (defun gdb-edit-register-value (&optional event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2719 (interactive (list last-input-event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2720 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2721 (if event (posn-set-point (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2722 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2723 (let* ((register (current-word))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2724 (value (read-string (format "New value (%s): " register))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2725 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2726 (list (concat gdb-server-prefix "set $" register "=" value "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2727 'ignore)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2728
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2729 (defvar gdb-registers-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2730 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2731 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2732 (define-key map "\r" 'gdb-edit-register-value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2733 (define-key map [mouse-2] 'gdb-edit-register-value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2734 (define-key map " " 'gdb-all-registers)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2735 (define-key map "q" 'kill-this-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2736 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2737
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2738 (defvar gdb-locals-header
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2739 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2740 (gdb-propertize-header "Locals" gdb-locals-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2741 nil nil mode-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2742 " "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2743 (gdb-propertize-header "Registers" gdb-registers-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2744 "mouse-1: select" mode-line-highlight mode-line-inactive)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2745
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2746
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2747 (defun gdb-registers-mode ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2748 "Major mode for gdb registers.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2749
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2750 \\{gdb-registers-mode-map}"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2751 (kill-all-local-variables)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2752 (setq major-mode 'gdb-registers-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2753 (setq mode-name "Registers")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2754 (setq header-line-format gdb-locals-header)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2755 (setq buffer-read-only t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2756 (buffer-disable-undo)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2757 (gdb-thread-identification)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2758 (use-local-map gdb-registers-mode-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2759 (run-mode-hooks 'gdb-registers-mode-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2760 (if (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2761 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2762 (if gdb-all-registers (setq mode-name "Registers:All"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2763 'gdb-invalidate-registers)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2764 'gdb-invalidate-registers-1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2765
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2766 (defun gdb-registers-buffer-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2767 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2768 (concat "*registers of " (gdb-get-target-string) "*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2769
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2770 (defun gdb-display-registers-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2771 "Display integer register contents."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2772 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2773 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2774 (gdb-get-buffer-create 'gdb-registers-buffer) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2775
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2776 (defun gdb-frame-registers-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2777 "Display integer register contents in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2778 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2779 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2780 (special-display-frame-alist gdb-frame-parameters))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2781 (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2782
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2783 (defun gdb-all-registers ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2784 "Toggle the display of floating-point registers (pre GDB 6.4 only)."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2785 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2786 (when (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2787 (if gdb-all-registers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2788 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2789 (setq gdb-all-registers nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2790 (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2791 (setq mode-name "Registers")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2792 (setq gdb-all-registers t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2793 (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2794 (setq mode-name "Registers:All")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2795 (message (format "Display of floating-point registers %sabled"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2796 (if gdb-all-registers "en" "dis")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2797 (gdb-invalidate-registers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2798
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2799
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2800 ;; Memory buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2801 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2802 (defcustom gdb-memory-repeat-count 32
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2803 "Number of data items in memory window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2804 :type 'integer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2805 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2806 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2807
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2808 (defcustom gdb-memory-format "x"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2809 "Display format of data items in memory window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2810 :type '(choice (const :tag "Hexadecimal" "x")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2811 (const :tag "Signed decimal" "d")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2812 (const :tag "Unsigned decimal" "u")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2813 (const :tag "Octal" "o")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2814 (const :tag "Binary" "t"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2815 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2816 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2817
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2818 (defcustom gdb-memory-unit "w"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2819 "Unit size of data items in memory window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2820 :type '(choice (const :tag "Byte" "b")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2821 (const :tag "Halfword" "h")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2822 (const :tag "Word" "w")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2823 (const :tag "Giant word" "g"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2824 :group 'gdb
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2825 :version "22.1")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2826
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2827 (gdb-set-buffer-rules 'gdb-memory-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2828 'gdb-memory-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2829 'gdb-memory-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2830
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2831 (def-gdb-auto-updated-buffer gdb-memory-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2832 gdb-invalidate-memory
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2833 (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2834 gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2835 gdb-read-memory-handler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2836 gdb-read-memory-custom)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2837
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2838 (defun gdb-read-memory-custom ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2839 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2840 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2841 (if (looking-at "0x[[:xdigit:]]+")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2842 (setq gdb-memory-address (match-string 0)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2843
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2844 (defvar gdb-memory-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2845 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2846 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2847 (define-key map "S" 'gdb-memory-set-address)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2848 (define-key map "N" 'gdb-memory-set-repeat-count)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2849 (define-key map "q" 'kill-this-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2850 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2851
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2852 (defun gdb-memory-set-address (&optional event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2853 "Set the start memory address."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2854 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2855 (let ((arg (read-from-minibuffer "Start address: ")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2856 (setq gdb-memory-address arg))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2857 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2858
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2859 (defun gdb-memory-set-repeat-count (&optional event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2860 "Set the number of data items in memory window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2861 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2862 (let* ((arg (read-from-minibuffer "Repeat count: "))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2863 (count (string-to-number arg)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2864 (if (<= count 0)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2865 (error "Positive numbers only")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2866 (customize-set-variable 'gdb-memory-repeat-count count)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2867 (gdb-invalidate-memory))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2868
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2869 (defun gdb-memory-format-binary ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2870 "Set the display format to binary."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2871 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2872 (customize-set-variable 'gdb-memory-format "t")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2873 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2874
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2875 (defun gdb-memory-format-octal ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2876 "Set the display format to octal."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2877 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2878 (customize-set-variable 'gdb-memory-format "o")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2879 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2880
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2881 (defun gdb-memory-format-unsigned ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2882 "Set the display format to unsigned decimal."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2883 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2884 (customize-set-variable 'gdb-memory-format "u")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2885 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2886
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2887 (defun gdb-memory-format-signed ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2888 "Set the display format to decimal."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2889 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2890 (customize-set-variable 'gdb-memory-format "d")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2891 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2892
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2893 (defun gdb-memory-format-hexadecimal ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2894 "Set the display format to hexadecimal."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2895 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2896 (customize-set-variable 'gdb-memory-format "x")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2897 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2898
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2899 (defvar gdb-memory-format-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2900 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2901 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2902 map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2903 "Keymap to select format in the header line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2904
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2905 (defvar gdb-memory-format-menu (make-sparse-keymap "Format")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2906 "Menu of display formats in the header line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2907
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2908 (define-key gdb-memory-format-menu [binary]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2909 '(menu-item "Binary" gdb-memory-format-binary
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2910 :button (:radio . (equal gdb-memory-format "t"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2911 (define-key gdb-memory-format-menu [octal]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2912 '(menu-item "Octal" gdb-memory-format-octal
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2913 :button (:radio . (equal gdb-memory-format "o"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2914 (define-key gdb-memory-format-menu [unsigned]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2915 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2916 :button (:radio . (equal gdb-memory-format "u"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2917 (define-key gdb-memory-format-menu [signed]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2918 '(menu-item "Signed Decimal" gdb-memory-format-signed
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2919 :button (:radio . (equal gdb-memory-format "d"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2920 (define-key gdb-memory-format-menu [hexadecimal]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2921 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2922 :button (:radio . (equal gdb-memory-format "x"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2923
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2924 (defun gdb-memory-format-menu (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2925 (interactive "@e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2926 (x-popup-menu event gdb-memory-format-menu))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2927
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2928 (defun gdb-memory-format-menu-1 (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2929 (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2930 (save-selected-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2931 (select-window (posn-window (event-start event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2932 (let* ((selection (gdb-memory-format-menu event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2933 (binding (and selection (lookup-key gdb-memory-format-menu
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2934 (vector (car selection))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2935 (if binding (call-interactively binding)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2936
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2937 (defun gdb-memory-unit-giant ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2938 "Set the unit size to giant words (eight bytes)."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2939 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2940 (customize-set-variable 'gdb-memory-unit "g")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2941 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2942
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2943 (defun gdb-memory-unit-word ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2944 "Set the unit size to words (four bytes)."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2945 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2946 (customize-set-variable 'gdb-memory-unit "w")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2947 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2948
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2949 (defun gdb-memory-unit-halfword ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2950 "Set the unit size to halfwords (two bytes)."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2951 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2952 (customize-set-variable 'gdb-memory-unit "h")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2953 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2954
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2955 (defun gdb-memory-unit-byte ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2956 "Set the unit size to bytes."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2957 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2958 (customize-set-variable 'gdb-memory-unit "b")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2959 (gdb-invalidate-memory))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2960
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2961 (defvar gdb-memory-unit-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2962 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2963 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2964 map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2965 "Keymap to select units in the header line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2966
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2967 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2968 "Menu of units in the header line.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2969
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2970 (define-key gdb-memory-unit-menu [giantwords]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2971 '(menu-item "Giant words" gdb-memory-unit-giant
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2972 :button (:radio . (equal gdb-memory-unit "g"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2973 (define-key gdb-memory-unit-menu [words]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2974 '(menu-item "Words" gdb-memory-unit-word
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2975 :button (:radio . (equal gdb-memory-unit "w"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2976 (define-key gdb-memory-unit-menu [halfwords]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2977 '(menu-item "Halfwords" gdb-memory-unit-halfword
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2978 :button (:radio . (equal gdb-memory-unit "h"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2979 (define-key gdb-memory-unit-menu [bytes]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2980 '(menu-item "Bytes" gdb-memory-unit-byte
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2981 :button (:radio . (equal gdb-memory-unit "b"))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2982
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2983 (defun gdb-memory-unit-menu (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2984 (interactive "@e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2985 (x-popup-menu event gdb-memory-unit-menu))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2986
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2987 (defun gdb-memory-unit-menu-1 (event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2988 (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2989 (save-selected-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2990 (select-window (posn-window (event-start event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2991 (let* ((selection (gdb-memory-unit-menu event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2992 (binding (and selection (lookup-key gdb-memory-unit-menu
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2993 (vector (car selection))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2994 (if binding (call-interactively binding)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2995
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2996 (defvar gdb-memory-font-lock-keywords
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2997 '(;; <__function.name+n>
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2998 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2999 )
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3000 "Font lock keywords used in `gdb-memory-mode'.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3001
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3002 (defun gdb-memory-mode ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3003 "Major mode for examining memory.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3004
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3005 \\{gdb-memory-mode-map}"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3006 (kill-all-local-variables)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3007 (setq major-mode 'gdb-memory-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3008 (setq mode-name "Memory")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3009 (setq buffer-read-only t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3010 (buffer-disable-undo)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3011 (use-local-map gdb-memory-mode-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3012 (setq header-line-format
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3013 '(:eval
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3014 (concat
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3015 "Start address["
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3016 (propertize
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3017 "-"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3018 'face font-lock-warning-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3019 'help-echo "mouse-1: decrement address"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3020 'mouse-face 'mode-line-highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3021 'local-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3022 (gdb-make-header-line-mouse-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3023 'mouse-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3024 (lambda () (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3025 (let ((gdb-memory-address
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3026 ;; Let GDB do the arithmetic.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3027 (concat
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3028 gdb-memory-address " - "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3029 (number-to-string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3030 (* gdb-memory-repeat-count
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3031 (cond ((string= gdb-memory-unit "b") 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3032 ((string= gdb-memory-unit "h") 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3033 ((string= gdb-memory-unit "w") 4)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3034 ((string= gdb-memory-unit "g") 8)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3035 (gdb-invalidate-memory)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3036 "|"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3037 (propertize "+"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3038 'face font-lock-warning-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3039 'help-echo "mouse-1: increment address"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3040 'mouse-face 'mode-line-highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3041 'local-map (gdb-make-header-line-mouse-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3042 'mouse-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3043 (lambda () (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3044 (let ((gdb-memory-address nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3045 (gdb-invalidate-memory)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3046 "]: "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3047 (propertize gdb-memory-address
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3048 'face font-lock-warning-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3049 'help-echo "mouse-1: set start address"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3050 'mouse-face 'mode-line-highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3051 'local-map (gdb-make-header-line-mouse-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3052 'mouse-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3053 #'gdb-memory-set-address))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3054 " Repeat Count: "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3055 (propertize (number-to-string gdb-memory-repeat-count)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3056 'face font-lock-warning-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3057 'help-echo "mouse-1: set repeat count"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3058 'mouse-face 'mode-line-highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3059 'local-map (gdb-make-header-line-mouse-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3060 'mouse-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3061 #'gdb-memory-set-repeat-count))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3062 " Display Format: "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3063 (propertize gdb-memory-format
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3064 'face font-lock-warning-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3065 'help-echo "mouse-3: select display format"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3066 'mouse-face 'mode-line-highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3067 'local-map gdb-memory-format-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3068 " Unit Size: "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3069 (propertize gdb-memory-unit
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3070 'face font-lock-warning-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3071 'help-echo "mouse-3: select unit size"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3072 'mouse-face 'mode-line-highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3073 'local-map gdb-memory-unit-map))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3074 (set (make-local-variable 'font-lock-defaults)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3075 '(gdb-memory-font-lock-keywords))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3076 (run-mode-hooks 'gdb-memory-mode-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3077 'gdb-invalidate-memory)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3078
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3079 (defun gdb-memory-buffer-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3080 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3081 (concat "*memory of " (gdb-get-target-string) "*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3082
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3083 (defun gdb-display-memory-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3084 "Display memory contents."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3085 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3086 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3087 (gdb-get-buffer-create 'gdb-memory-buffer) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3088
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3089 (defun gdb-frame-memory-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3090 "Display memory contents in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3091 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3092 (let* ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3093 (special-display-frame-alist
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3094 (cons '(left-fringe . 0)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3095 (cons '(right-fringe . 0)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3096 (cons '(width . 83) gdb-frame-parameters)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3097 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3098
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3099
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3100 ;; Locals buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3101 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3102 (gdb-set-buffer-rules 'gdb-locals-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3103 'gdb-locals-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3104 'gdb-locals-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3105
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3106 (def-gdb-auto-update-trigger gdb-invalidate-locals
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3107 (gdb-get-buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3108 "server info locals\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3109 gdb-info-locals-handler)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3110
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3111 (defvar gdb-locals-watch-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3112 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3113 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3114 (define-key map "\r" (lambda () (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3115 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3116 (gud-watch)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3117 (define-key map [mouse-2] (lambda (event) (interactive "e")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3118 (mouse-set-point event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3119 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3120 (gud-watch)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3121 map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3122 "Keymap to create watch expression of a complex data type local variable.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3123
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3124 (defconst gdb-struct-string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3125 (concat (propertize "[struct/union]"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3126 'mouse-face 'highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3127 'help-echo "mouse-2: create watch expression"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3128 'local-map gdb-locals-watch-map) "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3129
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3130 (defconst gdb-array-string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3131 (concat " " (propertize "[array]"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3132 'mouse-face 'highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3133 'help-echo "mouse-2: create watch expression"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3134 'local-map gdb-locals-watch-map) "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3135
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3136 ;; Abbreviate for arrays and structures.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3137 ;; These can be expanded using gud-display.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3138 (defun gdb-info-locals-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3139 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3140 gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3141 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3142 (with-current-buffer buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3143 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3144 ;; Need this in case "set print pretty" is on.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3145 (while (re-search-forward "^[ }].*\n" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3146 (replace-match "" nil nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3147 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3148 (while (re-search-forward "{\\(.*=.*\n\\|\n\\)" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3149 (replace-match gdb-struct-string nil nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3150 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3151 (while (re-search-forward "\\s-*{[^.].*\n" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3152 (replace-match gdb-array-string nil nil))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3153 (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3154 (and buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3155 (with-current-buffer buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3156 (let* ((window (get-buffer-window buf 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3157 (start (window-start window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3158 (p (window-point window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3159 (buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3160 (erase-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3161 (insert-buffer-substring (gdb-get-buffer-create
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3162 'gdb-partial-output-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3163 (set-window-start window start)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3164 (set-window-point window p)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3165 (run-hooks 'gdb-info-locals-hook))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3166
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3167 (defvar gdb-locals-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3168 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3169 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3170 (define-key map "q" 'kill-this-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3171 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3172
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3173 (defun gdb-locals-mode ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3174 "Major mode for gdb locals.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3175
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3176 \\{gdb-locals-mode-map}"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3177 (kill-all-local-variables)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3178 (setq major-mode 'gdb-locals-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3179 (setq mode-name (concat "Locals:" gdb-selected-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3180 (use-local-map gdb-locals-mode-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3181 (setq buffer-read-only t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3182 (buffer-disable-undo)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3183 (setq header-line-format gdb-locals-header)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3184 (gdb-thread-identification)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3185 (set (make-local-variable 'font-lock-defaults)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3186 '(gdb-locals-font-lock-keywords))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3187 (run-mode-hooks 'gdb-locals-mode-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3188 (if (and (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3189 (string-equal gdb-version "pre-6.4"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3190 'gdb-invalidate-locals
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3191 'gdb-invalidate-locals-1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3192
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3193 (defun gdb-locals-buffer-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3194 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3195 (concat "*locals of " (gdb-get-target-string) "*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3196
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3197 (defun gdb-display-locals-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3198 "Display local variables of current stack and their values."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3199 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3200 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3201 (gdb-get-buffer-create 'gdb-locals-buffer) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3202
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3203 (defun gdb-frame-locals-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3204 "Display local variables of current stack and their values in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3205 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3206 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3207 (special-display-frame-alist gdb-frame-parameters))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3208 (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3209
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3210
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3211 ;;;; Window management
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3212 (defun gdb-display-buffer (buf dedicated &optional frame)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3213 (let ((answer (get-buffer-window buf (or frame 0))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3214 (if answer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3215 (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3216 (let ((window (get-lru-window)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3217 (if (memq (buffer-local-value 'gud-minor-mode (window-buffer window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3218 '(gdba gdbmi))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3219 (let* ((largest (get-largest-window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3220 (cur-size (window-height largest)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3221 (setq answer (split-window largest))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3222 (set-window-buffer answer buf)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3223 (set-window-dedicated-p answer dedicated)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3224 answer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3225 (set-window-buffer window buf)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3226 window)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3227
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3228
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3229 ;;; Shared keymap initialization:
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3230
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3231 (let ((menu (make-sparse-keymap "GDB-Windows")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3232 (define-key gud-menu-map [displays]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3233 `(menu-item "GDB-Windows" ,menu
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3234 :help "Open a GDB-UI buffer in a new window."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3235 :visible (memq gud-minor-mode '(gdbmi gdba))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3236 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3237 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3238 (define-key menu [inferior]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3239 '(menu-item "Separate IO" gdb-display-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3240 :enable gdb-use-separate-io-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3241 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3242 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3243 (define-key menu [disassembly]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3244 '("Disassembly" . gdb-display-assembler-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3245 (define-key menu [breakpoints]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3246 '("Breakpoints" . gdb-display-breakpoints-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3247 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3248 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3249
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3250 (let ((menu (make-sparse-keymap "GDB-Frames")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3251 (define-key gud-menu-map [frames]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3252 `(menu-item "GDB-Frames" ,menu
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3253 :help "Open a GDB-UI buffer in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3254 :visible (memq gud-minor-mode '(gdbmi gdba))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3255 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3256 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3257 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3258 (define-key menu [inferior]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3259 '(menu-item "Separate IO" gdb-frame-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3260 :enable gdb-use-separate-io-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3261 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3262 (define-key menu [disassembly] '("Disassembly" . gdb-frame-assembler-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3263 (define-key menu [breakpoints]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3264 '("Breakpoints" . gdb-frame-breakpoints-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3265 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3266 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3267
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3268 (let ((menu (make-sparse-keymap "GDB-UI/MI")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3269 (define-key gud-menu-map [ui]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3270 `(menu-item (if (eq gud-minor-mode 'gdba) "GDB-UI" "GDB-MI")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3271 ,menu :visible (memq gud-minor-mode '(gdbmi gdba))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3272 (define-key menu [gdb-customize]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3273 '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3274 :help "Customize Gdb Graphical Mode options."))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3275 (define-key menu [gdb-find-source-frame]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3276 '(menu-item "Look For Source Frame" gdb-find-source-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3277 :visible (eq gud-minor-mode 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3278 :help "Toggle looking for source frame further up call stack."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3279 :button (:toggle . gdb-find-source-frame)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3280 (define-key menu [gdb-use-separate-io]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3281 '(menu-item "Separate IO" gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3282 :visible (eq gud-minor-mode 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3283 :help "Toggle separate IO for debugged program."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3284 :button (:toggle . gdb-use-separate-io-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3285 (define-key menu [gdb-many-windows]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3286 '(menu-item "Display Other Windows" gdb-many-windows
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
3287 :help "Toggle display of locals, stack and breakpoint information."
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3288 :button (:toggle . gdb-many-windows)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3289 (define-key menu [gdb-restore-windows]
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3290 '(menu-item "Restore Window Layout" gdb-restore-windows
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3291 :help "Restore standard layout for debug session.")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3292
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3293 (defun gdb-frame-gdb-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3294 "Display GUD buffer in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3295 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3296 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3297 (special-display-frame-alist
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3298 (remove '(menu-bar-lines) (remove '(tool-bar-lines)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3299 gdb-frame-parameters)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3300 (same-window-regexps nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3301 (display-buffer gud-comint-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3302
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3303 (defun gdb-display-gdb-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3304 "Display GUD buffer."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3305 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3306 (let ((same-window-regexps nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3307 (select-window (display-buffer gud-comint-buffer nil 0))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3308
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3309 (defun gdb-set-window-buffer (name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3310 (set-window-buffer (selected-window) (get-buffer name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3311 (set-window-dedicated-p (selected-window) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3312
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3313 (defun gdb-setup-windows ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3314 "Layout the window pattern for `gdb-many-windows'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3315 (gdb-display-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3316 (gdb-display-stack-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3317 (delete-other-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3318 (gdb-display-breakpoints-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3319 (delete-other-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3320 ; Don't dedicate.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3321 (pop-to-buffer gud-comint-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3322 (split-window nil ( / ( * (window-height) 3) 4))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3323 (split-window nil ( / (window-height) 3))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3324 (split-window-horizontally)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3325 (other-window 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3326 (gdb-set-window-buffer (gdb-locals-buffer-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3327 (other-window 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3328 (switch-to-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3329 (if gud-last-last-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3330 (gud-find-file (car gud-last-last-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3331 (if gdb-main-file
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3332 (gud-find-file gdb-main-file)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3333 ;; Put buffer list in window if we
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3334 ;; can't find a source file.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3335 (list-buffers-noselect))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3336 (setq gdb-source-window (selected-window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3337 (when gdb-use-separate-io-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3338 (split-window-horizontally)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3339 (other-window 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3340 (gdb-set-window-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3341 (gdb-get-buffer-create 'gdb-inferior-io)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3342 (other-window 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3343 (gdb-set-window-buffer (gdb-stack-buffer-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3344 (split-window-horizontally)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3345 (other-window 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3346 (gdb-set-window-buffer (gdb-breakpoints-buffer-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3347 (other-window 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3348
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3349 (defun gdb-restore-windows ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3350 "Restore the basic arrangement of windows used by gdba.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3351 This arrangement depends on the value of `gdb-many-windows'."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3352 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3353 (pop-to-buffer gud-comint-buffer) ;Select the right window and frame.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3354 (delete-other-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3355 (if gdb-many-windows
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3356 (gdb-setup-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3357 (when (or gud-last-last-frame gdb-show-main)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3358 (split-window)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3359 (other-window 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3360 (switch-to-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3361 (if gud-last-last-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3362 (gud-find-file (car gud-last-last-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3363 (gud-find-file gdb-main-file)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3364 (setq gdb-source-window (selected-window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3365 (other-window 1))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3366
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3367 (defun gdb-reset ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3368 "Exit a debugging session cleanly.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3369 Kills the gdb buffers, and resets variables and the source buffers."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3370 (dolist (buffer (buffer-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3371 (unless (eq buffer gud-comint-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3372 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3373 (if (memq gud-minor-mode '(gdbmi gdba))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3374 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3375 (kill-buffer nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3376 (gdb-remove-breakpoint-icons (point-min) (point-max) t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3377 (setq gud-minor-mode nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3378 (kill-local-variable 'tool-bar-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3379 (kill-local-variable 'gdb-define-alist))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3380 (setq gdb-overlay-arrow-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3381 (setq overlay-arrow-variable-list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3382 (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3383 (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3384 (setq gdb-stack-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3385 (setq overlay-arrow-variable-list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3386 (delq 'gdb-stack-position overlay-arrow-variable-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3387 (if (boundp 'speedbar-frame) (speedbar-timer-fn))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3388 (setq gud-running nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3389 (setq gdb-active-process nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3390 (setq gdb-var-list nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3391 (remove-hook 'after-save-hook 'gdb-create-define-alist t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3392
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3393 (defun gdb-source-info ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3394 "Find the source file where the program starts and display it with related
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3395 buffers."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3396 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3397 (if (and (search-forward "Located in " nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3398 (looking-at "\\S-+"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3399 (setq gdb-main-file (match-string 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3400 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3401 (if (search-forward "Includes preprocessor macro info." nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3402 (setq gdb-macro-info t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3403 (if gdb-many-windows
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3404 (gdb-setup-windows)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3405 (gdb-get-buffer-create 'gdb-breakpoints-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3406 (if (and gdb-show-main gdb-main-file)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3407 (let ((pop-up-windows t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3408 (display-buffer (gud-find-file gdb-main-file)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3409 (setq gdb-ready t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3410
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3411 (defun gdb-get-location (bptno line flag)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3412 "Find the directory containing the relevant source file.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3413 Put in buffer and place breakpoint icon."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3414 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3415 (catch 'file-not-found
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3416 (if (search-forward "Located in " nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3417 (when (looking-at "\\S-+")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3418 (delete (cons bptno "File not found") gdb-location-alist)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3419 (push (cons bptno (match-string 0)) gdb-location-alist))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3420 (gdb-resync)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3421 (unless (assoc bptno gdb-location-alist)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3422 (push (cons bptno "File not found") gdb-location-alist)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3423 (message-box "Cannot find source file for breakpoint location.\n\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3424 Add directory to search path for source files using the GDB command, dir."))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3425 (throw 'file-not-found nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3426 (with-current-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3427 (find-file-noselect (match-string 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3428 (gdb-init-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3429 ;; only want one breakpoint icon at each location
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3430 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3431 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3432 (forward-line (1- (string-to-number line)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3433 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3434
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3435 (add-hook 'find-file-hook 'gdb-find-file-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3436
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3437 (defun gdb-find-file-hook ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3438 "Set up buffer for debugging if file is part of the source code
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3439 of the current session."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3440 (if (and (buffer-name gud-comint-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3441 ;; in case gud or gdb-ui is just loaded
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3442 gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3443 (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3444 '(gdba gdbmi)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3445 ;;Pre GDB 6.3 "info sources" doesn't give absolute file name.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3446 (if (member (if (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3447 (file-name-nondirectory buffer-file-name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3448 buffer-file-name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3449 gdb-source-file-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3450 (with-current-buffer (find-buffer-visiting buffer-file-name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3451 (gdb-init-buffer)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3452
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3453 ;;from put-image
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3454 (defun gdb-put-string (putstring pos &optional dprop &rest sprops)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3455 "Put string PUTSTRING in front of POS in the current buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3456 PUTSTRING is displayed by putting an overlay into the current buffer with a
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3457 `before-string' string that has a `display' property whose value is
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3458 PUTSTRING."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3459 (let ((string (make-string 1 ?x))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3460 (buffer (current-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3461 (setq putstring (copy-sequence putstring))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3462 (let ((overlay (make-overlay pos pos buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3463 (prop (or dprop
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3464 (list (list 'margin 'left-margin) putstring))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3465 (put-text-property 0 1 'display prop string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3466 (if sprops
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3467 (add-text-properties 0 1 sprops string))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3468 (overlay-put overlay 'put-break t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3469 (overlay-put overlay 'before-string string))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3470
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3471 ;;from remove-images
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3472 (defun gdb-remove-strings (start end &optional buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3473 "Remove strings between START and END in BUFFER.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3474 Remove only strings that were put in BUFFER with calls to `gdb-put-string'.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3475 BUFFER nil or omitted means use the current buffer."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3476 (unless buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3477 (setq buffer (current-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3478 (dolist (overlay (overlays-in start end))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3479 (when (overlay-get overlay 'put-break)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3480 (delete-overlay overlay))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3481
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3482 (defun gdb-put-breakpoint-icon (enabled bptno)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3483 (if (string-match "[0-9+]+\\." bptno)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3484 (setq enabled gdb-parent-bptno-enabled))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3485 (let ((start (- (line-beginning-position) 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3486 (end (+ (line-end-position) 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3487 (putstring (if enabled "B" "b"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3488 (source-window (get-buffer-window (current-buffer) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3489 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3490 0 1 '(help-echo "mouse-1: clear bkpt, mouse-3: enable/disable bkpt")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3491 putstring)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3492 (if enabled
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3493 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3494 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3495 (add-text-properties
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3496 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3497 (gdb-remove-breakpoint-icons start end)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3498 (if (display-images-p)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3499 (if (>= (or left-fringe-width
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3500 (if source-window (car (window-fringes source-window)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3501 gdb-buffer-fringe-width) 8)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3502 (gdb-put-string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3503 nil (1+ start)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3504 `(left-fringe breakpoint
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3505 ,(if enabled
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3506 'breakpoint-enabled
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3507 'breakpoint-disabled))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3508 'gdb-bptno bptno
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3509 'gdb-enabled enabled)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3510 (when (< left-margin-width 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3511 (save-current-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3512 (setq left-margin-width 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3513 (if source-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3514 (set-window-margins
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3515 source-window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3516 left-margin-width right-margin-width))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3517 (put-image
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3518 (if enabled
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3519 (or breakpoint-enabled-icon
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3520 (setq breakpoint-enabled-icon
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3521 (find-image `((:type xpm :data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3522 ,breakpoint-xpm-data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3523 :ascent 100 :pointer hand)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3524 (:type pbm :data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3525 ,breakpoint-enabled-pbm-data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3526 :ascent 100 :pointer hand)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3527 (or breakpoint-disabled-icon
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3528 (setq breakpoint-disabled-icon
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3529 (find-image `((:type xpm :data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3530 ,breakpoint-xpm-data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3531 :conversion disabled
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3532 :ascent 100 :pointer hand)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3533 (:type pbm :data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3534 ,breakpoint-disabled-pbm-data
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3535 :ascent 100 :pointer hand))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3536 (+ start 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3537 putstring
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3538 'left-margin))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3539 (when (< left-margin-width 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3540 (save-current-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3541 (setq left-margin-width 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3542 (let ((window (get-buffer-window (current-buffer) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3543 (if window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3544 (set-window-margins
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3545 window left-margin-width right-margin-width)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3546 (gdb-put-string
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3547 (propertize putstring
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3548 'face (if enabled 'breakpoint-enabled 'breakpoint-disabled))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3549 (1+ start)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3550
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3551 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3552 (gdb-remove-strings start end)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3553 (if (display-images-p)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3554 (remove-images start end))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3555 (when remove-margin
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3556 (setq left-margin-width 0)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3557 (let ((window (get-buffer-window (current-buffer) 0)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3558 (if window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3559 (set-window-margins
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3560 window left-margin-width right-margin-width)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3561
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3562
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3563 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3564 ;; Assembler buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3565 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3566 (gdb-set-buffer-rules 'gdb-assembler-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3567 'gdb-assembler-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3568 'gdb-assembler-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3569
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3570 ;; We can't use def-gdb-auto-update-handler because we don't want to use
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3571 ;; window-start but keep the overlay arrow/current line visible.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3572 (defun gdb-assembler-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3573 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3574 (delq 'gdb-invalidate-assembler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3575 gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3576 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3577 (and buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3578 (with-current-buffer buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3579 (let* ((window (get-buffer-window buf 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3580 (p (window-point window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3581 (buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3582 (erase-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3583 (insert-buffer-substring (gdb-get-buffer-create
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3584 'gdb-partial-output-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3585 (set-window-point window p)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3586 ;; put customisation here
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3587 (gdb-assembler-custom))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3588
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3589 (defun gdb-assembler-custom ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3590 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3591 (pos 1) (address) (flag) (bptno))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3592 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3593 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3594 (if (not (equal gdb-pc-address "main"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3595 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3596 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3597 (if (and gdb-pc-address
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3598 (search-forward gdb-pc-address nil t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3599 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3600 (setq pos (point))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3601 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3602 (setq fringe-indicator-alist
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3603 (if (string-equal gdb-frame-number "0")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3604 nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3605 '((overlay-arrow . hollow-right-triangle))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3606 (or gdb-overlay-arrow-position
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3607 (setq gdb-overlay-arrow-position (make-marker)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3608 (set-marker gdb-overlay-arrow-position (point))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3609 ;; remove all breakpoint-icons in assembler buffer before updating.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3610 (gdb-remove-breakpoint-icons (point-min) (point-max))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3611 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3612 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3613 (while (< (point) (- (point-max) 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3614 (forward-line 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3615 (when (looking-at
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3616 "\\([0-9]+\\.?[0-9]*\\).*?\\s-+\\(.\\)\\s-+0x0*\\(\\S-+\\)")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3617 (setq bptno (match-string 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3618 (setq flag (char-after (match-beginning 2)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3619 (setq address (match-string 3))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3620 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3621 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3622 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3623 (if (re-search-forward (concat "^0x0*" address) nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3624 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3625 (if (not (equal gdb-pc-address "main"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3626 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3627 (set-window-point (get-buffer-window buffer 0) pos)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3628
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3629 (defvar gdb-assembler-mode-map
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3630 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3631 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3632 (define-key map "q" 'kill-this-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3633 map))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3634
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3635 (defvar gdb-assembler-font-lock-keywords
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3636 '(;; <__function.name+n>
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3637 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3638 (1 font-lock-function-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3639 ;; 0xNNNNNNNN <__function.name+n>: opcode
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3640 ("^0x[0-9a-f]+ \\(<\\(\\(\\sw\\|[_.]\\)+\\)\\+[0-9]+>\\)?:[ \t]+\\(\\sw+\\)"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3641 (4 font-lock-keyword-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3642 ;; %register(at least i386)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3643 ("%\\sw+" . font-lock-variable-name-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3644 ("^\\(Dump of assembler code for function\\) \\(.+\\):"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3645 (1 font-lock-comment-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3646 (2 font-lock-function-name-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3647 ("^\\(End of assembler dump\\.\\)" . font-lock-comment-face))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3648 "Font lock keywords used in `gdb-assembler-mode'.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3649
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3650 (defun gdb-assembler-mode ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3651 "Major mode for viewing code assembler.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3652
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3653 \\{gdb-assembler-mode-map}"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3654 (kill-all-local-variables)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3655 (setq major-mode 'gdb-assembler-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3656 (setq mode-name (concat "Machine:" gdb-selected-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3657 (setq gdb-overlay-arrow-position nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3658 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3659 (setq fringes-outside-margins t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3660 (setq buffer-read-only t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3661 (buffer-disable-undo)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3662 (gdb-thread-identification)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3663 (use-local-map gdb-assembler-mode-map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3664 (gdb-invalidate-assembler)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3665 (set (make-local-variable 'font-lock-defaults)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3666 '(gdb-assembler-font-lock-keywords))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3667 (run-mode-hooks 'gdb-assembler-mode-hook)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3668 'gdb-invalidate-assembler)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3669
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3670 (defun gdb-assembler-buffer-name ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3671 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3672 (concat "*disassembly of " (gdb-get-target-string) "*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3673
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3674 (defun gdb-display-assembler-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3675 "Display disassembly view."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3676 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3677 (setq gdb-previous-frame nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3678 (gdb-display-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3679 (gdb-get-buffer-create 'gdb-assembler-buffer) t))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3680
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3681 (defun gdb-frame-assembler-buffer ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3682 "Display disassembly view in a new frame."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3683 (interactive)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3684 (setq gdb-previous-frame nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3685 (let ((special-display-regexps (append special-display-regexps '(".*")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3686 (special-display-frame-alist gdb-frame-parameters))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3687 (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3688
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3689 ;; modified because if gdb-pc-address has changed value a new command
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3690 ;; must be enqueued to update the buffer with the new output
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3691 (defun gdb-invalidate-assembler (&optional ignored)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3692 (if (gdb-get-buffer 'gdb-assembler-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3693 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3694 (unless (and gdb-selected-frame
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3695 (string-equal gdb-selected-frame gdb-previous-frame))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3696 (if (or (not (member 'gdb-invalidate-assembler
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3697 gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3698 (not (equal (string-to-number gdb-pc-address)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3699 (string-to-number
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3700 gdb-previous-frame-pc-address))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3701 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3702 ;; take previous disassemble command, if any, off the queue
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3703 (with-current-buffer gud-comint-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3704 (let ((queue gdb-input-queue))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3705 (dolist (item queue)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3706 (if (equal (cdr item) '(gdb-assembler-handler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3707 (setq gdb-input-queue
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3708 (delete item gdb-input-queue))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3709 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3710 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3711 (concat gdb-server-prefix "disassemble " gdb-pc-address "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3712 'gdb-assembler-handler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3713 (push 'gdb-invalidate-assembler gdb-pending-triggers)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3714 (setq gdb-previous-frame-pc-address gdb-pc-address)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3715 (setq gdb-previous-frame gdb-selected-frame)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3716
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3717 (defun gdb-get-selected-frame ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3718 (if (not (member 'gdb-get-selected-frame gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3719 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3720 (if (string-equal gdb-version "pre-6.4")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3721 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3722 (list (concat gdb-server-prefix "info frame\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3723 'gdb-frame-handler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3724 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3725 (list "server interpreter mi -stack-info-frame\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3726 'gdb-frame-handler-1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3727 (push 'gdb-get-selected-frame gdb-pending-triggers))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3728
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3729 (defun gdb-frame-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3730 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3731 (delq 'gdb-get-selected-frame gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3732 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3733 (when (re-search-forward
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3734 "Stack level \\([0-9]+\\), frame at \\(0x[[:xdigit:]]+\\)" nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3735 (setq gdb-frame-number (match-string 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3736 (setq gdb-frame-address (match-string 2)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3737 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3738 (when (re-search-forward ".*=\\s-+\\(\\S-*\\)\\s-+in\\s-+\\(.*?\\)\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3739 \\(?: (\\(\\S-+?\\):[0-9]+?)\\)*; "
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3740 nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3741 (setq gdb-selected-frame (match-string 2))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3742 (if (gdb-get-buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3743 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3744 (setq mode-name (concat "Locals:" gdb-selected-frame))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3745 (if (gdb-get-buffer 'gdb-assembler-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3746 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3747 (setq mode-name (concat "Machine:" gdb-selected-frame))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3748 (setq gdb-pc-address (match-string 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3749 (if (and (match-string 3) gud-overlay-arrow-position)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3750 (let ((buffer (marker-buffer gud-overlay-arrow-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3751 (position (marker-position gud-overlay-arrow-position)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3752 (when (and buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3753 (string-equal (file-name-nondirectory
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3754 (buffer-file-name buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3755 (file-name-nondirectory (match-string 3))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3756 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3757 (setq fringe-indicator-alist
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3758 (if (string-equal gdb-frame-number "0")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3759 nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3760 '((overlay-arrow . hollow-right-triangle))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3761 (set-marker gud-overlay-arrow-position position))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3762 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3763 (if (re-search-forward " source language \\(\\S-+\\)\." nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3764 (setq gdb-current-language (match-string 1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3765 (gdb-invalidate-assembler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3766
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3767
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3768 ;; Code specific to GDB 6.4
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3769 (defconst gdb-source-file-regexp-1 "fullname=\"\\(.*?\\)\"")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3770
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3771 (defun gdb-set-gud-minor-mode-existing-buffers-1 ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3772 "Create list of source files for current GDB session.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3773 If buffers already exist for any of these files, `gud-minor-mode'
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3774 is set in them."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3775 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3776 (while (re-search-forward gdb-source-file-regexp-1 nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3777 (push (match-string 1) gdb-source-file-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3778 (dolist (buffer (buffer-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3779 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3780 (when (member buffer-file-name gdb-source-file-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3781 (gdb-init-buffer))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3782 (gdb-force-mode-line-update
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3783 (propertize "ready" 'face font-lock-variable-name-face)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3784
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3785 ;; Used for -stack-info-frame but could be used for -stack-list-frames too.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3786 (defconst gdb-stack-list-frames-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3787 ".*?level=\"\\(.*?\\)\".*?,addr=\"\\(.*?\\)\".*?,func=\"\\(.*?\\)\",\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3788 \\(?:.*?file=\".*?\".*?,fullname=\"\\(.*?\\)\".*?,line=\"\\(.*?\\)\".*?}\\|\
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3789 from=\"\\(.*?\\)\"\\)")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3790
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3791 (defun gdb-frame-handler-1 ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3792 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3793 (delq 'gdb-get-selected-frame gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3794 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3795 (when (re-search-forward gdb-stack-list-frames-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3796 (setq gdb-frame-number (match-string 1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3797 (setq gdb-pc-address (match-string 2))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3798 (setq gdb-selected-frame (match-string 3))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3799 (if (gdb-get-buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3800 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3801 (setq mode-name (concat "Locals:" gdb-selected-frame))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3802 (if (gdb-get-buffer 'gdb-assembler-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3803 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3804 (setq mode-name (concat "Machine:" gdb-selected-frame)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3805 (if (and (match-string 4) (match-string 5) gud-overlay-arrow-position)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3806 (let ((buffer (marker-buffer gud-overlay-arrow-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3807 (position (marker-position gud-overlay-arrow-position)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3808 (when (and buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3809 (string-equal (file-name-nondirectory
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3810 (buffer-file-name buffer))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3811 (file-name-nondirectory (match-string 4))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3812 (with-current-buffer buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3813 (setq fringe-indicator-alist
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3814 (if (string-equal gdb-frame-number "0")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3815 nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3816 '((overlay-arrow . hollow-right-triangle))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3817 (set-marker gud-overlay-arrow-position position)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3818 (gdb-invalidate-assembler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3819
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3820 ; Uses "-var-list-children --all-values". Needs GDB 6.4 onwards.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3821 (defun gdb-var-list-children-1 (varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3822 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3823 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3824 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3825 (concat "server interpreter mi \"-var-list-children --all-values \\\""
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3826 varnum "\\\"\"\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3827 (concat "-var-list-children --all-values \"" varnum "\"\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3828 `(lambda () (gdb-var-list-children-handler-1 ,varnum)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3829
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3830 (defun gdb-var-list-children-handler-1 (varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3831 (let* ((var-list nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3832 (output (bindat-get-field (gdb-json-partial-output "child")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3833 (children (bindat-get-field output 'children)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3834 (catch 'child-already-watched
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3835 (dolist (var gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3836 (if (string-equal varnum (car var))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3837 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3838 ;; With dynamic varobjs numchild may have increased.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3839 (setcar (nthcdr 2 var) (bindat-get-field output 'numchild))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3840 (push var var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3841 (dolist (child children)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3842 (let ((varchild (list (bindat-get-field child 'name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3843 (bindat-get-field child 'exp)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3844 (bindat-get-field child 'numchild)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3845 (bindat-get-field child 'type)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3846 (bindat-get-field child 'value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3847 nil
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3848 (bindat-get-field child 'has_more))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3849 (if (assoc (car varchild) gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3850 (throw 'child-already-watched nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3851 (push varchild var-list))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3852 (push var var-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3853 (setq gdb-var-list (nreverse var-list))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3854 (gdb-speedbar-update))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3855
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3856 ; Uses "-var-update --all-values". Needs GDB 6.4 onwards.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3857 (defun gdb-var-update-1 ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3858 (if (not (member 'gdb-var-update gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3859 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3860 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3861 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3862 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3863 "server interpreter mi \"-var-update --all-values *\"\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3864 "-var-update --all-values *\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3865 'gdb-var-update-handler-1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3866 (push 'gdb-var-update gdb-pending-triggers))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3867
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3868 (defun gdb-var-update-handler-1 ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3869 (let ((changelist (bindat-get-field (gdb-json-partial-output) 'changelist)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3870 (dolist (var gdb-var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3871 (setcar (nthcdr 5 var) nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3872 (let ((temp-var-list gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3873 (dolist (change changelist)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3874 (let* ((varnum (bindat-get-field change 'name))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3875 (var (assoc varnum gdb-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3876 (new-num (bindat-get-field change 'new_num_children)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3877 (when var
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3878 (let ((scope (bindat-get-field change 'in_scope))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3879 (has-more (bindat-get-field change 'has_more)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3880 (cond ((string-equal scope "false")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3881 (if gdb-delete-out-of-scope
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3882 (gdb-var-delete-1 var varnum)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3883 (setcar (nthcdr 5 var) 'out-of-scope)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3884 ((string-equal scope "true")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3885 (setcar (nthcdr 6 var) has-more)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3886 (when (and (or (not has-more)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3887 (string-equal has-more "0"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3888 (not new-num)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3889 (string-equal (nth 2 var) "0"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3890 (setcar (nthcdr 4 var)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3891 (bindat-get-field change 'value))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3892 (setcar (nthcdr 5 var) 'changed)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3893 ((string-equal scope "invalid")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3894 (gdb-var-delete-1 var varnum)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3895 (let ((var-list nil) var1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3896 (children (bindat-get-field change 'new_children)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3897 (if new-num
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3898 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3899 (setq var1 (pop temp-var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3900 (while var1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3901 (if (string-equal varnum (car var1))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3902 (let ((new (string-to-number new-num))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3903 (previous (string-to-number (nth 2 var1))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3904 (setcar (nthcdr 2 var1) new-num)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3905 (push var1 var-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3906 (cond ((> new previous)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3907 ;; Add new children to list.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3908 (dotimes (dummy previous)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3909 (push (pop temp-var-list) var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3910 (dolist (child children)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3911 (let ((varchild
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3912 (list (bindat-get-field child 'name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3913 (bindat-get-field child 'exp)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3914 (bindat-get-field child 'numchild)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3915 (bindat-get-field child 'type)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3916 (bindat-get-field child 'value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3917 'changed
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3918 (bindat-get-field child 'has_more))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3919 (push varchild var-list))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3920 ;; Remove deleted children from list.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3921 ((< new previous)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3922 (dotimes (dummy new)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3923 (push (pop temp-var-list) var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3924 (dotimes (dummy (- previous new))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3925 (pop temp-var-list)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3926 (push var1 var-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3927 (setq var1 (pop temp-var-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3928 (setq gdb-var-list (nreverse var-list)))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3929 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3930 (delq 'gdb-var-update gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3931 (gdb-speedbar-update))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3932
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3933 ;; Registers buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3934 ;;
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3935 (gdb-set-buffer-rules 'gdb-registers-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3936 'gdb-registers-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3937 'gdb-registers-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3938
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3939 (def-gdb-auto-update-trigger gdb-invalidate-registers-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3940 (gdb-get-buffer 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3941 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3942 "server interpreter mi \"-data-list-register-values x\"\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3943 "-data-list-register-values x\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3944 gdb-data-list-register-values-handler)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3945
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3946 (defconst gdb-data-list-register-values-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3947 "{.*?number=\"\\(.*?\\)\".*?,value=\"\\(.*?\\)\".*?}")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3948
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3949 (defun gdb-data-list-register-values-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3950 (setq gdb-pending-triggers (delq 'gdb-invalidate-registers-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3951 gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3952 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3953 (if (re-search-forward gdb-error-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3954 (let ((err (match-string 1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3955 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3956 (let ((buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3957 (erase-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3958 (put-text-property 0 (length err) 'face font-lock-warning-face err)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3959 (insert err)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3960 (goto-char (point-min)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3961 (let ((register-list (reverse gdb-register-names))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3962 (register nil) (register-string nil) (register-values nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3963 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3964 (while (re-search-forward gdb-data-list-register-values-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3965 (setq register (pop register-list))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3966 (setq register-string (concat register "\t" (match-string 2) "\n"))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3967 (if (member (match-string 1) gdb-changed-registers)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3968 (put-text-property 0 (length register-string)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3969 'face 'font-lock-warning-face
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3970 register-string))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3971 (setq register-values
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3972 (concat register-values register-string)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3973 (let ((buf (gdb-get-buffer 'gdb-registers-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3974 (with-current-buffer buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3975 (let* ((window (get-buffer-window buf 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3976 (start (window-start window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3977 (p (if window (window-point window) (point)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3978 (buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3979 (erase-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3980 (insert register-values)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3981 (if window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3982 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3983 (set-window-start window start)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3984 (set-window-point window p))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3985 (goto-char p)))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3986 (gdb-data-list-register-values-custom))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3987
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3988 (defun gdb-data-list-register-values-custom ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3989 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3990 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3991 (let ((buffer-read-only nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3992 start end)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3993 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3994 (while (< (point) (point-max))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3995 (setq start (line-beginning-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3996 (setq end (line-end-position))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3997 (when (looking-at "^[^\t]+")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3998 (unless (string-equal (match-string 0) "No registers.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3999 (put-text-property start (match-end 0)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4000 'face font-lock-variable-name-face)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4001 (add-text-properties start end
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4002 '(help-echo "mouse-2: edit value"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4003 mouse-face highlight))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4004 (forward-line 1))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4005
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4006 ;; Needs GDB 6.4 onwards (used to fail with no stack).
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4007 (defun gdb-get-changed-registers ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4008 (if (and (gdb-get-buffer 'gdb-registers-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4009 (not (member 'gdb-get-changed-registers gdb-pending-triggers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4010 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4011 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4012 (list
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4013 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4014 "server interpreter mi -data-list-changed-registers\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4015 "-data-list-changed-registers\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4016 'gdb-get-changed-registers-handler))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4017 (push 'gdb-get-changed-registers gdb-pending-triggers))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4018
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4019 (defconst gdb-data-list-register-names-regexp "\"\\(.*?\\)\"")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4020
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4021 (defun gdb-get-changed-registers-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4022 (setq gdb-pending-triggers
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4023 (delq 'gdb-get-changed-registers gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4024 (setq gdb-changed-registers nil)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4025 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4026 (while (re-search-forward gdb-data-list-register-names-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4027 (push (match-string 1) gdb-changed-registers)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4028
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4029
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4030 ;; Locals buffer.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4031 ;;
106697
ac408704629c lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents: 106680
diff changeset
4032 ;; uses "-stack-list-locals --simple-values". Needs GDB 6.1 onwards.
106678
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4033 (gdb-set-buffer-rules 'gdb-locals-buffer
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4034 'gdb-locals-buffer-name
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4035 'gdb-locals-mode)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4036
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4037 (def-gdb-auto-update-trigger gdb-invalidate-locals-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4038 (gdb-get-buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4039 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4040 "server interpreter mi -\"stack-list-locals --simple-values\"\n"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4041 "-stack-list-locals --simple-values\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4042 gdb-stack-list-locals-handler)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4043
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4044 (defconst gdb-stack-list-locals-regexp
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4045 "{.*?name=\"\\(.*?\\)\".*?,type=\"\\(.*?\\)\"")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4046
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4047 (defvar gdb-locals-watch-map-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4048 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4049 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4050 (define-key map "\r" 'gud-watch)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4051 (define-key map [mouse-2] 'gud-watch)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4052 map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4053 "Keymap to create watch expression of a complex data type local variable.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4054
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4055 (defvar gdb-edit-locals-map-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4056 (let ((map (make-sparse-keymap)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4057 (suppress-keymap map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4058 (define-key map "\r" 'gdb-edit-locals-value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4059 (define-key map [mouse-2] 'gdb-edit-locals-value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4060 map)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4061 "Keymap to edit value of a simple data type local variable.")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4062
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4063 (defun gdb-edit-locals-value (&optional event)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4064 "Assign a value to a variable displayed in the locals buffer."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4065 (interactive (list last-input-event))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4066 (save-excursion
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4067 (if event (posn-set-point (event-end event)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4068 (beginning-of-line)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4069 (let* ((var (current-word))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4070 (value (read-string (format "New value (%s): " var))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4071 (gdb-enqueue-input
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4072 (list (concat gdb-server-prefix "set variable " var " = " value "\n")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4073 'ignore)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4074
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4075 ;; Dont display values of arrays or structures.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4076 ;; These can be expanded using gud-watch.
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4077 (defun gdb-stack-list-locals-handler ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4078 (setq gdb-pending-triggers (delq 'gdb-invalidate-locals-1
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4079 gdb-pending-triggers))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4080 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4081 (if (re-search-forward gdb-error-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4082 (let ((err (match-string 1)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4083 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4084 (let ((buffer-read-only nil))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4085 (erase-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4086 (insert err)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4087 (goto-char (point-min)))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4088 (let (local locals-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4089 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4090 (while (re-search-forward gdb-stack-list-locals-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4091 (let ((local (list (match-string 1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4092 (match-string 2)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4093 nil)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4094 (if (looking-at ",value=\\(\".*\"\\).*?}")
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4095 (setcar (nthcdr 2 local) (read (match-string 1))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4096 (push local locals-list)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4097 (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4098 (and buf (with-current-buffer buf
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4099 (let* ((window (get-buffer-window buf 0))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4100 (start (window-start window))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4101 (p (if window (window-point window) (point)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4102 (buffer-read-only nil) (name) (value))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4103 (erase-buffer)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4104 (dolist (local locals-list)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4105 (setq name (car local))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4106 (setq value (nth 2 local))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4107 (if (or (not value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4108 (string-match "^\\0x" value))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4109 (add-text-properties 0 (length name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4110 `(mouse-face highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4111 help-echo "mouse-2: create watch expression"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4112 local-map ,gdb-locals-watch-map-1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4113 name)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4114 (add-text-properties 0 (length value)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4115 `(mouse-face highlight
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4116 help-echo "mouse-2: edit value"
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4117 local-map ,gdb-edit-locals-map-1)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4118 value))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4119 (insert
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4120 (concat name "\t" (nth 1 local)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4121 "\t" value "\n")))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4122 (if window
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4123 (progn
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4124 (set-window-start window start)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4125 (set-window-point window p))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4126 (goto-char p)))))))))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4127
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4128 (defun gdb-get-register-names ()
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4129 "Create a list of register names."
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4130 (goto-char (point-min))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4131 (while (re-search-forward gdb-data-list-register-names-regexp nil t)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4132 (push (match-string 1) gdb-register-names)))
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4133
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4134 (provide 'gdb-ui)
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4135
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4136 ;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352
3a8fd7717b30 This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4137 ;;; gdb-ui.el ends here